/** * A string representation. */ public String toString() { String clazz = getClass().getName() + (type!=null ? "("+type.getName()+")" : ""); String msg = getLocalizedMessage(); return msg!=null ? clazz+": "+msg : clazz; } }
/** * Recreate the remote exception. */ public RemoteException recreateException() { RemoteException ret = new RemoteException(type, message); if(stacktrace!=null) { StackTraceElement[] stes = new StackTraceElement[stacktrace.size()]; for(int i=0; i<stes.length; i++) { Object[] tmp = (Object[])stacktrace.get(i); stes[i] = new StackTraceElement((String)tmp[0], (String)tmp[1], (String)tmp[2], ((Number)tmp[3]).intValue()); } ret.setStackTrace(stes); } return ret; }
/** * Get as string. */ public String toString() { return recreateException().toString(); } }
/** * Create a new exception info. */ public ExceptionInfo(Exception ex) { // ex.printStackTrace(); // todo: possibly add support for saving all nested causes. // Strip remote exception to conserve real exception this.type = ex instanceof RemoteException? ((RemoteException)ex).getType(): ex.getClass(); this.message = ex.getMessage(); StackTraceElement[] stes = ex.getStackTrace(); if(stes!=null) { for(int i=0; i<stes.length; i++) { addStackTrace(new Object[]{stes[i].getClassName(), stes[i].getMethodName(), stes[i].getFileName(), new Integer(stes[i].getLineNumber())}); } } }
/** * A string representation. */ public String toString() { String clazz = getClass().getName() + (type!=null ? "("+type.getName()+")" : ""); String msg = getLocalizedMessage(); return msg!=null ? clazz+": "+msg : clazz; } }