JDK-6537491 : NPE in the trace while refreshing an Applet writing into a TextArea.
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u1
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-03-22
  • Updated: 2010-04-04
  • Resolved: 2008-04-15
Related Reports
Relates :  
Relates :  
Null Pointer Exception while reloading an Applet multiple times on WinXP SP2. 
Buid used : 6u1b05  and 5u12

Exception in thread "Thread-162" java.lang.NullPointerException: null pData
	at sun.awt.windows.WTextAreaPeer.insertText(Native Method)
	at java.awt.TextArea.insertText(Unknown Source)
	at java.awt.TextArea.appendText(Unknown Source)
	at java.awt.TextArea.append(Unknown Source)

How to reproduce:

Launch page - http://sqindia.india.sun.com/~rn195728/BugVerification/6480378/Top.html
Click on Launch Button.
Observe the console.

Applet Code:
import java.applet.Applet;
import java.awt.TextArea;

public class CrashTextAreaApplet extends Applet

	TextArea ta;

    public CrashTextAreaApplet()
        ta = new TextArea(20, 70);

    public void init()

    public void start()
        Thread textWriter = new Thread() {

            public void run()
                    ta.append("Attempting crash Attempting crash Attempting crash Attempting crash Attempting crash \n");

    public void destroy()


EVALUATION Close as not reproducible in the latest 6u10 plguin (either new and classic)

EVALUATION The applet is responsible to close any threads it created(in this testcase, it is the textWriter thread). When the plugin is disposing an applet as in page switching or window closing, some awt data structures may have been disposed while a user thread is trying to access them. A very busy thread (the while true loop in the testcase) may cause worse race conditions thus cause thread leak (see CR 6545649) and NPE. We are going to address these issue in plugin life cycle umbrella.