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.

Bug 16035 - Executing program doesn't output to OUTPUT WINDOW
Summary: Executing program doesn't output to OUTPUT WINDOW
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC OS/2
: P2 blocker (vote)
Assignee: anovak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-09-29 23:19 UTC by _ gtzabari
Modified: 2008-12-22 19:39 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch.jar (41.55 KB, application/octet-stream)
2001-10-15 13:17 UTC, akemr
Details
patch.jar - second try to find problem (41.96 KB, application/octet-stream)
2001-10-15 14:20 UTC, akemr
Details
patch3.jar This debug info will be better than previous (42.02 KB, application/octet-stream)
2001-10-15 15:38 UTC, akemr
Details
patch4.jar (84.36 KB, application/octet-stream)
2001-10-19 15:53 UTC, akemr
Details
exec_patch.jar - copy openide dir into openide.jar and netbeans dir into core.jar (13.28 KB, application/octet-stream)
2001-10-22 09:11 UTC, akemr
Details
testcase for IBM JDK BufferedInputStream bug (562 bytes, text/plain)
2001-10-23 02:30 UTC, _ gtzabari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2001-09-29 23:19:50 UTC
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.
Comment 1 _ ttran 2001-09-30 18:50:13 UTC
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?
Comment 2 _ gtzabari 2001-09-30 19:29:50 UTC
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..
Comment 3 akemr 2001-10-01 09:59:27 UTC
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)
?

Comment 4 akemr 2001-10-01 10:50:29 UTC
And one question more please:
Does it appear only using F6 or also by click on menu item Execute?
Comment 5 _ gtzabari 2001-10-01 13:45:03 UTC
- I meant no output appears; the exec window DOES appear
- F6 or Execute both have the same effect, or lack thereof :)
Comment 6 _ gtzabari 2001-10-05 06:04:41 UTC
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.
Comment 7 _ gtzabari 2001-10-08 19:47:06 UTC
Changed platform to PC.

Still doesn't work under dev build 200110040910 :)
Comment 8 Jan Pichert 2001-10-09 09:14:21 UTC
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
Comment 9 _ gtzabari 2001-10-09 12:44:07 UTC
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)
Comment 10 Jan Zajicek 2001-10-09 13:18:14 UTC
Just updating subcomponent.
Comment 11 _ gtzabari 2001-10-15 03:13:00 UTC
Upgrading to P2 (tempted to make it P1) because stdout/stderr is 
vital for debugging anything within Netbeans.
Comment 12 akemr 2001-10-15 09:53:53 UTC
We really cannot reproduce it on IBM JDK 1.3 and Win2k.
So it's probably:

OS/2 and IBM JDK specific bug..
Comment 13 akemr 2001-10-15 13:08:14 UTC
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.
Comment 14 _ gtzabari 2001-10-15 13:13:10 UTC
- Sending me a debugging patch is a very smart idea :)
- You forgot to attach the patch
- I only see a "<program name> - IO" tab.
Comment 15 akemr 2001-10-15 13:17:18 UTC
Created attachment 3013 [details]
patch.jar
Comment 16 _ gtzabari 2001-10-15 13:25:35 UTC
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()
Comment 17 akemr 2001-10-15 14:20:45 UTC
Created attachment 3014 [details]
patch.jar - second try to find problem
Comment 18 akemr 2001-10-15 14:32:34 UTC
OK, I need more info: could you please test second patch also?
Comment 19 akemr 2001-10-15 15:38:57 UTC
Created attachment 3016 [details]
patch3.jar This debug info will be better than previous
Comment 20 _ gtzabari 2001-10-16 01:24:46 UTC
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
Comment 21 akemr 2001-10-19 15:49:42 UTC
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?
Comment 22 akemr 2001-10-19 15:53:49 UTC
Created attachment 3081 [details]
patch4.jar
Comment 23 _ gtzabari 2001-10-19 16:03:26 UTC
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?)
Comment 24 akemr 2001-10-19 16:19:01 UTC
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
Comment 25 _ gtzabari 2001-10-20 19:12:36 UTC
200109180940 - had new output window and it worked anyway
200109220100 - doesn't work
200109280100 - doesn't work
Comment 26 akemr 2001-10-22 09:09:48 UTC
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?
Comment 27 akemr 2001-10-22 09:11:53 UTC
Created attachment 3093 [details]
exec_patch.jar - copy openide dir into openide.jar and netbeans dir into core.jar
Comment 28 _ gtzabari 2001-10-22 13:28:40 UTC
Ales, you're a genius ;) The patch works..
Comment 29 akemr 2001-10-22 14:05:09 UTC
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.
Comment 30 anovak 2001-10-22 14:48:14 UTC
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.
Comment 31 _ gtzabari 2001-10-23 02:28:46 UTC
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?
Comment 32 _ gtzabari 2001-10-23 02:30:04 UTC
Created attachment 3098 [details]
testcase for IBM JDK BufferedInputStream bug
Comment 33 _ gtzabari 2001-10-23 02:44:18 UTC
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.
Comment 34 anovak 2001-10-23 07:38:33 UTC
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.
Comment 35 _ gtzabari 2001-10-23 14:19:18 UTC
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.
Comment 36 _ ttran 2001-10-23 22:02:17 UTC
> 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
Comment 37 akemr 2001-10-24 10:59:16 UTC
Reassign to Ales Novak, because problem is in execution package.
Comment 38 anovak 2001-10-24 13:54:38 UTC
Fixed in main trunk, rev 1.61
Comment 39 Jan Zajicek 2001-10-25 12:19:51 UTC
verified rev1.61.
Comment 40 Quality Engineering 2003-07-01 16:38:36 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.