YARN-3770. SerializedException should also handle java.lang.Error on de-serialization. Contributed by Lavkesh Lahngir
This commit is contained in:
parent
460e98f7b3
commit
4672315e2d
@ -571,6 +571,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
YARN-3695. ServerProxy (NMProxy, etc.) shouldn't retry forever for non
|
YARN-3695. ServerProxy (NMProxy, etc.) shouldn't retry forever for non
|
||||||
network exception. (Raju Bairishetti via jianhe)
|
network exception. (Raju Bairishetti via jianhe)
|
||||||
|
|
||||||
|
YARN-3770. SerializedException should also handle java.lang.Error on
|
||||||
|
de-serialization. (Lavkesh Lahngir via jianhe)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -101,7 +101,7 @@ public Throwable deSerialize() {
|
|||||||
} else if (RuntimeException.class.isAssignableFrom(realClass)) {
|
} else if (RuntimeException.class.isAssignableFrom(realClass)) {
|
||||||
classType = RuntimeException.class;
|
classType = RuntimeException.class;
|
||||||
} else {
|
} else {
|
||||||
classType = Exception.class;
|
classType = Throwable.class;
|
||||||
}
|
}
|
||||||
return instantiateException(realClass.asSubclass(classType), getMessage(),
|
return instantiateException(realClass.asSubclass(classType), getMessage(),
|
||||||
cause == null ? null : cause.deSerialize());
|
cause == null ? null : cause.deSerialize());
|
||||||
|
@ -20,10 +20,9 @@
|
|||||||
|
|
||||||
import java.nio.channels.ClosedChannelException;
|
import java.nio.channels.ClosedChannelException;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl;
|
|
||||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||||
import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProto;
|
import org.apache.hadoop.yarn.proto.YarnProtos.SerializedExceptionProto;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestSerializedExceptionPBImpl {
|
public class TestSerializedExceptionPBImpl {
|
||||||
@ -79,4 +78,13 @@ public void testBeforeInit() throws Exception {
|
|||||||
SerializedExceptionPBImpl pb3 = new SerializedExceptionPBImpl();
|
SerializedExceptionPBImpl pb3 = new SerializedExceptionPBImpl();
|
||||||
Assert.assertEquals(defaultProto.getTrace(), pb3.getRemoteTrace());
|
Assert.assertEquals(defaultProto.getTrace(), pb3.getRemoteTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThrowableDeserialization() {
|
||||||
|
// java.lang.Error should also be serializable
|
||||||
|
Error ex = new Error();
|
||||||
|
SerializedExceptionPBImpl pb = new SerializedExceptionPBImpl();
|
||||||
|
pb.init(ex);
|
||||||
|
Assert.assertEquals(ex.getClass(), pb.deSerialize().getClass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user