harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r377734 - in /incubator/harmony/enhanced/classlib/trunk/modules/archive/src: main/java/java/util/jar/ test/java/org/apache/harmony/tests/java/util/jar/
Date Tue, 14 Feb 2006 14:18:40 GMT
Author: tellison
Date: Tue Feb 14 06:18:37 2006
New Revision: 377734

URL: http://svn.apache.org/viewcvs?rev=377734&view=rev
Log:
Fix for HARMONY-85 (java.util.jar.Attributes.Name(String name) does not throw IllegalArgumentException
if name.length > 70)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesName.java
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java?rev=377734&r1=377733&r2=377734&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/Attributes.java
Tue Feb 14 06:18:37 2006
@@ -84,7 +84,7 @@
 
 		public Name(String s) {
 			int i = s.length();
-			if (i == 0)
+			if (i == 0 || i > 70)
 				throw new IllegalArgumentException();
 			for (; --i >= 0;) {
 				char ch = s.charAt(i);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java?rev=377734&r1=377733&r2=377734&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java
Tue Feb 14 06:18:37 2006
@@ -28,6 +28,7 @@
 		TestSuite suite = new TestSuite(
 				"Test for org.apache.harmony.tests.java.util.jar");
 		//$JUnit-BEGIN$
+		suite.addTestSuite(AttributesName.class);
 		suite.addTestSuite(ManifestTest.class);
 		//$JUnit-END$
 		return suite;

Added: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesName.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesName.java?rev=377734&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesName.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesName.java
Tue Feb 14 06:18:37 2006
@@ -0,0 +1,37 @@
+/* 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.jar;
+
+import java.util.jar.Attributes;
+
+import junit.framework.TestCase;
+
+public class AttributesName extends TestCase {
+
+	/**
+	 * @tests java.util.jar.Attributes.Name#Name(java.lang.String)
+	 */
+	public void test_AttributesName_Constructor() {
+		// Regression for HARMONY-85
+		try {
+			new Attributes.Name(
+					"01234567890123456789012345678901234567890123456789012345678901234567890");
+			fail("Assert 0: should have thrown IllegalArgumentException");
+		} catch (IllegalArgumentException e) {
+			// expected
+		}
+	}
+}



Mime
View raw message