harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r469130 - in /incubator/harmony/enhanced/classlib/trunk/modules/text/src: main/java/java/text/ main/java/org/apache/harmony/text/internal/nls/ test/java/org/apache/harmony/text/tests/java/text/
Date Mon, 30 Oct 2006 11:50:37 GMT
Author: pyang
Date: Mon Oct 30 03:50:36 2006
New Revision: 469130

URL: http://svn.apache.org/viewvc?view=rev&rev=469130
Log:
Apply patch for HARMONY-1958 (classlib][text]ParseException thrown from java.text.DateFormat#parse(String)
has a null message)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
    incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java?view=diff&rev=469130&r1=469129&r2=469130
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java
Mon Oct 30 03:50:36 2006
@@ -506,7 +506,9 @@
         ParsePosition position = new ParsePosition(0);
         Date date = parse(string, position);
         if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
-            throw new ParseException(null, position.getErrorIndex());
+            // text.19=Unparseable date: {0}
+            throw new ParseException(
+                    Messages.getString("text.19", string), position.getErrorIndex()); //$NON-NLS-1$
         }
         return date;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties?view=diff&rev=469130&r1=469129&r2=469130
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/internal/nls/messages.properties
Mon Oct 30 03:50:36 2006
@@ -41,3 +41,4 @@
 text.16=Unknown element format
 text.17=Unknown format
 text.18=Not a valid {0}, subclass should override readResolve()
+text.19=Unparseable date: {0}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatTest.java?view=diff&rev=469130&r1=469129&r2=469130
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatTest.java
Mon Oct 30 03:50:36 2006
@@ -19,6 +19,7 @@
 import java.text.DateFormat;
 import java.text.DateFormatSymbols;
 import java.text.NumberFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -444,5 +445,18 @@
 		NumberFormat f1 = NumberFormat.getInstance();
 		format.setNumberFormat(f1);
 		assertTrue("Not identical NumberFormat", f1 == format.getNumberFormat());
+	}
+	
+	/**
+	 * @tests java.text.DateFormat#parse(String)
+	 */
+	public void test_parse_LString() {
+		DateFormat format = DateFormat.getInstance();
+		try {
+			format.parse("not a Date");
+			fail("should throw ParseException first");
+		} catch (ParseException e) {
+			assertNotNull(e.getMessage());
+		}
 	}
 }



Mime
View raw message