-
Bug
-
Resolution: Fixed
-
P4
-
6u13
-
b124
-
x86
-
solaris
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8168174 | 8u152 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8163674 | 8u121 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8157256 | 8u112 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8159663 | 8u111 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8159660 | 8u102 | Mikhail Cherkasov | P4 | Resolved | Fixed | b31 |
JDK-8158393 | 8u92 | Mikhail Cherkasov | P4 | Resolved | Fixed | b32 |
JDK-8167800 | emb-8u121 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8162251 | emb-8u111 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8157595 | 7u121 | Mikhail Cherkasov | P4 | Resolved | Fixed | b01 |
JDK-8172603 | openjdk7u | Mikhail Cherkasov | P4 | Resolved | Fixed | master |
public final class EditorTest {
public static void main(String[] arguments) {
Thread.currentThread().setContextClassLoader(null);
new javax.swing.JEditorPane("text/plain", "");
}
}
fails with
Exception in thread "main" java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at javax.swing.JEditorPane.registerEditorKitForContentType(JEditorPane.java:1329)
at javax.swing.JEditorPane.registerEditorKitForContentType(JEditorPane.java:1311)
at javax.swing.JEditorPane.loadDefaultKitsIfNecessary(JEditorPane.java:1389)
at javax.swing.JEditorPane.getKitTypeRegistry(JEditorPane.java:1346)
at javax.swing.JEditorPane.createEditorKitForContentType(JEditorPane.java:1271)
at javax.swing.JEditorPane.getEditorKitForContentType(JEditorPane.java:1128)
at javax.swing.JEditorPane.setContentType(JEditorPane.java:1019)
at javax.swing.JEditorPane.<init>(JEditorPane.java:274)
at EditorTest.main(EditorTest.java:4)
The problem appears to be that the null context class loader shall be put as a value into a Hashtable, which fails with a NullPointerException. The documentation of JEditorPane does not directly state any requirements on the context class loader, and esp. for using the default "text/plain" it is not obvious why there should be any.
That a thread's context class loader is null does indeed happen "in real life," namely when a thread that was spawned outside the JVM is attached to the JVM via JNI; according to <http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/invocation.html#attach_current_thread> "[w]hen a thread is attached to the VM, the context class loader is the bootstrap loader," and in turn "[s]ome implementations may use null to represent the bootstrap class loader," according to <http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getParent()>).
OpenOffice.org is having a problem with this, see <http://qa.openoffice.org/issues/show_bug.cgi?id=102164#desc8>.
- backported by
-
JDK-8157256 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8157595 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8158393 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8159660 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8159663 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8162251 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8163674 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8167800 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8168174 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
-
JDK-8172603 new JEditorPane("text/plain","") fails for null context class loader
- Resolved
- relates to
-
JDK-8159250 [PIT] NPE in JEditorPane("unknown/unknown", "The Text")
- Closed
-
JDK-8158734 JEditorPane.createEditorKitForContentType throws NPE after 6882559
- Resolved