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.
I am using Netbeans 3.6 beta on jdk1.5.0 beta As soon, as I clicked the print button on the help system on the node marked as "Editor shorcuts", it hung with a OutOfMemoryError - despite the fact that I had a lot of RAM available. I am attaching the IDE log and a screenshot of the error
Created attachment 13959 [details] ide log
I suppose that printing is in core.
Created attachment 13960 [details] screenshot
oops, more explicitly it occurs, when I hit the Page Setup button in the JavaHelp system. The problem seems to always occur.
And the best part is that the Page Setup and Print dialog still turns up.. and I am able to print.
Printing from JavaHelp is implemented by JavaHelp - NetBeans code isn't really involved. I know there were some problems in the past (supposed to be fixed) with endless loops while printing if the page break was in just the right place. This looks more like a bug in AWT though. The message is a little weird: java.lang.OutOfMemoryError: null pData which suggests it's not actually an OutOfMemoryError - usually these are generated by the JVM, and there's no message text - this one was intentionally thrown. Now, it could mean the operating system was out of some other kind of resource like graphics handles; or it could just mean someone made a really poor choice as to what kind of exception to throw - tough to say, it happens inside the JDK's peer implementation. Milan, could someone in QA try to reproduce this on a win2k machine?
Milan, please look at this ... thanks in advance.
I might, but currently I'm out of time.
If it helps you guys, I'll install jdk1.5 and Netbeans 3.6 beta on another Win 2K machine and check whether the problem can be reproduced there as well. Will do that at work tommorow or the day after.
Yes, it would really help us a lot, thanks.
Milan, don't by lazzy:-)) I can reproduce it on my win2k machine. It was tested on jdk 1.5.0-beta-2-b42.
*** Issue 41215 has been marked as a duplicate of this issue. ***
This is reproducible on Win2K or WinXP, in NetBeans 3.5.1 or 3.6. The OOME is thrown in native code in the dialog peer implementation. Something changed in that implementation for JDK 1.5 which causes it to now throw an exception. As far as I can tell, what is probably null is the operating system window handle for the owner of the dialog. I am prepared to file a JDK bug on this, but they would be well within their rights not to fix it, because what NetBeans is doing is pretty crazy. What is going on: Because AWT dialogs are application-modal, whenever a new modal dialog is shown, if the help is showing, a new non-modal child dialog of the modal dialog is created, and the help component is reparented into that, so the help stays enabled. The problem appears to be that there is no check to see if the parent of the new modal dialog *is* the help window (in which case it being disabled is perfectly fine - it will either be the Print dialog or the Print Setup dialog). So, just as the print dialog is being created, its parent frame disappears in a puff of smoke, and a new child dialog is added. I can't really imagine this strangeness being a thing the JDK team would want to officially support - which is why I say they'd be well within their rights to close any such bug report as WONTFIX. I'll try to put together a fix for 3.6.
Okay, I've got a workaround. Unfortunately, it's a bit ugly - we can't check if the print dialogs' owner is the help window's frame, because they use the no-owner constructor (owner is an invisible offscreen JFrame). So there's no way to make a connection to the invoker from it. The diff I will attach simply checks the class of the dialog, and if it's an AWT print dialog or print settings dialog, it does not play with the windows. This means that the help window will also be disabled when you select Print/Page Setup from the main File menu, but this is probably a reasonable trade off. Presumably with 1.6 or something in between, we will have better AWT window modality support, and the dancing help window will be a thing of the past.
Created attachment 14150 [details] Fix for the problem
Created attachment 14151 [details] core javahelp with patch
Does this happen on non-Win platforms? If not, the attached patch looks like a reasonable workaround to me. Backdating version field based on Tim's comment.
Hasn't been reported on other platforms. Just tried it on Apple, and it works correctly to open the dialog, but throws the following when the print dialog is *closed*, after which it is impossible to ever display the help dialog again: java.lang.IllegalStateException: Can't dispose InputContext while it's active at sun.awt.im.InputContext.dispose(InputContext.java:601) at java.awt.Window$1DisposeAction.run(Window.java:560) at java.awt.Window.dispose(Window.java:570) at java.awt.Dialog.disposeImpl(Dialog.java:638) at java.awt.Dialog.dispose(Dialog.java:634) at org.netbeans.modules.javahelp.JavaHelp.displayHelpInFrame(JavaHelp.java:186) at org.netbeans.modules.javahelp.JavaHelp.eventDispatched(JavaHelp.java:403) at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2136) at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2030) at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2029) at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2029) at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2029) at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2029) at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Toolkit.java:2029) at java.awt.Toolkit.notifyAWTEventListeners(Toolkit.java:1988) at java.awt.Component.dispatchEventImpl(Component.java:3530) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Window.dispatchEventImpl(Window.java:1606) at java.awt.Component.dispatchEvent(Component.java:3477) [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:479)
Not reproducible on Linux RH9 / JDK1.5.0(b43)/NB3.6 RC2(200304251830)
Not reproducible on Sol8 / JDK1.5.0(b43)/NB3.6 RC2(200304251830)
Not reproducible in JDK1.5.0(b44). But printing in Java help on linux doesn't work.
Tim's patch integrated into release36. It's not in the CVS trunk (promo-d)
fixed in 3.6, not in trunk, version -> promo-D
Reassigning to Marek, new owner of output window and help system
Tim, Shall I commit this fix to main trunk?
Marek, please retest it w/ the latest JDK 1.5 beta and integrate Tim's patch to trunk. Thx
It does not work also on Metal. I had to add one more condition for Metal. Tim please check on MacOS. I commit fix and attach diff. Reassigning to Tim to check on MAcOS and close.
Created attachment 15886 [details] Diff of patch for Win and Metal
Modified: /cvs/core/javahelp/src/org/netbeans/modules/javahelp/JavaHelp.java,v <-- JavaHelp.java new revision: 1.23; previous revision: 1.22 Tim on MacOS dialogs are shown but JavaHelp window is blinking. It looks like JavaHelp window in unnecessarily hidden and shown again when print dialogs are shown. Just minor issue but perhaps it might be fixed in the same way.
Fixed on apple too now. Checking in src/org/netbeans/modules/javahelp/JavaHelp.java; /cvs/core/javahelp/src/org/netbeans/modules/javahelp/JavaHelp.java,v <-- JavaHelp.java new revision: 1.25; previous revision: 1.24 done
verified in [nb_dev](200408311800)