This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PR141


Tom Tromey writes:
 > Andrew> This testuite failure has been bugging me for a long time.
 > Andrew> Anyway, here's a fix that is compatible with JDK: a
 > Andrew> StreamTokenizer shouldn't throw an exception.
 > 
 > This is an interesting one.  My reading is that `.' shouldn't be
 > treated as a number and that this is actually a bug in the JDK.

I don't think so.  If you look at the spec, it says that "if a numeric
character is encountered, then an attempt is made to recognize a
number.  If the first character is a '-' [ ... ] otherwise a number is
parsed, stopping before the next occurence of '.', the first
nonnumeric character encountered or EOF."

In which case, a '.' *is* recognized as a number by the parser, and
the JDK does what the spec says it must.

 > I just tried the stream tokenizer test with `-.'.  The JDK gives me
 > `-0.0'.  Even with this patch we'll still get `0.0', which is "wrong"
 > by either definition.

I will submit a revised patch.  Minus zero, indeed!  :-)

Andrew.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]