-
Bug
-
Resolution: Fixed
-
P3
-
1.1
-
1.1.1
-
sparc
-
solaris_2.5
-
Not verified
Name: saC57035 Date: 12/17/96
The java_io.StreamTokenizer.nextToken() method count lines inside
of /* .. */ comments wrong. It counts only \n regardless of
whether there are other (\r or \r\n) line terminators or
whether \n is ordinary (no increment is needed in this case).
Here is the example demonstrating the bug:
---- Test.java ----------------------
import java.io.*;
public class Test {
public static void main( String argv[] ) {
StreamTokenizer st = new StreamTokenizer
(new StringBufferInputStream("/*\n \r \r */a"));
st.ordinaryChar('/');
st.slashStarComments(true);
try {
while(st.nextToken() != st.TT_EOF) System.out.println(st);
} catch (Throwable e) {
System.out.println("Test failed: "+e+" is thrown");
}
}
}
-- The output ----------------
Token[a], line 2
------------------------------
As we can see, only \n is counted.
======================================================================