This content has been marked as final. Show 11 replies
I am getting the same error after I updated Java from 1.6.0_21 to 1.6.0_22 yesterday, that HTMLEditorKit throws NullPointerException when reloaded.
Excerpt from console:
The error only occurs in Safari (5.0.2) - while in f.ex Firefox (3.6.11) reloading works fine.
By the way : I am on Max OSX 10.6.5
Any suggestions to resolve this error would be greately appreciated.
Edited by: 804367 on Oct 22, 2010 3:16 AM
Firefox 3.5.5, SunOS 5.10, java plugin 1.6.0_22
I, too, get the exception on the second load of an applet:
Exception in thread "Thread-22" java.lang.NullPointerException
When I switch back to using java plugin 1.6.0_20 the error goes away.
I get the same problem with JEditorPane, namely null pointer in the second applet loaded ... it happens during its setText() method.
I'm running Mac OS X 10.6.4, with Safari Version 5.0.2 (6533.18.5).
You can see this on the web:
1) goto my site at [http://academicjava.com/JavaTutorial/SourceCodeExample.html] ... don't do anything, just wait for applet to load ok
2) now look to links on the left, click on the second one 'a class' [http://academicjava/JavaTutorial/ClassExample.html] ... it will fail during the load.
If you restart the browser and go to 2) first you'll see it loads correctly.
I'm looking urgently for a workround. Any help will be much appreciated.
Edited by: 804481 on Oct 23, 2010 12:57 AM
I'm having the same problem and I'm not clear on your workaround. Does it involve the ParserDelegator 'workaround', as you don't use it in your sample code, or just setting the type and html at the same time?
Edit: Ah, I get it. All you have to do is instantiate a ParserDelegator. This works for me so far. Thanks! This was a show stopper for our app.
Edited by: 805033 on Oct 25, 2010 9:24 AM
Hiroyuki: Yes the workaround is good for me too.
By the way I've had a similar problem to JEditorKit with JButton when I used images and HTML text. The text didn't appear on a reload.
Amazingly, constructing a ParserDelegator immediately before setting the HTML text on the JButton got round the problem.
Thank you for this thread and the workaround, Hiroyuki !! It enabled me to fix two problems in my [url http://r0k.us/graphics/SIHwheel.html]Interactive Color Wheel. I have just recently started using HTML in the app, and I could not figure out why HTML would not display on the second view of an applet while the same JVM were still alive. I had been seeking help on another thread in the Swing forum:
* Re: java.lang.reflect.InvocationTargetException
I also thank all posters for their encouraging feedback. :)