PR141

Andrew Haley aph@cygnus.remove.co.uk
Wed Aug 23 12:00:00 GMT 2000


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))
 {


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /