This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
PR141
- To: java-discuss at sourceware dot cygnus dot com
- Subject: PR141
- From: aph at cygnus dot remove dot co dot uk (Andrew Haley)
- Date: 23 Aug 2000 18:38:51 GMT
- Newsgroups: cygnus.external.java.d
- Organization: Cygnus Solutions, a Red Hat company (Cambridge, UK)
- Reply-To: aph at cygnus dot com
This testuite failure has been bugging me for a long time. Anyway,
here's a fix that is compatible with JDK: a StreamTokenizer shouldn't
throw an exception.
Classpath also, I think.
Andrew.
2000-08-23 Andrew Haley <aph@cygnus.co.uk>
* java/io/StreamTokenizer.java: Don't throw a
NumberFormatException if a field is numeric as far as the
StreamTokenizer is concerned but not as far as Double.valueOf() is
concerned: return zero instead.
Index: StreamTokenizer.java
===================================================================
RCS file: /cvs/cvsfiles/devo/libjava/java/io/StreamTokenizer.java,v
retrieving revision 1.9.8.1
diff -u -r1.9.8.1 StreamTokenizer.java
--- StreamTokenizer.java 2000/07/24 19:37:45 1.9.8.1
+++ StreamTokenizer.java 2000/08/23 18:45:59
@@ -318,7 +318,14 @@
if (ch != TT_EOF)
in.unread(ch);
ttype = TT_NUMBER;
- nval = Double.valueOf(tokbuf.toString()).doubleValue();
+ try
+ {
+ nval = Double.valueOf(tokbuf.toString()).doubleValue();
+ }
+ catch (NumberFormatException _)
+ {
+ nval = 0.0;
+ }
}
else if (isAlphabetic(ch))
{