Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Uncaught NullPointer Exception in JEditorPane.setText()

809389Oct 29 2010 — edited Apr 1 2011
My app fails in a recent upgrade of Java. I have uploaded to the most recent version 1.6.0_22.

Here is my source code:
JEditorPane textArea = new JEditorPane() ;
textArea.setContentType( "text/html" ) ;
textArea.setMargin( new Insets( 4, 4, 4, 4 ) ) ;
textArea.setText( "Hello World" ) ;

Here's the console output:
java.lang.NullPointerException
at javax.swing.text.html.parser.Parser.errorContext(Unknown Source)
at javax.swing.text.html.parser.Parser.parse(Unknown Source)
at javax.swing.text.html.parser.DocumentParser.parse(Unknown Source)
at javax.swing.text.html.parser.ParserDelegator.parse(Unknown Source)
at javax.swing.text.html.HTMLEditorKit.read(Unknown Source)
at javax.swing.JEditorPane.setText(Unknown Source)
at CTextArea.newTextArea(Contessa.java:1583)

If this is a bug, please let me know how to file a bug report, which I've never done before.

-Jim
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2011
Added on Oct 29 2010
13 comments
903 views