getClassLoader()

Archie Cobbs archie at whistle.com
Tue Jul 28 08:24:26 PDT 1998


Alexandre Oliva writes:
> > The method Class.getClassLoader() is returning null, which is
> > causing stuff to bomb out with NullPointerException.
> 
> getClassLoader() is supposed to return null for classes loaded by the
> default class-loader.  If things are bombing because it is returning
> null, the problem must be elsewhere

Yes, you're right.. here's the problem I'm having:

  java.lang.NullPointerException
	  at java/lang/Class.getResourceAsStream(158)
	  at ca/mcgill/sable/sablecc/GenTokens.<init>(91)
	  at ca/mcgill/sable/sablecc/SableCC.main(163)
	  at SableCC.main(73)

Because in java/lang/Class.java:

  public InputStream getResourceAsStream(String name) {
	  return (getClassLoader().getResourceAsStream(fullResourceName(name)));
  }

So I guess getResourceAsStream() needs to be fixed.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list