This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: java.util.Date -> NullPointerException
- To: "Gregory R. Warnes" <warnes at biostat dot washington dot edu>
- Subject: Re: java.util.Date -> NullPointerException
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Fri, 19 May 2000 11:25:21 +1200
- CC: "\\"gcj\\" Discussion List" <java-discuss at sourceware dot cygnus dot com>
- References: <Pine.LNX.4.21.0005181928410.20575-100000@hydra.warnes.net>
OK, the existing code is definitely wrong here. I'm going to check in your
change.
What is not clear is why the URLClassLoader is being used at all here. The
system classloader should find the compiled "gnu.gcj.text.LocaleData_en_US" in
libgcj.so, but it seems that if you explicitly put "libgcj.zip" on your
classpath (which you shouldn't), Class.forName() prefers the .class version,
and loads it that way. This is strange, because I thought it was designed to
prefer native classes if available. Perhaps the fact that this class is in a
.zip confuses this?
Anyway, I strongly recommend not putting libgcj.zip in your CLASSPATH.
regards
[ bryce ]
"Gregory R. Warnes" wrote:
> --- libgcj/libjava/gnu/gcj/protocol/jar/Connection.java.orig Thu May 18
> 12:24:07 2000
> +++ libgcj/libjava/gnu/gcj/protocol/jar/Connection.java Thu May 18
> 12:23:25 2000
> @@ -59,7 +59,7 @@
> if (getUseCaches())
> {
> jarfile = (JarFile) file_cache.get(jarFileURL);
> - if (jarFileURL == null)
> + if (jarfile == null)
> {
> jarfile = new JarFile (jarFileURL.getFile ());
> file_cache.put (jarFileURL, jarfile);
>
> Making this change lets HelloDate work:
>
> hydra:/tmp> gcj -o HelloDate HelloDate.java --main=HelloDate
> hydra:/tmp> ./HelloDate
> Hello World, Today is Thu May 18 19:49:22 GMT 2000