/** * Convert this remote exception cause to a plain throwable for sending to peers which use serialization and do not * have this class present. Note that this does not recursively apply; normally, a serialization framework will * handle the recursive application of this operation through object resolution. * * @return the throwable (not {@code null}) */ public Throwable toPlainThrowable() { final Throwable throwable = new Throwable(toString(), getCause()); throwable.setStackTrace(getStackTrace()); for (Throwable s : getSuppressed()) { throwable.addSuppressed(s); } return throwable; }
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; }
/** * Convert this remote exception cause to a plain throwable for sending to peers which use serialization and do not * have this class present. Note that this does not recursively apply; normally, a serialization framework will * handle the recursive application of this operation through object resolution. * * @return the throwable (not {@code null}) */ public Throwable toPlainThrowable() { final Throwable throwable = new Throwable(toString(), getCause()); throwable.setStackTrace(getStackTrace()); for (Throwable s : getSuppressed()) { throwable.addSuppressed(s); } return throwable; }
/** * Convert this remote exception cause to a plain throwable for sending to peers which use serialization and do not * have this class present. Note that this does not recursively apply; normally, a serialization framework will * handle the recursive application of this operation through object resolution. * * @return the throwable (not {@code null}) */ public Throwable toPlainThrowable() { final Throwable throwable = new Throwable(toString(), getCause()); throwable.setStackTrace(getStackTrace()); for (Throwable s : getSuppressed()) { throwable.addSuppressed(s); } return throwable; }
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; }