small bug in Kaffe's java class library.

stephen clawson kaffe@rufus.w3.org
Wed, 22 Jul 1998 16:59:57 -0600 (MDT)


    There's a simple coding bug in java.net.InetAddress.equal() that
causes it to always return false, even if the strings are lexically
equal (it's testing for Object equality currently).

     There's also an array indexing problem in
java.awt.TextArea.breakLines().  If the first character happens to be
a newline, the code tries to see if the previous character (the -1's
one) is a carriage return, which unfortunately tries to access off the
beginning of the array.  I haven't looked at it enough to see what the
correct fix would be, but the quick hack is to just not do the check
for '/r' if i == 0.


steve


diff -cr kaffe-snap.orig/libraries/javalib/java/net/InetAddress.java kaffe-snap/libraries/javalib/java/net/InetAddress.java
*** kaffe-snap.orig/libraries/javalib/java/net/InetAddress.java	Tue Jul 14 10:47:36 1998
--- kaffe-snap/libraries/javalib/java/net/InetAddress.java	Wed Jul 22 16:37:00 1998
***************
*** 61,67 ****
  				if (thisAddr[pos]!=thatAddr[pos]) return false;
  			}
  
! 			return (getHostName()==((InetAddress)obj).getHostName());
  		}
  	}
  
--- 61,67 ----
  				if (thisAddr[pos]!=thatAddr[pos]) return false;
  			}
  
! 			return (getHostName().equals(((InetAddress)obj).getHostName()));
  		}
  	}
diff -cr kaffe-snap.orig/libraries/javalib/java/awt/widgets/TextArea.java kaffe-snap/libraries/javalib/java/awt/widgets/TextArea.java
*** kaffe-snap.orig/libraries/javalib/java/awt/widgets/TextArea.java	Tue Jul 14 11:01:59 1998
--- kaffe-snap/libraries/javalib/java/awt/widgets/TextArea.java	Tue Jul 21 17:30:09 1998
***************
*** 866,872 ****
  
  	for ( i=0; i<buf.length; i++) {
  		if ( buf[i] == '\n' ){
! 			if ( buf[i-1] == '\r' )
  				sbuf[lc++] = str.substring( bIdx, i-1);
  			else
  				sbuf[lc++] = str.substring( bIdx, i);
--- 866,872 ----
  
  	for ( i=0; i<buf.length; i++) {
  		if ( buf[i] == '\n' ){
! 			if ( i > 0 && buf[i-1] == '\r' )
  				sbuf[lc++] = str.substring( bIdx, i-1);
  			else
  				sbuf[lc++] = str.substring( bIdx, i);



-- 
// stephen clawson				sclawson@cs.utah.edu
// university of utah