serialize as not-serializable if exception is not registered
This commit is contained in:
parent
4e2621ca21
commit
325cc6bc61
|
@ -181,7 +181,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
/**
|
||||
* Retruns <code>true</code> iff the given name is a registered for an exception to be read.
|
||||
*/
|
||||
static boolean isRegistered(String name) {
|
||||
public static boolean isRegistered(String name) {
|
||||
return MAPPING.containsKey(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -473,7 +473,8 @@ public abstract class StreamOutput extends OutputStream {
|
|||
writeVInt(9);
|
||||
} else {
|
||||
ElasticsearchException ex;
|
||||
if (throwable instanceof ElasticsearchException) {
|
||||
final String name = throwable.getClass().getName();
|
||||
if (throwable instanceof ElasticsearchException && ElasticsearchException.isRegistered(name)) {
|
||||
ex = (ElasticsearchException) throwable;
|
||||
} else {
|
||||
ex = new NotSerializableExceptionWrapper(throwable);
|
||||
|
|
Loading…
Reference in New Issue