You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/02/14 11:50:01 UTC
svn commit: r377690 - in
/incubator/harmony/enhanced/classlib/trunk/modules/archive/src:
main/java/java/util/jar/ test/java/org/ test/java/org/apache/
test/java/org/apache/harmony/ test/java/org/apache/harmony/tests/
test/java/org/apache/harmony/tests/...
Author: tellison
Date: Tue Feb 14 02:50:00 2006
New Revision: 377690
URL: http://svn.apache.org/viewcvs?rev=377690&view=rev
Log:
Fix for HARMONY-89 (java.util.jar.Manifest().read(InputStream is) throws OutOfMemoryError)
plus testing infrastructure for archive module
Added:
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/archive/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/archive/AllTests.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/ManifestTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/zip/
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/zip/AllTests.java
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java?rev=377690&r1=377689&r2=377690&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java Tue Feb 14 02:50:00 2006
@@ -190,7 +190,12 @@
if (blankline)
addLine(pos, lines);
return lines.size() != 0;
- }
+ } else {
+ if (inbufCount == inbuf.length && in.available() == 0) {
+ /* KA000 = "line too long" */
+ throw new IOException(Msg.getString("KA000"));
+ }
+ }
inbufPos = 0;
}
next = inbuf[inbufPos++];
Added: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/archive/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/archive/AllTests.java?rev=377690&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/archive/AllTests.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/archive/AllTests.java Tue Feb 14 02:50:00 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.archive;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.suite());
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.apache.harmony.tests.archive");
+ //$JUnit-BEGIN$
+ suite.addTest(org.apache.harmony.tests.java.util.jar.AllTests.suite());
+ suite.addTest(org.apache.harmony.tests.java.util.zip.AllTests.suite());
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added: 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=377690&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/AllTests.java Tue Feb 14 02:50:00 2006
@@ -0,0 +1,36 @@
+/* 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.suite());
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.apache.harmony.tests.java.util.jar");
+ //$JUnit-BEGIN$
+ 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/ManifestTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/ManifestTest.java?rev=377690&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/ManifestTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/jar/ManifestTest.java Tue Feb 14 02:50:00 2006
@@ -0,0 +1,51 @@
+/* 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.io.IOException;
+import java.io.InputStream;
+import java.util.jar.Manifest;
+
+import junit.framework.TestCase;
+
+public class ManifestTest extends TestCase {
+
+ /**
+ * @tests {@link java.util.jar.Manifest#read(java.io.InputStream)
+ */
+ public void test_readLjava_io_InputStream() {
+ // Regression for HARMONY-89
+ InputStream is = new InputStreamImpl();
+ try {
+ new Manifest().read(is);
+ fail("Assert 0: Should have thrown IOException");
+ } catch (IOException e) {
+ // expected
+ e.printStackTrace();
+ }
+ }
+
+ // helper class
+ class InputStreamImpl extends InputStream {
+ public InputStreamImpl() {
+ super();
+ }
+
+ public int read() {
+ return 0;
+ }
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/zip/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/zip/AllTests.java?rev=377690&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/zip/AllTests.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/tests/java/util/zip/AllTests.java Tue Feb 14 02:50:00 2006
@@ -0,0 +1,36 @@
+/* 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.zip;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.suite());
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.apache.harmony.tests.java.util.zip");
+ //$JUnit-BEGIN$
+
+ //$JUnit-END$
+ return suite;
+ }
+
+}