tn5250j/src/org/tn5250j tnvt.java,1.43,1.44

Patrick Bielen <[email protected]> Mon, 05 Jul 2004 08:54:40 +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-serv838/src/org/tn5250j

Modified Files:
	tnvt.java 
Log Message:
Fix exception for incomplete DO command
Committed by Kenneth

Index: tnvt.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tnvt.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** tnvt.java	2 Jul 2004 13:52:07 -0000	1.43
--- tnvt.java	5 Jul 2004 08:54:38 -0000	1.44
***************
*** 1,3 ****
! package org.tn5250j;
  
  /**
--- 1,3 ----
! 
  
  /**
***************
*** 23,26 ****
--- 23,28 ----
   *  
   */
+ package org.tn5250j; 
+  
  import java.awt.BorderLayout;
  import java.awt.Dimension;
***************
*** 2936,2946 ****
  		int i = 0;
  
  		// from server negotiations
! 		if (abyte0[i] == IAC) { // -1
  
! 			while (i < abyte0.length && abyte0[i++] == -1)
! 				//         while(i < abyte0.length && (abyte0[i] == -1 || abyte0[i++] ==
! 				// 0x20))
! 				switch (abyte0[i++]) {
  
  				// we will not worry about what it WONT do
--- 2938,2948 ----
  		int i = 0;
  
+ 
  		// from server negotiations
!       if(abyte0[i] == IAC) { // -1
  
!          while(i < abyte0.length && abyte0[i++] == -1)
! //         while(i < abyte0.length && (abyte0[i] == -1 || abyte0[i++] == 0x20))
!             switch(abyte0[i++]) {
  
  				// we will not worry about what it WONT do
***************
*** 2951,2955 ****
  				case DO: //-3
  
! 					switch (abyte0[i]) {
  					case TERMINAL_TYPE: // 24
  						baosp.write(IAC);
--- 2953,2962 ----
  				case DO: //-3
  
!                   // not sure why but since moving to V5R2 we are receiving a
!                   //   DO with no option when connecting a second session with
!                   //   device name.  Can not find the cause at all.  If anybody
!                   //   is interested please debug this until then this works.
!                   if (i < abyte0.length) {
!                      switch(abyte0[i]) {
  					case TERMINAL_TYPE: // 24
  						baosp.write(IAC);
***************
*** 2981,2986 ****
  
  					case TIMING_MARK: // 6 rfc860
! 					//                        System.out.println("Timing Mark Received and notifying "
! 					// +
  					//                        "the server that we will not do it");
  						baosp.write(IAC);
--- 2988,2992 ----
  
  					case TIMING_MARK: // 6 rfc860
!    //                        System.out.println("Timing Mark Received and notifying " +
  					//                        "the server that we will not do it");
  						baosp.write(IAC);
***************
*** 3000,3004 ****
  							baosp.reset();
  
! 						} else {
  							baosp.write(IAC);
  							baosp.write(WILL);
--- 3006,3011 ----
  							baosp.reset();
  
!                            }
!                            else {
  							baosp.write(IAC);
  							baosp.write(WILL);
***************
*** 3019,3022 ****
--- 3026,3030 ----
  						break;
  					}
+                  }
  
  					i++;
***************
*** 3025,3029 ****
  				case WILL:
  
! 					switch (abyte0[i]) {
  					case OPT_END_OF_RECORD: // 25
  						baosp.write(IAC);
--- 3033,3037 ----
  				case WILL:
  
!                  switch(abyte0[i]) {
  					case OPT_END_OF_RECORD: // 25
  						baosp.write(IAC);
***************
*** 3049,3065 ****
  				case SB: // -6
  
! 					if (abyte0[i] == NEW_ENVIRONMENT && abyte0[i + 1] == 1) {
  						negNewEnvironment();
  
! 						while (++i < abyte0.length && abyte0[i + 1] != IAC)
! 							;
  					}
  
! 					if (abyte0[i] == TERMINAL_TYPE && abyte0[i + 1] == 1) {
  						baosp.write(IAC);
  						baosp.write(SB);
  						baosp.write(TERMINAL_TYPE);
  						baosp.write(QUAL_IS);
! 						if (!support132)
  							baosp.write("IBM-3179-2".getBytes());
  						else
--- 3057,3072 ----
  				case SB: // -6
  
!                   if(abyte0[i] == NEW_ENVIRONMENT && abyte0[i + 1] == 1) {
  						negNewEnvironment();
  
!                      while (++i < abyte0.length && abyte0[i + 1] != IAC);
  					}
  
!                   if(abyte0[i] == TERMINAL_TYPE && abyte0[i + 1] == 1) {
  						baosp.write(IAC);
  						baosp.write(SB);
  						baosp.write(TERMINAL_TYPE);
  						baosp.write(QUAL_IS);
!                      if(!support132)
  							baosp.write("IBM-3179-2".getBytes());
  						else
***************
*** 3076,3080 ****
  				}
  			return true;
! 		} else {
  			return false;
  		}
--- 3083,3088 ----
  				}
  			return true;
!       }
!       else {
  			return false;
  		}



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com