harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r441437 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/ObjectInputStream.java test/java/tests/api/java/io/ObjectInputStreamTest.java
Date Fri, 08 Sep 2006 08:46:05 GMT
Author: mloenko
Date: Fri Sep  8 01:46:04 2006
New Revision: 441437

URL: http://svn.apache.org/viewvc?view=rev&rev=441437
Log:
applied patch for HARMONY-846
[classlib][io] unexpected exceptions for ObjectInputStream().read<Object> methods

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java?view=diff&rev=441437&r1=441436&r2=441437
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
Fri Sep  8 01:46:04 2006
@@ -2057,6 +2057,9 @@
 
     private Object readObject(boolean unshared) throws OptionalDataException,
             ClassNotFoundException, IOException {
+        if (input == null) {
+            return null;
+        }
         boolean restoreInput = (primitiveData == input);
         if (restoreInput) {
             primitiveData = emptyStream;
@@ -2132,6 +2135,9 @@
      */
     protected Object readObjectOverride() throws OptionalDataException,
             ClassNotFoundException, IOException {
+        if (input == null) {
+        	return null;
+        }
         // Subclasses must override.
         throw new IOException();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java?view=diff&rev=441437&r1=441436&r2=441437
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java
Fri Sep  8 01:46:04 2006
@@ -511,6 +511,24 @@
                 out.toByteArray()));
         Object o = ois.readObject();
         assertEquals(C.class, o.getClass());
+
+		// Regression for HARMONY-846
+        assertNull(new ObjectInputStream() {}.readObject());
+    }
+
+    /**
+     * @tests java.io.ObjectInputStream#readObjectOverride()
+     */
+    public void test_readObjectOverride() throws Exception {
+        // Regression for HARMONY-846
+        assertNull(new ObjectInputStream() {
+
+            public Object readObjectOverride() throws IOException,
+                    ClassNotFoundException {
+                return super.readObjectOverride();
+            }
+
+        }.readObjectOverride());
     }
 
     public static class A implements Serializable {



Mime
View raw message