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

java.io.StreamTokenizer.pushBack method ignores possible errors

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.1
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5, windows_95
    • Verification:
      Not verified

      Description



      Name: saC57035 Date: 12/16/96


      The java_io.StreamTokenizer.pushBack() method does not report on
      errors which may be produced by its call.

      For example, it is possible to call pushBack before any nextToken
      call without any errors diagnostics. The initial state of
      StreamTokenizer public variables will be returned by nextToken call
      in that case, which is equivalent to \0 ordinary character.

      It is possible to call pushBack many times as well. This conflicts,
      however, with traditional understanding of pushBack operation.
      User always receives the same token after any number of
      pushBack calls.
       
      Here is the example:
      ----Test.java-------------------
      import java.io.*;

      public class Test {

      public static void main( String argv[] ) {
       StreamTokenizer st = new StreamTokenizer
                     (new StringBufferInputStream("line1 \' \n line2 \n line3"));
       try {
         st.pushBack(); // once
         st.pushBack(); //again
         st.nextToken();
         System.out.println(st.ttype); // getting 0 as if it were the first byte
                                       // of the stream!
       } catch (Throwable e) {
         System.out.println("Test failed: "+e+" is thrown");
       }
      }

      }
      -------Output--------------------
      0
      ---------------------------------

      The current version of JLS provides no ways of reporting errors
      by pushBack(). I have filed the bug against specs as well
      (see bug 4022252)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              apalanissunw Anand Palaniswamy (Inactive)
              Reporter:
              savzan Stanislav Avzan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: