Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4193103

Non-redirectable message on windows "Exception in thread \"main\""

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_95

      Description



      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hhuangsunw Hui Huang (Inactive)
              Reporter:
              wmaddoxsunw William Maddox (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: