This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
SteveNB wrote: Hello Folks, Well it my first posting and I usually don't post problems unless I've reached my wits end. So here's what I am trying to accomplish. Hopefully, I can example it properly. 1. I have a DataNode Object which has the following assignments. getCookieSet().assign(PaletteSupportProvider.class, new PaletteSupport().createPalette()); getCookieSet().assign(EditorCookie.class); getCookieSet().assign(OpenCookie.class); getCookieSet().assign(EditCookie.class); getCookieSet().assign(ViewCookie.class); getCookieSet().assign(LineCookie.class); getCookieSet().assign(CloseCookie.class); getCookieSet().assign(PrintCookie.class); getCookieSet().assign(SaveCookie.class); CookieSet cookies = getCookieSet(); cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies)); 2. I have an action which the following: FileObject fileobject = FileUtil.toFileObject(FileUtil.normalizeFile(openfile)); DataObject dob = DataObject.find(fileobject); EditorCookie ec = (EditorCookie) dob.getCookie(EditorCookie.class); if ( ec != null ) { ec.open(); } This work great. However, when I try to print the content of the EditorCookie Pane (using the native PrintAction instance), I get the following: java.lang.IllegalArgumentException at org.openide.text.DefaultPrintable.<init>(DefaultPrintable.java:135) at org.openide.text.DefaultPrintable.<init>(DefaultPrintable.java:169) at org.openide.text.NbDocument.findPageable(NbDocument.java:443) at org.openide.text.CloneableEditorSupport.print(CloneableEditorSupport.java:1011) at org.openide.actions.PrintAction.performAction(PrintAction.java:70) at org.openide.util.actions.NodeAction.performAction(NodeAction.java:289) at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:118) at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.actionPerformed(ActionsBridge.java:111) at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:104) at org.netbeans.modules.openide.actions.ActionsBridgeImpl.invokeAction(ActionsBridgeImpl.java:52) at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.doRun(ActionsBridge.java:102) at org.netbeans.modules.openide.util.ActionsBridge$1.run(ActionsBridge.java:71) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986) I have looked all over creation, but nothing. If anyone has an idea what I am doing wrong, I would be most appreciative. Using JDK 1.5.0_12-b02. Regards, Steve Nelson --- Interesting Note --- I am using JDK 1.5.0_14-b03 at home and I get: java.lang.NullPointerException: null pData at sun.awt.windows.WComponentPeer.nativeHandleEvent(Native Method) at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:262) at java.awt.Component.dispatchEventImpl(Component.java:4060) at java.awt.Container.dispatchEventImpl(Container.java:2024) at java.awt.Window.dispatchEventImpl(Window.java:1791) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) [catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153) at java.awt.Dialog$1.run(Dialog.java:535) at java.awt.Dialog$2.run(Dialog.java:565) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Dialog.show(Dialog.java:563) at sun.awt.windows.WPrinterJob.displayNativeDialog(WPrinterJob.java:473) at sun.awt.windows.WPrinterJob.printDialog(WPrinterJob.java:553) at org.openide.text.CloneableEditorSupport.print(CloneableEditorSupport.java:1020) at com.cca.model204module.PrintFileAction.performAction(PrintFileAction.java:34) at org.openide.util.actions.NodeAction.performAction(NodeAction.java:289) at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:118) at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:77) at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:114) at org.openide.util.actions.NodeAction.actionPerformed(NodeAction.java:277) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258) at javax.swing.AbstractButton.doClick(AbstractButton.java:302) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092) at java.awt.Component.processMouseEvent(Component.java:5517) at javax.swing.JComponent.processMouseEvent(JComponent.java:3135) at java.awt.Component.processEvent(Component.java:5282) at java.awt.Container.processEvent(Container.java:1966) at java.awt.Component.dispatchEventImpl(Component.java:3984) at java.awt.Container.dispatchEventImpl(Container.java:2024) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822) at java.awt.Container.dispatchEventImpl(Container.java:2010) at java.awt.Window.dispatchEventImpl(Window.java:1791) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) -- Interesting Note -- I've install JDK 1.6.0_06-b02 the method works fine!
Please could you attach test module (or send it to me) to reproduce issue?
I filed #6704417 against JDK/AWT for NPE on Windows when opening PageSetup dialog. It happens on JDK 5.0u15 (latest released update). In any case it is JDK issue both on Linux/Windows. Closing as WONTFIX. I will update status of issue on Windows.
*** Issue 135592 has been marked as a duplicate of this issue. ***
I found 32 duplicates: http://statistics.netbeans.org/exceptions/detail.do?id=13423 This excetpion is too confusing for our users. We had to patch platform: o.n.core/src/org/netbeans/core/NotifyExcPanel.java static void notify ( final NbErrorManager.Exc t ) ... // error in jdk during printing if ("java.lang.NullPointerException".equals(t.getClassName())) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); if (sw.toString().contains("sun.awt.windows.WComponentPeer.nativeHandleEvent")) { t.printStackTrace(System.err); return; } } ... The patch is safe. Printing works correctly.
Jarda is this patch ok?
As it can happen any time even when there is no our code in call stack there is no better way. I added check for JDK version and exception dialog is not shown on JDK 5 only. As said above it does not happen on JDK 6. core-main #bb9e27ad5280 Because of special exception handling in java.awt.EventDispatchThread.pumpOneEventForHierarchy code is not interrupted. It has no visible effect on functionality. It happens when native printing or page setup dialog is displayed. There is no progress in JDK to fix this.
There is generated event and NPE is thrown during its processing. Our code is on call stack because modal dialog is displayed.
Fix summary
Integrated into 'main-golden', will be available in build *200901070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/bb9e27ad5280 User: Marek Slama <mslama@netbeans.org> Log: #133092: Do not show exception dialog when NPE from WComponentPeer.nativeHandleEvent is thrown on JDK 5.
snelson, could verify if the patch (or trunk) works for you?
I checked the code - in any way it seems safe -> verified
from snelson's email: Hello, Works as advertised.. Thank you,
The fix has been ported into the release65_fixes repository. http://hg.netbeans.org/release65_fixes/rev/1483a5591936