/** * Get a string representation of this exception. The representation will return an indication of the fact that * this was a remote exception, the remote exception type, and optionally details of the exception content, followed * by the exception message. * * @return the string representation of the exception */ public String toString() { final String toString = this.toString; if (toString == null) { final String message = getMessage(); StringBuilder b = new StringBuilder(); b.append(message == null ? CommonMessages.msg.remoteException(exceptionClassName) : CommonMessages.msg.remoteException(exceptionClassName, message)); Iterator<Map.Entry<String, String>> iterator = fields.entrySet().iterator(); if (iterator.hasNext()) { b.append("\n\tPublic fields:"); do { final Map.Entry<String, String> entry = iterator.next(); b.append('\n').append('\t').append('\t').append(entry.getKey()).append('=').append(entry.getValue()); } while (iterator.hasNext()); } return this.toString = b.toString(); } return toString; }
Object writeReplace() { final Throwable[] origSuppressed = getSuppressed(); final int length = origSuppressed.length; final RemoteExceptionCause[] suppressed; if (length == 0) { suppressed = NO_REMOTE_EXCEPTION_CAUSES; } else { suppressed = new RemoteExceptionCause[length]; for (int i = 0; i < length; i ++) { suppressed[i] = of(origSuppressed[i]); } } String[] fieldArray; final int size = fields.size(); if (size == 0) { fieldArray = NO_STRINGS; } else { fieldArray = new String[size << 1]; int i = 0; for (Map.Entry<String, String> entry : fields.entrySet()) { fieldArray[i++] = entry.getKey(); fieldArray[i++] = entry.getValue(); } } return new Serialized(getMessage(), exceptionClassName, of(getCause()), suppressed, getStackTrace(), fieldArray); }
private int writeToStream(DataOutput output, IdentityIntMap<Object> seen, HashMap<String, String> stringCache, int cnt) throws IOException { // register in cycle map seen.put(this, cnt++); // write the header byte output.writeByte(ST_NEW_EXCEPTION_CAUSE); // first write class name cnt = writeString(output, exceptionClassName, seen, stringCache, cnt); // null or message cnt = writeString(output, getMessage(), seen, stringCache, cnt); // stack trace cnt = writeStackTrace(output, getStackTrace(), seen, stringCache, cnt); // fields cnt = writeFields(output, fields, seen, stringCache, cnt); // caused-by cnt = writeThrowable(output, getCause(), seen, stringCache, cnt); // suppressed final Throwable[] suppressed = getSuppressed(); writePackedInt(output, suppressed.length); for (final Throwable t : suppressed) { cnt = writeThrowable(output, t, seen, stringCache, cnt); } return cnt; }
/** * Get a string representation of this exception. The representation will return an indication of the fact that * this was a remote exception, the remote exception type, and optionally details of the exception content, followed * by the exception message. * * @return the string representation of the exception */ public String toString() { final String toString = this.toString; if (toString == null) { final String message = getMessage(); StringBuilder b = new StringBuilder(); b.append(message == null ? CommonMessages.msg.remoteException(exceptionClassName) : CommonMessages.msg.remoteException(exceptionClassName, message)); Iterator<Map.Entry<String, String>> iterator = fields.entrySet().iterator(); if (iterator.hasNext()) { b.append("\n\tPublic fields:"); do { final Map.Entry<String, String> entry = iterator.next(); b.append('\n').append('\t').append('\t').append(entry.getKey()).append('=').append(entry.getValue()); } while (iterator.hasNext()); } return this.toString = b.toString(); } return toString; }
/** * Get a string representation of this exception. The representation will return an indication of the fact that * this was a remote exception, the remote exception type, and optionally details of the exception content, followed * by the exception message. * * @return the string representation of the exception */ public String toString() { final String toString = this.toString; if (toString == null) { final String message = getMessage(); StringBuilder b = new StringBuilder(); b.append(message == null ? CommonMessages.msg.remoteException(exceptionClassName) : CommonMessages.msg.remoteException(exceptionClassName, message)); Iterator<Map.Entry<String, String>> iterator = fields.entrySet().iterator(); if (iterator.hasNext()) { b.append("\n\tPublic fields:"); do { final Map.Entry<String, String> entry = iterator.next(); b.append('\n').append('\t').append('\t').append(entry.getKey()).append('=').append(entry.getValue()); } while (iterator.hasNext()); } return this.toString = b.toString(); } return toString; }
Object writeReplace() { final Throwable[] origSuppressed = getSuppressed(); final int length = origSuppressed.length; final RemoteExceptionCause[] suppressed; if (length == 0) { suppressed = NO_REMOTE_EXCEPTION_CAUSES; } else { suppressed = new RemoteExceptionCause[length]; for (int i = 0; i < length; i ++) { suppressed[i] = of(origSuppressed[i]); } } String[] fieldArray; final int size = fields.size(); if (size == 0) { fieldArray = NO_STRINGS; } else { fieldArray = new String[size << 1]; int i = 0; for (Map.Entry<String, String> entry : fields.entrySet()) { fieldArray[i++] = entry.getKey(); fieldArray[i++] = entry.getValue(); } } return new Serialized(getMessage(), exceptionClassName, of(getCause()), suppressed, getStackTrace(), fieldArray); }
Object writeReplace() { final Throwable[] origSuppressed = getSuppressed(); final int length = origSuppressed.length; final RemoteExceptionCause[] suppressed; if (length == 0) { suppressed = NO_REMOTE_EXCEPTION_CAUSES; } else { suppressed = new RemoteExceptionCause[length]; for (int i = 0; i < length; i ++) { suppressed[i] = of(origSuppressed[i]); } } String[] fieldArray; final int size = fields.size(); if (size == 0) { fieldArray = NO_STRINGS; } else { fieldArray = new String[size << 1]; int i = 0; for (Map.Entry<String, String> entry : fields.entrySet()) { fieldArray[i++] = entry.getKey(); fieldArray[i++] = entry.getValue(); } } return new Serialized(getMessage(), exceptionClassName, of(getCause()), suppressed, getStackTrace(), fieldArray); }
private int writeToStream(DataOutput output, IdentityIntMap<Object> seen, HashMap<String, String> stringCache, int cnt) throws IOException { // register in cycle map seen.put(this, cnt++); // write the header byte output.writeByte(ST_NEW_EXCEPTION_CAUSE); // first write class name cnt = writeString(output, exceptionClassName, seen, stringCache, cnt); // null or message cnt = writeString(output, getMessage(), seen, stringCache, cnt); // stack trace cnt = writeStackTrace(output, getStackTrace(), seen, stringCache, cnt); // fields cnt = writeFields(output, fields, seen, stringCache, cnt); // caused-by cnt = writeThrowable(output, getCause(), seen, stringCache, cnt); // suppressed final Throwable[] suppressed = getSuppressed(); writePackedInt(output, suppressed.length); for (final Throwable t : suppressed) { cnt = writeThrowable(output, t, seen, stringCache, cnt); } return cnt; }
private int writeToStream(DataOutput output, IdentityIntMap<Object> seen, HashMap<String, String> stringCache, int cnt) throws IOException { // register in cycle map seen.put(this, cnt++); // write the header byte output.writeByte(ST_NEW_EXCEPTION_CAUSE); // first write class name cnt = writeString(output, exceptionClassName, seen, stringCache, cnt); // null or message cnt = writeString(output, getMessage(), seen, stringCache, cnt); // stack trace cnt = writeStackTrace(output, getStackTrace(), seen, stringCache, cnt); // fields cnt = writeFields(output, fields, seen, stringCache, cnt); // caused-by cnt = writeThrowable(output, getCause(), seen, stringCache, cnt); // suppressed final Throwable[] suppressed = getSuppressed(); writePackedInt(output, suppressed.length); for (final Throwable t : suppressed) { cnt = writeThrowable(output, t, seen, stringCache, cnt); } return cnt; }