Index: modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectInputStreamTest.java
===================================================================
--- modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectInputStreamTest.java (revision 0)
+++ modules/luni/src/test/java/org/apache/harmony/tests/java/io/ObjectInputStreamTest.java (revision 0)
@@ -0,0 +1,118 @@
+/*
+ * 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.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+import junit.framework.TestCase;
+
+public class ObjectInputStreamTest extends TestCase {
+
+ /**
+ * @tests java.io.ObjectInputStream#readObject()
+ */
+ public void test_readObject() throws Exception {
+ // Regression for HARMONY-91
+
+ // dynamically create serialization byte array for the next hierarchy:
+ // - class A implements Serializable
+ // - class C extends A
+
+ byte[] cName = C.class.getName().getBytes();
+ byte[] aName = A.class.getName().getBytes();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ byte[] begStream = new byte[] { (byte) 0xac, (byte) 0xed, // STREAM_MAGIC
+ (byte) 0x00, (byte) 0x05, // STREAM_VERSION
+ (byte) 0x73, // TC_OBJECT
+ (byte) 0x72, // TC_CLASSDESC
+ (byte) 0x00, // only first byte for C class name length
+ };
+
+ out.write(begStream, 0, begStream.length);
+ out.write(cName.length); // second byte for C class name length
+ out.write(cName, 0, cName.length); // C class name
+
+ byte[] midStream = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x21, // serialVersionUID = 33L
+ (byte) 0x02, // flags
+ (byte) 0x00, (byte) 0x00, // fields : none
+ (byte) 0x78, // TC_ENDBLOCKDATA
+ (byte) 0x72, // Super class for C: TC_CLASSDESC for A class
+ (byte) 0x00, // only first byte for A class name length
+ };
+
+ out.write(midStream, 0, midStream.length);
+ out.write(aName.length); // second byte for A class name length
+ out.write(aName, 0, aName.length); // A class name
+
+ byte[] endStream = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0b, // serialVersionUID = 11L
+ (byte) 0x02, // flags
+ (byte) 0x00, (byte) 0x01, // fields
+
+ (byte) 0x4c, // field description: type L (object)
+ (byte) 0x00, (byte) 0x04, // length
+ // field = 'name'
+ (byte) 0x6e, (byte) 0x61, (byte) 0x6d, (byte) 0x65,
+
+ (byte) 0x74, // className1: TC_STRING
+ (byte) 0x00, (byte) 0x12, // length
+ //
+ (byte) 0x4c, (byte) 0x6a, (byte) 0x61, (byte) 0x76,
+ (byte) 0x61, (byte) 0x2f, (byte) 0x6c, (byte) 0x61,
+ (byte) 0x6e, (byte) 0x67, (byte) 0x2f, (byte) 0x53,
+ (byte) 0x74, (byte) 0x72, (byte) 0x69, (byte) 0x6e,
+ (byte) 0x67, (byte) 0x3b,
+
+ (byte) 0x78, // TC_ENDBLOCKDATA
+ (byte) 0x70, // NULL super class for A class
+
+ // classdata
+ (byte) 0x74, // TC_STRING
+ (byte) 0x00, (byte) 0x04, // length
+ (byte) 0x6e, (byte) 0x61, (byte) 0x6d, (byte) 0x65, // value
+ };
+
+ out.write(endStream, 0, endStream.length);
+ out.flush();
+
+ // read created serial. form
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
+ out.toByteArray()));
+ Object o = ois.readObject();
+ }
+
+ public static class A implements Serializable {
+ private static final long serialVersionUID = 11L;
+
+ public String name = "name";
+ }
+
+ public static class B extends A {
+ }
+
+ public static class C extends B {
+ private static final long serialVersionUID = 33L;
+ }
+}
Index: modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java
===================================================================
--- modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java (revision 377676)
+++ modules/luni/src/test/java/org/apache/harmony/tests/java/io/AllTests.java (working copy)
@@ -31,6 +31,7 @@
suite.addTestSuite(FilePermissionTest.class);
suite.addTestSuite(FileTest.class);
suite.addTestSuite(BufferedReaderTest.class);
+ suite.addTestSuite(ObjectInputStreamTest.class);
suite.addTestSuite(PushBackInputStreamTest.class);
//$JUnit-END$
return suite;
Index: modules/luni/src/main/java/java/io/ObjectInputStream.java
===================================================================
--- modules/luni/src/main/java/java/io/ObjectInputStream.java (revision 377676)
+++ modules/luni/src/main/java/java/io/ObjectInputStream.java (working copy)
@@ -1256,8 +1256,8 @@
readObjectForClass(object,
(ObjectStreamClass) streamClassList.get(j));
}
+ lastIndex = index + 1;
}
- lastIndex = index + 1;
}
}
Index: modules/luni/make/common/build.xml
===================================================================
--- modules/luni/make/common/build.xml (revision 377676)
+++ modules/luni/make/common/build.xml (working copy)
@@ -77,6 +77,7 @@
jvm="${hy.target}/jre/bin/java">
+
Index: modules/security2/make/build.xml
===================================================================
--- modules/security2/make/build.xml (revision 377679)
+++ modules/security2/make/build.xml (working copy)
@@ -492,7 +492,6 @@
printsummary="withOutAndErr"
errorproperty="test.error"
showoutput="on"
- haltonfailure="on"
dir="${basedir}"
jvm="${vm.home}/bin/java">
@@ -555,12 +554,9 @@
-
-
-