java.net.URL bugs

Jules Bean jmlb2 at hermes.cam.ac.uk
Wed Mar 24 03:23:28 PST 1999


On Wed, 24 Mar 1999, Santoro Corrado wrote:

> Hi all,
> I've tried to run under kaffe a program which works on Sun's JDK and on
> the Linux porting for i386 (jdk1.1.7) and I've found several problems when
> the program uses the java.net.URL class:
> 1. the .equals() method reports a java.lang.NullPointerException (only if
> I use Kaffe);
> 2. if I use the  'new URL("http://myhost:5000")' a StringIndexOutOfBounds
> exception is reported. This not happens if I use
>       'new URL("http://myhost:5000/")'.

I'm a bit rushed to submit a patch just now, but I can see why these
happen:

1. This is because it compares protocol, host, file, ref, etc. without
considering that they might be null.

2. The init code doesn't account for this case.  It assumes no second
slash - probably correctly, by the URL spec, but the behavious should
probably assume that the whole rest of the string is the port, if no slash
is found.

Jules

/----------------+-------------------------------+---------------------\
|  Jelibean aka  | jules at jellybean.co.uk         |  6 Evelyn Rd	       |
|  Jules aka     | jules at debian.org              |  Richmond, Surrey   |
|  Julian Bean   | jmlb2 at hermes.cam.ac.uk        |  TW9 2TF *UK*       |
+----------------+-------------------------------+---------------------+
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
\----------------------------------------------------------------------/




More information about the kaffe mailing list