8076401: Serialize OIS data
authorchegar
Fri, 17 Apr 2015 15:28:44 +0100
changeset 31708 702a66d7e231
parent 31707 1820e72671e8
child 31709 885627926ab1
8076401: Serialize OIS data Reviewed-by: alanb, igerasim
jdk/src/java.base/share/classes/java/io/ObjectInputStream.java
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Thu Apr 16 11:27:23 2015 +0300
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Fri Apr 17 15:28:44 2015 +0100
@@ -1906,10 +1906,9 @@
             ObjectStreamClass slotDesc = slots[i].desc;
 
             if (slots[i].hasData) {
-                if (obj != null &&
-                    slotDesc.hasReadObjectMethod() &&
-                    handles.lookupException(passHandle) == null)
-                {
+                if (obj == null || handles.lookupException(passHandle) != null) {
+                    defaultReadFields(null, slotDesc); // skip field values
+                } else if (slotDesc.hasReadObjectMethod()) {
                     SerialCallbackContext oldContext = curContext;
 
                     try {
@@ -1946,6 +1945,7 @@
                         defaultSetFieldValues(obj, slotDesc, vals);
                     }
                 }
+
                 if (slotDesc.hasWriteObjectData()) {
                     skipCustomData();
                 } else {