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.
dev build 200109280100 IBM JDK 1.3 Sometimes when I use F6 to run a program, the output window remains empty and none of the program output is shown. It's as if the output window isn't associated with the running program at all. NOTE: The easiest way to reproduce this is to try running a program which doesn't have a main() function. The output window doesn't show any error. The program simply won't run.
the last sentence ("NOTE:...") seems weird. If there is no main() then the program cannot be run, what kind of output do you want to expect?
It should display stdout/stdout of java.exe which says my class has no main(). The old output-window used to do that. At least then I know why the EXECUTE operation failed; but with no feedback I'd never know..
I cannot reproduce this behaviour. When I try to run program without main (I'm using JDK 1.3.0), following output appears: java.lang.NoSuchMethodError: main Exception in thread "main" However, in your first sentence, did you mean: - output doesn't appear or - program isn't run (no Running workspace appears, no Exec window) ?
And one question more please: Does it appear only using F6 or also by click on menu item Execute?
- I meant no output appears; the exec window DOES appear - F6 or Execute both have the same effect, or lack thereof :)
This issue is IBM JDK specific. That explains why you couldn't repro it under Sun JDK. I tried it under Sun and IBM JDK today and found out only IBM's JDK has this problem.
Changed platform to PC. Still doesn't work under dev build 200110040910 :)
Hi Gili, You are also using OS2 correct? I can not reproduce the bug on IBM JDK 1.3 build dev 3.3 #20011008 Win w2k Can you please post exact steps to reproduce the bug. Thanks Honza
Ok, try a fresh userDir under 20011008 and the following testcase. You just enter Netbeans and run the testcase and you'll notice there is no output in the output window. It's very odd you don't get this under w2k. We might have to resort to some debugging code so we know what's going on on my end.. ----testcase---- public class NoOutput { public static void main(String [] args) { for (int i=0; i<10; ++i) System.out.println("You should be seeing this output in the output window!"); } } ---------end testcase------- Lastly, I get the following exception in IDE.LOG which might be the cause of this problem so please take a quick look at them: Tue Oct 09 07:37:13 EDT 2001: java.io.OptionalDataException: null Annotation: Cannot read class org.netbeans.modules.editor.options.JavaOptions java.io.OptionalDataException at java.io.ObjectInputStream.readObject(ObjectInputStream.java:417) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242) at org.openide.options.SystemOption.readExternal(SystemOption.java:219) at org.netbeans.modules.editor.options.BaseOptions.readExternal(BaseOpti ons.java:1066) at org.openide.util.SharedClassObject$WriteReplace.readObject(SharedClas sObject.java:637) at java.lang.reflect.Method.invoke(Native Method) at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2 219) at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1416) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:392) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242) [catch] at org.openide.loaders.XMLSettingsSupport$SettingsRecognizer.readSerial( XMLSettingsSupport.java:370) at org.openide.loaders.XMLSettingsSupport$SettingsRecognizer.instanceCre ate(XMLSettingsSupport.java:399) at org.openide.loaders.InstanceDataObject$SettingsInstance.instanceCreat e(InstanceDataObject.java:1058) at org.netbeans.modules.editor.options.AllOptionsFolder.initInstance(All OptionsFolder.java:217) at org.netbeans.modules.editor.options.AllOptionsFolder.loadMIMEOption(A llOptionsFolder.java:243) at org.netbeans.modules.editor.NbEditorKit.createEditorUI(NbEditorKit.ja va:97) at org.netbeans.editor.BaseTextUI.getEditorUI(BaseTextUI.java:418) at org.netbeans.editor.BaseTextUI.installUI(BaseTextUI.java:139) at javax.swing.JComponent.setUI(JComponent.java:327) at javax.swing.text.JTextComponent.setUI(JTextComponent.java:584) at org.netbeans.editor.BaseKit.install(BaseKit.java:445) at javax.swing.JEditorPane.setEditorKit(JEditorPane.java:870) at org.openide.text.CloneableEditor.initialize(CloneableEditor.java:177) at org.openide.text.CloneableEditor.readExternal(CloneableEditor.java:53 1) at org.openide.text.EditorSupport$Editor.readExternal(EditorSupport.java :528) at org.netbeans.modules.java.JavaEditor$JavaEditorComponent.readExternal (JavaEditor.java:1189) at org.openide.windows.TopComponent$Replacer.readObject(TopComponent.jav a:730) at java.lang.reflect.Method.invoke(Native Method) at java.io.ObjectInputStream.invokeObjectReader(ObjectInputStream.java:2 219) at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1416) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:392) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:242) at org.openide.loaders.XMLSettingsSupport$SettingsRecognizer.readSerial( XMLSettingsSupport.java:370) at org.openide.loaders.XMLSettingsSupport$SettingsRecognizer.instanceCre ate(XMLSettingsSupport.java:399) at org.openide.loaders.InstanceDataObject$SettingsInstance.instanceCreat e(InstanceDataObject.java:1052) at org.netbeans.core.windows.PersistenceManager.lookupTCInstance(Persist enceManager.java:388) at org.netbeans.core.windows.WindowManagerImpl.lookupTCInstance(WindowMa nagerImpl.java:863) at org.netbeans.core.windows.layers.TCRefImpl.getTopComponent(TCRefImpl. java:261) at org.netbeans.core.windows.layers.TCRefImpl.updateMode(TCRefImpl.java: 158) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.addComponents(M odeData.java:543) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.updateComponent s(ModeData.java:431) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.loadDataSection (ModeData.java:831) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.updatePropertie s(ModeData.java:316) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.updateAll(ModeD ata.java:296) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.loadDataSection (ModeData.java:816) at org.netbeans.core.windows.ModeImpl.ensureSectionLoaded(ModeImpl.java: 1710) at org.netbeans.core.windows.ModeImpl.getConstraints(ModeImpl.java:1326) at org.netbeans.core.windows.util.WindowUtils.findConstrainedMode(Window Utils.java:136) at org.netbeans.core.windows.util.WindowUtils.findConstrainedMode(Window Utils.java:114) at org.netbeans.core.windows.util.WindowUtils.changeModeConstraints(Wind owUtils.java:153) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.setProps2Mode(M odeData.java:385) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.updatePropertie s(ModeData.java:312) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.updateAll(ModeD ata.java:296) at org.netbeans.core.windows.layers.ModeData$CookiesImpl.loadDataSection (ModeData.java:816) at org.netbeans.core.windows.ModeImpl.ensureSectionLoaded(ModeImpl.java: 1710) at org.netbeans.core.windows.ModeImpl.getBounds(ModeImpl.java:539) at org.netbeans.core.windows.ModeImpl.updateBounds(ModeImpl.java:271) at org.netbeans.core.windows.ModeImpl.stateChanged(ModeImpl.java:299) at org.netbeans.core.windows.StateManager.fireStateChanged(StateManager. java:117) at org.netbeans.core.windows.StateManager.setVisibilityState(StateManage r.java:142) at org.netbeans.core.windows.StateManager.propertyChange(StateManager.ja va:164) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSup port.java:236) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSup port.java:163) at java.awt.Component.firePropertyChange(Component.java:4528) at org.netbeans.core.windows.MainWindow.doShowWindow(MainWindow.java:226 ) at org.netbeans.core.windows.MainWindow.access$300(MainWindow.java:57) at org.netbeans.core.windows.MainWindow$4.run(MainWindow.java:202) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:160) at java.awt.EventQueue.dispatchEvent(EventQueue.java:399) at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10 9) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:99) at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Just updating subcomponent.
Upgrading to P2 (tempted to make it P1) because stdout/stderr is vital for debugging anything within Netbeans.
We really cannot reproduce it on IBM JDK 1.3 and Win2k. So it's probably: OS/2 and IBM JDK specific bug..
One more question: Does it display empty tab "NoOutput - I/O" in OW or there is no such tab? Because we have no resources to test on OS/2, could you help us? I'm attaching patch, which will print some debug messages into USER_DIR/output/debug.log file - could you use it? Just copy it's content into core.jar.. and then send me debug file. Thanks.
- Sending me a debugging patch is a very smart idea :) - You forgot to attach the patch - I only see a "<program name> - IO" tab.
Created attachment 3013 [details] patch.jar
Debug.log reads: OutputTabTerm:OutputTabTerm.Factory.getIO(EggShell - I/O, true) OutputTabTerm:select OutputTabTerm:ensureOpen() OutputTabTerm:opening OutputTabTerm:OutputTabTerm.open():EggShell - I/O OutputTabTerm:topComponentOpened:org.netbeans.core. windows.TopComponentChangedEvent[source=org.netbean s.core.windows.WindowManagerImpl$TopComponentManage r@73e50f52] OutputTabTerm:ensureOpen()
Created attachment 3014 [details] patch.jar - second try to find problem
OK, I need more info: could you please test second patch also?
Created attachment 3016 [details] patch3.jar This debug info will be better than previous
Patch 3 output: OutputTabTerm:OutputTabTerm.Factory.getIO(EggShell - I/O, true) OutputTabTerm:select OutputTabTerm:ensureOpen() OutputTabTerm:opening OutputTabTerm:OutputTabTerm.open():EggShell - I/O OutputTabTerm:topComponentOpened:org.netbeans.core. windows.TopComponentChangedEvent[source=org.netbean s.core.windows.WindowManagerImpl$TopComponentManage r@391ae3a6] OutputTabTerm:ensureOpen() OutputTabTerm:getOut:writer:org.netbeans.core.outpu t.OutputTabTerm$TermOutputWriter@6d3263a9 OutputTabTerm:getErr
Strange, it looks like no print/write is called.. I need to know differences between using old and new output window. So I'm attaching new patch. You can start old OW using switch: -Dnetbeans.output.old=true debug info will be then in USER_DIR/output/debug_old.log Could you test it?
Created attachment 3081 [details] patch4.jar
dev build 200110150818 patch4 output: OutputTab:OutputTab.Factory.getIO(EggShell - I/O, true) OutputTab:select OutputTab:getOut:writer:org.netbeans.core.output.Ou tPane$PaneWriter@61b78296 OutputTab:getErr ------ NOTE: I don't think that -Dnetbeans.output.old=true is working. I didn't see any output when it was enabled. Either it's not using the old output, or the problem is totally not with the output window (maybe openide?)
i tested -Dnetbeans.output.old=true and it works (on win2k..) Did you see less outputs then before? E.g. compiler output? It looks like it's problem to locate the cause. Could you investigate from which build number exactly this bug appears? Thanks for help
200109180940 - had new output window and it worked anyway 200109220100 - doesn't work 200109280100 - doesn't work
Thanks. Unfortunatelly there was many commits between 0918 and 0922. However I found one change in executor on 0919, which could be a problem. I'm attaching patches rollbacking this change - could you test it? If this doesn't help, could you please also test 0919,0920 and 0921?
Created attachment 3093 [details] exec_patch.jar - copy openide dir into openide.jar and netbeans dir into core.jar
Ales, you're a genius ;) The patch works..
Great, so it looks like problem in IBM JDK for OS/2. So for now I'm closing this bug (with known patch) and CCing Ales Novak to add more info.
It seems that the problematic part is InputStream.available(), i.e. it always returns 0 even if there are bytes to read. Try this, if you can: create a java program that execs another program, which will print out something, you will get a Process object from exec. Then get the corresponding InputStream and see how available() works, i.e. it will likely return 0 instead of some reasonable number.
Turns out this is an IBM JDK bug (might be OS/2 specific, can someone please repro under Windows?). Basic rule of thumb: BufferedInputstream.available() will always return 0 until you use "BufferedInputstream.read()" .. Once you read(), available() will begin returning non-zero values. I'm reporting this to IBM but it will probably take them _months_ to fix this.. Can we: - Repro under Windows JDK. If it exists, add a 'hack' for IBM JDK under both platforms?
Created attachment 3098 [details] testcase for IBM JDK BufferedInputStream bug
Actually, you don't need to really use available() at all. You can simply keep on using read() until you get -1 marking the end of stream. This should fix the problem.
No, we cannot invoke read() directly and wait for EOF. That was the original code. This code is a workaround for operating systems with uninterruptible IO calls, i.e. Windows I think. Sometimes we need to interrupt threads that are reading from Process's streams. Since interrupt does not work on read() in all OSes I made this workaround, see #12803. I think that we have two choices, either leave the issue as is and advise OS2 users to install Ales K.'s patch, or we can make some "if (OS == OS2) ..." in our code.
I think the best thing to do right now is patch the main branch with OS/2-specific code. When 3.3 is about to roll out a few months/weeks from now, we check check IBM's JDK again and see if they've fixed the problem.
> or we can make some "if (OS == OS2) ..." in our code. I agree with this hack. Ugly as it is but it solves the real user problem. If we go this route please clearly comment the code (I usually mark the comment with XXX, ie. // XXX(-ttran) IBM JDK 1.3.x on OS/2 is broken // [a long paragraph explaining what is broken] // we need to workaround it .... if (org.openide.util.Utilities.getOperatingSystem() == org.openide.util.Utilities.OS_OS2) { .... } Later we can search for all "XXX" occurrences and revise the code. Using XXX is a well recognized convention
Reassign to Ales Novak, because problem is in execution package.
Fixed in main trunk, rev 1.61
verified rev1.61.
Resolved for 3.4.x or earlier, no new info since then -> closing.