Name: wm38563 Date: 11/25/98
Hello,
if I overwrite the err-Printstream using
System.setErr(..) the error messages are
printed to the system's window instead of
my Printstream ( for example StringOutOfBounds-
Exception in String.substring; it seems to
be native hard-coded. I'm using my own
window to make my application pure Java.
(Review ID: 43230)
======================================================================
I think this is the problem being reported.
import java.io.*;
public class Test {
public static void main(String [] args) throws Exception {
System.setErr(new PrintStream(new FileOutputStream("foo")));
System.setOut(new PrintStream(new FileOutputStream("bar")));
String s = "abc";
System.out.println(s.substring(1, 4));
}
}
In jdk1.4-beta3-b84, winNT or win98:
$ java Test
Exception in thread "main" $ ls -s foo bar
0 bar 1 foo
$ cat foo
java.lang.StringIndexOutOfBoundsException: String index out of range: 4
at java.lang.String.substring(String.java:1446)
at Test.main(Test.java:8)
The "Exception in thread ..." message does not appear on Solaris.
-- iag@sfbay 2001-10-25
- duplicates
-
JDK-4497873 java needs "-Xstderr" option (cf. 4380614, 4465402) [win9x/ME]
-
- Closed
-