/** * 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 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)
/** * <code>optional string class_name = 1;</code> */ public Builder clearClassName() { bitField0_ = (bitField0_ & ~0x00000001); className_ = getDefaultInstance().getClassName(); onChanged(); 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)
/** * <code>optional string class_name = 1;</code> */ public Builder clearClassName() { bitField0_ = (bitField0_ & ~0x00000001); className_ = getDefaultInstance().getClassName(); onChanged(); return this; } /**