err & out stream outputs are not following code sequence

Answered

Problem:
The output sequence/ordering are different and changing for System.out and System.err streams inside the application's Run console. Whereas the system console/terminal (ie. cmd.exe under Windows) seems to be maintaining the sequence. This is a major problem for me because I need to track the actual output sequence, for both err and out streams, of my business/educational/testing work.

Supporting attachments:
  1. Code snippet:

private static void reportError()
{
boolean throwDummyExc = true;
System.out.println("1st line");
try { if(throwDummyExc) throw new NullPointerException("Dummy exc"); }
catch(NullPointerException e) { System.err.println("Exc line"); }
System.out.println("2nd line");
}

  2. Outputs:

      i) In application's Run console output:

          a) At time instance 1:

Exc line
1st line
2nd line

Process finished with exit code 0

          a) At time instance 2:

1st line
2nd line
Exc line

Process finished with exit code 0

      ii) In system console/terminal output (in this case cmd.exe under Windows): 

1st line
Exc line
2nd line

Question:
  1. Is there any way to fix this unsual behavior (from Settings or other)?
  2. Is this an application bug?
  3. Is anyone addressing this issue in the upcoming application updates?

0

Please sign in to leave a comment.