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

nextToken() parses a lone '.' char in the input stream as a zero

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6u45
    • core-libs
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      Almost similar as http://bugs.java.com/bugdatabase/view_bug.do?bug_id=1240786 , if I have a souce code which includes some codes like:

      new Thread(){
      ....
      }.start();

      It will always return a number 0.0 at the like of "}.start();" when I use below codes to extract the numbers:
      BufferedReader reader = ...;
      StreamTokenizer tokenizer = new StreamTokenizer(reader);
      tokenizer.parseNumbers();

      int nextToken = tokenizer.nextToken();
      while(nextToken != StreamTokenizer.TT_EOF){
      if(nextToken == StreamTokenizer.TT_NUMBER){
      System.out.println("number "+ tokenizer.nval+" on line "+tokenizer.lineno());
      }
      nextToken = tokenizer.nextToken();
      }
      reader.close();


      REPRODUCIBILITY :
      This bug can be reproduced always.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: