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 20431 - Separate stderr and stdout output from executor
Summary: Separate stderr and stdout output from executor
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Execution (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker with 1 vote (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-11 12:54 UTC by Luigi Quattrocchi
Modified: 2015-09-30 10:45 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luigi Quattrocchi 2002-02-11 12:54:38 UTC
The output sequence of the following program (an example program of a Java 
course) is not correct:

===========================
class ThreeException extends Exception {}

public class FinallyWorks {
  static int count = 0;
  public static void main(String[] args) {
    while(true) {
      try {
        // Post-increment is zero first time:
        if(count++ == 0)
          throw new ThreeException();
        System.out.println("No exception");
      } catch(ThreeException e) {
        System.err.println("ThreeException");
      } finally {
        System.err.println("In finally clause");
        if(count == 2) break; // out of "while"
      }
    }
  }
}
===========================

The output should be:

ThreeException
In finally clause
No exception
In finally clause

The obtained output is:

No exception
ThreeException
In finally clause
In finally clause

(tested also on another PC with Windows ME)
Comment 1 David Simonek 2002-02-11 14:13:44 UTC
passign to output maintainer.
Comment 2 akemr 2002-02-11 14:32:29 UTC
Not sure, if we guarantee that..

Probably something in execution? Please reassign me back if I'm wrong..
Comment 3 drscott 2002-02-12 07:10:50 UTC
AFAIK the output may always mixed if printing to stderr and stdout is 
mixed. System.out and System.err are not synchronized.
Comment 4 Svata Dedic 2002-03-25 15:32:24 UTC
Yes, DrScott's observation is correct - unless we 
separate stderr from stdout in the output window, there's 
no guarantee on what message (even what character) 
appears first.
Ales, do you know if there's an outstanding RFE for 
stderr/stdout separation in OW ?
Comment 5 akemr 2002-03-25 15:43:46 UTC
I don't know. Generally, OW is able to separate err and out - debugger
already uses that way.

And, there is RFE 19655:
Use colors to distinguish err, out, ide and in streams.

but it's something else..


Comment 6 jproto 2007-12-12 13:20:06 UTC
This problem still exists with NB 6.0 on Win XP : Cf. http://www.nabble.com/Output-window-td14250051.html#a14250051

Comment 7 jproto 2007-12-12 13:24:18 UTC
In fact, I don't hope that stderr and stdout are separate.
I just whant to have the same order in Netbeans's output window than when I launch my program from command line.
Comment 8 Antonin Nebuzelsky 2008-02-19 14:00:34 UTC
Reassigning to new module owner Tomas Holy.
Comment 9 kirkstork 2008-10-09 23:53:34 UTC
In general I don't want log and error messages intermixed with my purposeful output. Especially true when the order of
things emitted from the program is not preserved.  Ideally, one could have as many output windows as one desires and
could assign one or more streams to each window.

I don't think this is a platform-specific thing.  It happens on the Mac too.
Comment 10 jproto 2008-10-10 16:10:37 UTC
This would be a nice feature to be able to open multiples output windows and choice in each one which output to show
(standard output, error output).
If standard *and* error output are required, displayed order has to be the same as standard call (outside of Netbeans).
Comment 11 Petr Hejl 2015-09-30 10:45:48 UTC
As in the Java the both streams has to be actively queried for the data there is no guarantee of the order between the two unless the error is redirected to output by the API call (responsibility and choice of the module using the execution API). The err and output have different color for some time.