-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.1.6
-
x86
-
windows_nt
Name: dbT83986 Date: 02/11/99
The following code:
import java.io.*;
public class Test {
public static void main(String[] args) {
try
{
PrintStream errPrintStream = new PrintStream(new FileOutputStream("std.out"));
System.setOut(errPrintStream);
for(int i = 0; i < 2; i++)
{
System.out.println("\nHello File World!!!");
}
errPrintStream.close();
System.setOut(System.out);
}
catch(Exception e)
{
System.out.println("SOMETHING WENT WRONG");
}
for(int i = 0; i < 2; i++)
{
System.out.println("\nHello Outside World!!!");
}
}
}
-------
Sends "Hello File World!!!" to std.out while "Hello Outside World!!!" is never printed at all. Removing ".close()" call results printing
of both greetings to a file. However, after a seemingly irrelevant change and running this code with "-nojit" option results in
expected outcome:
-------
import java.io.*;
public class Test {
public static void main(String[] args) {
try
{
PrintStream outPrint = System.out;
PrintStream errPrintStream = new PrintStream(new FileOutputStream("std.out"));
System.setOut(errPrintStream);
for(int i = 0; i < 2; i++)
{
System.out.println("\nHello File World!!!");
}
errPrintStream.close();
System.setOut(outPrint);
}
catch(Exception e)
{
System.out.println("SOMETHING WENT WRONG");
}
for(int i = 0; i < 2; i++)
{
System.out.println("\nHello Outside World!!!");
}
}
}
-------
NOTE: Both 1.1.7 and 1.2 produce the same error. Accept I found no way to set JIT off in 1.2.
-------
If I missing something I would really appreacite it if you could point it out to me. Otherwise I will assume this is a bug.
Good day!!!
(Review ID: 52416)
======================================================================