-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.5
Name: dsC58869 Date: 02/16/98
Appletviewer's classloader trying to load class with wrong name
throws ClassFormatError instead ClassNotFoundException.
==== Here is the test demonstrating the bug ====
___TestApplet1.java___
import java.applet.*;
public class TestApplet1 extends Applet {
public void init(){
ClassLoader cl = this.getClass().getClassLoader();
if (cl != null) {
try {
Class cls = cl.loadClass("asdf.qwer.Str");
System.out.println("OKAY");
} catch (Exception ex) {
System.out.println(ex);
}
} else {
System.out.println("ClassLoader == null");
}
}
}
___TestApplet1.html___
<applet
code="TestApplet1.class"
codebase="http://mars:8080/~sda"
width=600 height=400
>
[[You need a Java-aware browser to see the JavaTest Slave applet.]]
</applet>
______________________
==== Here is the output of the test ====
(sda@mars@/home/sda/homepage)59%java -fullversion
java full version "JDK-1.2beta3-G"
(sda@mars@/home/sda/homepage)60%echo $CLASSPATH
(sda@mars@/home/sda/homepage)61%appletviewer http://mars:8080/~sda/TestApplet1.html
Warning:
Cannot allocate colormap entry for default background
java.lang.ClassFormatError: asdf/qwer/Str (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:360)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:101)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:206)
at java.net.URLClassLoader.findLocalClass(URLClassLoader.java:146)
at sun.applet.AppletClassLoader.findLocalClass(AppletClassLoader.java:101)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at java.lang.ClassLoader.loadClass(ClassLoader.java:185)
at TestApplet1.init(TestApplet1.java:8)
at sun.applet.AppletPanel.run(AppletPanel.java:284)
at java.lang.Thread.run(Thread.java:490)
======================================================================
======================================================================