/** * Recreate throwable from exception protoBuf which received from remote or local node. * if no match constructor found, the base Throwable (Exception or Error) is created as a substitution * * @param exceptionWrapper the exception protoBuf * @return Throwable deserialized from protoBuf */ public static Throwable getThrowable(UserBitShared.ExceptionWrapper exceptionWrapper) { if (exceptionWrapper == null) { return null; } String className = exceptionWrapper.getExceptionClass(); if (StringUtils.isBlank(className) || exceptionWrapper.getStackTraceCount() < 1) { return null; } Throwable inner = getThrowable(exceptionWrapper.getCause()); try { Throwable throwable = getInstance(className, exceptionWrapper.getMessage(), inner); int size = exceptionWrapper.getStackTraceCount(); StackTraceElement[] stackTrace = new StackTraceElement[size]; for (int i = 0; i < size; ++i) { UserBitShared.StackTraceElementWrapper w = exceptionWrapper.getStackTrace(i); stackTrace[i] = new StackTraceElement(w.getClassName(), w.getMethodName(), w.getFileName(), w.getLineNumber()); } throwable.setStackTrace(stackTrace); return throwable; } catch (Throwable t) { return null; } }
/** * Recreate throwable from exception protoBuf which received from remote or local node. * if no match constructor found, the base Throwable (Exception or Error) is created as a substitution * * @param exceptionWrapper the exception protoBuf * @return Throwable deserialized from protoBuf */ public static Throwable getThrowable(UserBitShared.ExceptionWrapper exceptionWrapper) { if (exceptionWrapper == null) { return null; } String className = exceptionWrapper.getExceptionClass(); if (StringUtils.isBlank(className) || exceptionWrapper.getStackTraceCount() < 1) { return null; } Throwable inner = getThrowable(exceptionWrapper.getCause()); try { Throwable throwable = getInstance(className, exceptionWrapper.getMessage(), inner); int size = exceptionWrapper.getStackTraceCount(); StackTraceElement[] stackTrace = new StackTraceElement[size]; for (int i = 0; i < size; ++i) { UserBitShared.StackTraceElementWrapper w = exceptionWrapper.getStackTrace(i); stackTrace[i] = new StackTraceElement(w.getClassName(), w.getMethodName(), w.getFileName(), w.getLineNumber()); } throwable.setStackTrace(stackTrace); return throwable; } catch (Throwable t) { return null; } }
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper other) { if (other == org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper.getDefaultInstance()) return this; if (other.hasClassName()) { bitField0_ |= 0x00000001; className_ = other.className_; onChanged(); } if (other.hasFileName()) { bitField0_ |= 0x00000002; fileName_ = other.fileName_; onChanged(); } if (other.hasLineNumber()) { setLineNumber(other.getLineNumber()); } if (other.hasMethodName()) { bitField0_ |= 0x00000008; methodName_ = other.methodName_; onChanged(); } if (other.hasIsNativeMethod()) { setIsNativeMethod(other.getIsNativeMethod()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper message) throws java.io.IOException { if(message.hasClassName()) output.writeString(1, message.getClassName(), false); if(message.hasFileName()) output.writeString(2, message.getFileName(), false); if(message.hasLineNumber()) output.writeInt32(3, message.getLineNumber(), false); if(message.hasMethodName()) output.writeString(4, message.getMethodName(), false); if(message.hasIsNativeMethod()) output.writeBool(5, message.getIsNativeMethod(), false); } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper message)
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper other) { if (other == org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper.getDefaultInstance()) return this; if (other.hasClassName()) { bitField0_ |= 0x00000001; className_ = other.className_; onChanged(); } if (other.hasFileName()) { bitField0_ |= 0x00000002; fileName_ = other.fileName_; onChanged(); } if (other.hasLineNumber()) { setLineNumber(other.getLineNumber()); } if (other.hasMethodName()) { bitField0_ |= 0x00000008; methodName_ = other.methodName_; onChanged(); } if (other.hasIsNativeMethod()) { setIsNativeMethod(other.getIsNativeMethod()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper message) throws java.io.IOException { if(message.hasClassName()) output.writeString(1, message.getClassName(), false); if(message.hasFileName()) output.writeString(2, message.getFileName(), false); if(message.hasLineNumber()) output.writeInt32(3, message.getLineNumber(), false); if(message.hasMethodName()) output.writeString(4, message.getMethodName(), false); if(message.hasIsNativeMethod()) output.writeBool(5, message.getIsNativeMethod(), false); } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.StackTraceElementWrapper message)