8129952: Ensure thread consistency

Reviewed-by: alanb, ahgross, skoivu
This commit is contained in:
Chris Hegarty 2016-01-20 20:51:45 +00:00
parent 11920c3315
commit 0aa59442eb

View File

@ -1915,6 +1915,8 @@ public class ObjectInputStream
if (obj == null || handles.lookupException(passHandle) != null) {
defaultReadFields(null, slotDesc); // skip field values
} else if (slotDesc.hasReadObjectMethod()) {
ThreadDeath t = null;
boolean reset = false;
SerialCallbackContext oldContext = curContext;
if (oldContext != null)
oldContext.check();
@ -1933,10 +1935,19 @@ public class ObjectInputStream
*/
handles.markException(passHandle, ex);
} finally {
curContext.setUsed();
if (oldContext!= null)
oldContext.check();
curContext = oldContext;
do {
try {
curContext.setUsed();
if (oldContext!= null)
oldContext.check();
curContext = oldContext;
reset = true;
} catch (ThreadDeath x) {
t = x; // defer until reset is true
}
} while (!reset);
if (t != null)
throw t;
}
/*