tn5250j/src/org/tn5250j DataStreamProducer.java,1.9,1.10

Patrick Bielen <[email protected]> Mon, 14 Jun 2004 09:44:56 +0000
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2725/src/org/tn5250j

Modified Files:
	DataStreamProducer.java 
Log Message:
Fix for tn5250j when applying very last SF99502 cum package from IBM.
Fix provided by Wim van Leuven, thnx dude for your support.

Index: DataStreamProducer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/DataStreamProducer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** DataStreamProducer.java	14 Apr 2004 12:15:52 -0000	1.9
--- DataStreamProducer.java	14 Jun 2004 09:44:53 -0000	1.10
***************
*** 57,85 ****
        }
        while (!done) {
!          try {
! 
!             byte[] abyte0 = readIncoming();
! 
!             // WVL - LDC : 16/07/2003 : TR.000345
!             // When the socket has been closed, the reading returns
!             // no bytes (an empty byte arrray).
!             // But the loadStream fails on this, so we check it here!
!             if (abyte0.length > 0)
!             {
!               loadStream(abyte0, 0);
!             }
!             // WVL - LDC : 16/07/2003 : TR.000345
!             // Returning no bytes means the input buffer has
!             // reached end-of-stream, so we do a disconnect!
!             else
!             {
!               done = true;
!               vt.disconnect();
!             }
  
           }
!          catch (SocketException se) {
! //            System.out.println("   DataStreamProducer thread interrupted and stopping " + se.getMessage());
!             log.warn("   DataStreamProducer thread interrupted and stopping ");
              done = true;
           }
--- 57,91 ----
        }
        while (!done) {
! 		  try {
! 			  
! 			  byte[] abyte0 = readIncoming();
! 			  
! 			  // WVL - LDC : 17/05/2004 : Device name negotiations send TIMING MARK
! 			  // Restructured to the readIncoming() method to return null
! 			  // on TIMING MARK. Don't process in that case (abyte0 == null)!
! 			  if (abyte0 != null)
! 			  {
! 				  // WVL - LDC : 16/07/2003 : TR.000345
! 				  // When the socket has been closed, the reading returns
! 				  // no bytes (an empty byte arrray).
! 				  // But the loadStream fails on this, so we check it here!
! 				  if (abyte0.length > 0)
! 				  {
! 					  loadStream(abyte0, 0);
! 				  }
! 				  // WVL - LDC : 16/07/2003 : TR.000345
! 				  // Returning no bytes means the input buffer has
! 				  // reached end-of-stream, so we do a disconnect!
! 				  else
! 				  {
! 					  done = true;
! 					  vt.disconnect();
! 				  }
! 			  }
  
           }
! 		 
! 		 catch (SocketException se) {
!             log.warn("   DataStreamProducer thread interrupted and stopping " + se.getMessage());
              done = true;
           }
***************
*** 217,232 ****
       //    timing marks ??????????????  do we ???????????? look at telnet spec
       // yes we do. rfc860 explains about timing marks.
           if (negotiate) {
              // get the negotiation option
              baosin.write(bin.read());
!             vt.negotiate(baosin.toByteArray());
!          }
  
!          if (dumpBytes) {
!             dump(baosin.toByteArray());
           }
! 
!         return baosin.toByteArray();
!     }
  
     protected final void toggleDebug (CodePage cp) {
--- 223,252 ----
       //    timing marks ??????????????  do we ???????????? look at telnet spec
       // yes we do. rfc860 explains about timing marks.
+ 	 
+      	 // WVL - LDC : 17/05/2004 : Device name negotiations send TIMING MARK
+      	 //                          to existing device!
+      	 // Handled incorrectly: we cannot continue processing the TIMING MARK DO
+      	 // after we have handled it in the vt.negotiate()
+      	 // We should not return the bytes;
+      	 // ==> restructured to return null after negotiation!
+      	 //     Impacts the run method! Added the null check.
+      	 byte[] rBytes = baosin.toByteArray();
+ 
+ 		 if (dumpBytes) {
+ 			dump(rBytes);
+ 		 }
+ 
           if (negotiate) {
              // get the negotiation option
              baosin.write(bin.read());
!             vt.negotiate(rBytes);
  
!             return null;
           }
!          else
!          {
! 			 return rBytes;
! 		 }
! 	}
  
     protected final void toggleDebug (CodePage cp) {



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504