harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r395132 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Date.java test/java/tests/api/java/util/DateTest.java
Date Wed, 19 Apr 2006 04:56:30 GMT
Author: smishura
Date: Tue Apr 18 21:56:29 2006
New Revision: 395132

URL: http://svn.apache.org/viewcvs?rev=395132&view=rev
Log:
Apply updated patch for HARMONY-259 (java.util.Date.parse(null) should throw IllegalArgumentException)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java?rev=395132&r1=395131&r2=395132&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Date.java
Tue Apr 18 21:56:29 2006
@@ -361,6 +361,11 @@
 	 * @deprecated use DateFormat
 	 */
 	public static long parse(String string) {
+
+		if (string == null) {
+			throw new IllegalArgumentException("string is null.");
+		}
+
 		char sign = 0;
 		int commentLevel = 0;
 		int offset = 0, length = string.length(), state = 0;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java?rev=395132&r1=395131&r2=395132&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/DateTest.java
Tue Apr 18 21:56:29 2006
@@ -335,6 +335,14 @@
 		cal.clear();
 		cal.set(1999, Calendar.NOVEMBER, 22, 12, 52, 06);
 		assertTrue("Wrong parsed date 5", d.equals(cal.getTime()));
+        
+		try {
+			// Regression for HARMONY-259
+			Date.parse(null);
+			fail("Date.parse(null) should throw IllegalArgumentException");
+		} catch (IllegalArgumentException e) {
+			// expected
+		}
 	}
 
 	/**



Mime
View raw message