[4355] in java-interest
bug in getCodeBase() pinned down
daemon@ATHENA.MIT.EDU (Luke Gonze)
Tue Dec 19 12:39:51 1995
Date: Fri, 15 Dec 1995 13:37:08 -0500 (EST)
From: Luke Gonze <luke@applix.com>
To: java-interest@java.sun.com
FYI for anyone having problems with getCodeBase -
The appletviewer throws this error when loading my class "viewer":
status: exception: null
java.lang.NullPointerException
at java.applet.Applet.getCodeBase(Applet.java:67)
at viewer.<init>(viewer.java:11)
at sun.applet.AppletPanel.run(AppletPanel.java:232)
at java.lang.Thread.run(Thread.java)
status: init: applet not loaded
...
I tracked it down to this - my function didn't declare an explicit return
type. That is, if the function is declared as
public foo(){
URL MyCodeBase;
MyCodeBase = getCodeBase();
}
the error occurs, but if the function is declared as
public void foo(){
URL MyCodeBase;
MyCodeBase = getCodeBase();
}
everything's fine.
Does anybody know why causes this? What's the default return type of a
method if not declared explicitly?
--- Luke Gonze --- luke@applix.com ---
--- Software Engineer, Applix Espresso project ---
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com