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.
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)
passign to output maintainer.
Not sure, if we guarantee that.. Probably something in execution? Please reassign me back if I'm wrong..
AFAIK the output may always mixed if printing to stderr and stdout is mixed. System.out and System.err are not synchronized.
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 ?
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..
This problem still exists with NB 6.0 on Win XP : Cf. http://www.nabble.com/Output-window-td14250051.html#a14250051
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.
Reassigning to new module owner Tomas Holy.
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.
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).
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.