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

fp.bugs 4169 StreamTokenizer.slashStarComments ingores */ to end of line

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.0.1
    • core-libs
    • sparc
    • solaris_2.5

       From: ###@###.### (Rob Hulme - Northern Europe Applications and Languages Group)
      This does not look like form output to me.


      1. BUG
      2. JDK
      3. JDK 1.0.1
      4. The StreamTokenizer class appears to be ignoring tokens from /*
         to the end of the line.
      5. SPARCstation 20/50 Solaris 2.5
      6. NA (java stc)
      7.

      stc.java
      ========
      // Example of /* ... */ failing in StreamTokenizer
      import java.io.*;
       
      class stc {
              public static void main(String argv[]) {
                  FileInputStream fis=null;
                  int ii=0;
       
                  try {
                      fis = new FileInputStream("./st.dat");
                  } catch(FileNotFoundException exc) {
                      System.out.println("File not found");
                      return;
                  }
       
                  StreamTokenizer stkn = new StreamTokenizer(fis);
                  stkn.slashStarComments(true);
                  try {
                      while ((ii = stkn.nextToken()) != stkn.TT_EOF) {
                          System.out.println("Word is " + stkn.sval);
                      }
                  } catch (java.io.IOException exc) {
                      System.out.println("Hose");
                      return;
                  }
              }
      }

      st.dat
      ======
      This is line one of the file. /* IGNORE ME */
      Line two starts /* IGNORE ME */ here.
      Finally we have a third.

      8. NA
      9.

      % java stc
      Word is This
      Word is is
      Word is line
      Word is one
      Word is of
      Word is the
      Word is file.
      Word is Line
      Word is two
      Word is starts
      Word is Finally
      Word is we
      Word is have
      Word is a
      Word is third.

            fyellinsunw Frank Yellin (Inactive)
            bhagen Benjamin Hagen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: