null pData exception in destroy

Hi,

I get the exception below in the applet destroy method in JRE1.4, 1.5, 1.6 on IE 6 & IE 7. This doesn't seem to have anything to do with my java code. Is there any workaround for this?

Thanks in Advance,

Sriram.

Exception occurred during event dispatching:

java.lang.NullPointerException: null pData

at sun.awt.windows.WComponentPeer.hide(Native Method)

at java.awt.Component.hide(Unknown Source)

at java.awt.Window.hide(Unknown Source)

at sun.awt.EmbeddedFrame.hide(Unknown Source)

at java.awt.Component.show(Unknown Source)

at java.awt.Component.setVisible(Unknown Source)

at java.awt.Window.setVisible(Unknown Source)

at sun.plugin.viewer.frame.IExplorerEmbeddedFrame$2.run(Unknown Source)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.Dialog$1.run(Unknown Source)

at java.awt.Dialog$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.awt.Dialog.show(Unknown Source)

at java.awt.Component.show(Unknown Source)

at java.awt.Component.setVisible(Unknown Source)

at java.awt.Window.setVisible(Unknown Source)

at java.awt.Dialog.setVisible(Unknown Source)

at sun.plugin.util.PluginSysUtil.execute(Unknown Source)

at sun.plugin.util.PluginSysUtil.delegate(Unknown Source)

at com.sun.deploy.util.DeploySysRun.execute(Unknown Source)

at com.sun.deploy.util.DeploySysRun$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.deploy.util.DeploySysRun.executePrivileged(Unknown Source)

at com.sun.deploy.ui.UIFactory.showErrorDialog(Unknown Source)

at com.sun.deploy.ui.UIFactory.showExceptionDialog(Unknown Source)

at com.sun.deploy.ui.UIFactory.showExceptionDialog(Unknown Source)

at sun.plugin.util.Trace.printException(Unknown Source)

at sun.plugin.util.Trace.printException(Unknown Source)

at sun.plugin.util.Trace.printException(Unknown Source)

at sun.plugin.util.Trace.printException(Unknown Source)

at sun.plugin.viewer.frame.IExplorerEmbeddedFrame.windowClosed(Unknown Source)

at java.awt.Window.processWindowEvent(Unknown Source)

at java.awt.Window.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

[3378 byte] By [Sriram_7077a] at [2007-11-26 15:29:29]
# 1
Post a Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the problem. http://homepage1.nifty.com/algafield/sscce.html
Rodney_McKaya at 2007-7-8 21:45:48 > top of Java-index,Desktop,Core GUI APIs...
# 2

I'm trying to simulate this problem like what's described in that web page, but I'm not getting it. Even in our environment, this is a rare case, but a killer. In destroy method, if we call removeAll() we get the problem. If it is commented out, we never get the problem. BTW our applet contains a toolbar and a status bar.

Sriram_7077a at 2007-7-8 21:45:48 > top of Java-index,Desktop,Core GUI APIs...
# 3
Why do you need to call removeAll() in the destroy() method?
itchyscratchya at 2007-7-8 21:45:48 > top of Java-index,Desktop,Core GUI APIs...
# 4

We used removeAll() to remove the components attached to the applet. It may not be required as we are only closing the applet. We removed the removeAll and tried. The error still comes came. We have done a workaround. We have our own close button to close the browser window. On the close button instead of just closing, we are taking the control to a new page and then closing. The idea is, control won't go to the new page without ending the applet completely hence the applet gets a chance to end completely.

Sriram_7077a at 2007-7-8 21:45:48 > top of Java-index,Desktop,Core GUI APIs...
# 5
Unless you take steps to serialize the shutdown, this can happen.An easy way is to trap all null pointer exceptions with a try/catch in your destroy, and simply ignore them.(T)
tswaina at 2007-7-8 21:45:48 > top of Java-index,Desktop,Core GUI APIs...