JDK-4684701 : The spec for StreamTokenizer.ordinaryChar('\n') is incomplete
  • Type: Bug
  • Component: docs
  • Sub-Component: guides
  • Affected Version: 1.4.0,5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 2002-05-14
  • Updated: 2017-05-16
  • Resolved: 2004-09-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
5.0 b28Fixed
Description
Name: nkR10003			Date: 05/14/2002



Setting '\n' to be an ordinary makes behaivior of StreamTokenizer 
unpredictable. It still works like EOL terminator but does not encrease 
line number. The JavaDoc comments for ordinaryChar() says that:
"...
It removes any special significance the character has as a comment character,
word component, string delimiter, white space, or number character...
"
One can say that it does not imply that setting '\n' to be an ordinary 
character should change its treatment as an EOL marker, but it remains
unclear why it does not increase line number though.

Even if current behaivior is correct, the spec should be corrected to reflect
this rather questionable behaivior.

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic tiger-beta FIXED IN: tiger tiger-beta INTEGRATED IN: tiger-b28 tiger-beta VERIFIED IN: 1.5.0_01
2004-09-22

EVALUATION Engineering has suggested the following fix: /** * Specifies that the character argument is "ordinary" * in this tokenizer. It removes any special significance the * character has as a comment character, word component, string * delimiter, white space, or number character. When such a character * is encountered by the parser, the parser treates it as a * single-character token and sets <code>ttype</code> field to the * character value. * * <p>Making a line terminator character "ordinary" may interfere * with the ability of a <code>StreamTokenizer</code> to count * lines. The <code>lineno</code> method may no longer reflect * the presence of such terminator characters in its line count. * * @param ch the character. * @see java.io.StreamTokenizer#ttype */ ###@###.### 2003-09-10
2003-09-10