/** Read from a stream. */ public SimulateProcessorResult(StreamInput in) throws IOException { this.processorTag = in.readString(); if (in.readBoolean()) { this.failure = in.readException(); this.ingestDocument = null; } else { this.ingestDocument = new WriteableIngestDocument(in); this.failure = null; } }
/** * Deserializes stacktrace elements as well as suppressed exceptions from the given output stream * and adds it to the given exception. */ public static <T extends Throwable> T readStackTrace(T throwable, StreamInput in) throws IOException { final int stackTraceElements = in.readVInt(); StackTraceElement[] stackTrace = new StackTraceElement[stackTraceElements]; for (int i = 0; i < stackTraceElements; i++) { final String declaringClasss = in.readString(); final String fileName = in.readOptionalString(); final String methodName = in.readString(); final int lineNumber = in.readVInt(); stackTrace[i] = new StackTraceElement(declaringClasss, methodName, fileName, lineNumber); } throwable.setStackTrace(stackTrace); int numSuppressed = in.readVInt(); for (int i = 0; i < numSuppressed; i++) { throwable.addSuppressed(in.readException()); } return throwable; }
public ElasticsearchException(StreamInput in) throws IOException { super(in.readOptionalString(), in.readException()); readStackTrace(this, in); headers.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString)); }