Name: rlT66838 Date: 08/06/97
This is probably broken on every platform....
/*
java.applet.Applet.getCodeBase() returns NullPointerException
if the Applet is used as an application.
Compiling and running this program results in:
% javac AppletExample.java
% java AppletExample
java.lang.NullPointerException
at java.applet.Applet.getCodeBase(Applet.java:110)
at AppletExample.start(AppletExample.java:41)
at AppletExample.main(AppletExample.java:48)
----------
Applet.java contains the following code at line 110:
public URL getCodeBase() {
return stub.getCodeBase();
}
It needs to make sure "stub" isn't null. getCodeBase() should
return null if "stub" is null.
i.e.
public URL getCodeBase() {
return (stub == null ? null : stub.getCodeBase());
}
Workaround? none
*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class AppletExample extends Applet {
public void start() {
if(getCodeBase() != null)
showStatus(getCodeBase().toString());
}
public static void main(String[] args) {
AppletExample ae = new AppletExample();
ae.init();
ae.start();
}
}
company - Sun Microsystems , email - ###@###.###
======================================================================