--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java Wed Jan 13 11:24:11 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java Wed Jan 20 20:51:45 2016 +0000
@@ -1915,6 +1915,8 @@
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 @@
*/
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;
}
/*