harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r379197 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Date.java test/java/org/apache/harmony/tests/java/util/AllTests.java test/java/org/apache/harmony/tests/java/util/DateTest.java
Date Mon, 20 Feb 2006 18:38:26 GMT
Author: tellison
Date: Mon Feb 20 10:38:23 2006
New Revision: 379197

URL: http://svn.apache.org/viewcvs?rev=379197&view=rev
Log:
Fix for HARMONY-102 (java.util.Date.parse(String) throws java.lang.IllegalArgumentException
for legal string)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/DateTest.java
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/org/apache/harmony/tests/java/util/AllTests.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=379197&r1=379196&r2=379197&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
Mon Feb 20 10:38:23 2006
@@ -397,9 +397,10 @@
 				int digit = Integer.parseInt(buffer.toString());
 				buffer.setLength(0);
 				if (sign == '+' || sign == '-') {
-					if (year != -1 && zoneOffset == 0) {
+					if (zoneOffset == 0) {
 						zone = true;
 						zoneOffset = sign == '-' ? -digit : digit;
+						sign = 0;
 					} else
 						throw new IllegalArgumentException();
 				} else if (digit >= 70) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java?rev=379197&r1=379196&r2=379197&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java
Mon Feb 20 10:38:23 2006
@@ -32,6 +32,7 @@
 		suite.addTestSuite(BitSetTest.class);
 		suite.addTestSuite(ArraysTest.class);
 		suite.addTestSuite(IdentityHashMapTest.class);
+		suite.addTestSuite(DateTest.class);
 		//$JUnit-END$
 		return suite;
 	}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/DateTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/DateTest.java?rev=379197&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/DateTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/DateTest.java
Mon Feb 20 10:38:23 2006
@@ -0,0 +1,35 @@
+/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.tests.java.util;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+public class DateTest extends TestCase {
+
+	/**
+	 * @tests java.util.Date#parse(String)
+	 */
+	public void test_parseLjava_lang_String() {
+		// Regression for HARMONY-102
+		assertEquals("Assert 0: parse failure",
+				-5400000, Date.parse("Sat, 1 Jan 1970 +0130 00:00:00"));
+		assertEquals("Assert 1: parse failure",
+				858600000, Date.parse("00:00:00 GMT +0130 Sat, 11 Jan 1970"));
+	}
+
+}



Mime
View raw message