public String toString() { return Exceptions.toString(this); }
public void printStackTrace(PrintWriter out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(_fatal); out.writeObject(Exceptions.replaceFailedObject(_failed)); out.writeObject(Exceptions.replaceNestedThrowables(_nested)); }
/** * Convert the specified failed object into a serializable * object for when we are serializing an Exception. It will * try the following: * <ul> * <li>if the object can be serialized, return the object itself</li> * <li>if the object has a serializable oid, return the oid</li> * <li>if the object has a non-serializable oid, return the oid's * toString and the object class</li> * <li>return the object's toString</li> * </ul> * * @param ob the object to convert * @return some serialized representation of the object */ public static Object replaceFailedObject(Object ob) { if (ob == null) return null; if (isSerializable(ob)) return ob; // don't take oid of new objects since it can cause a flush if auto-inc // and the id is meaningless anyway Object oid = getObjectId(ob); if (oid != null && isSerializable(oid)) return oid; // last ditch: stringify the object return toString(ob); }
public static String toClassName(Class<?> cls) { if (cls == null) return ""; if (cls.isArray()) return toClassName(cls.getComponentType())+"[]"; return cls.getName(); }
/** * Convert the specified throwables into a serialzable array. If * any of the nested throwables cannot be serialized, they will * be converted into a Exception with the original message. */ public static Throwable[] replaceNestedThrowables(Throwable[] nested) { if (nested == null || nested.length == 0) return nested; if (isSerializable(nested)) return nested; Throwable[] newNested = new Throwable[nested.length]; for (int i = 0; i < nested.length; i++) { if (isSerializable(nested[i])) newNested[i] = nested[i]; else // guard against a nasty null in the array by using valueOf // instead of toString to prevent throwing yet another // exception newNested[i] = new Exception(String.valueOf(nested[i])); } return newNested; }
Object oid = getObjectId(ob);
Message msg = _loc.get("runtime-optimization-disabled", Exceptions.toClassNames(unenhanced)); if (conf.getRuntimeUnenhancedClassesConstant() == RuntimeUnenhancedClassesModes.WARN) { log.warn(msg); throw new UserException(_loc.get("unspecified-unenhanced-types", Exceptions.toClassNames(classes), unspecified));
/** * Convert the specified failed object into a serializable * object for when we are serializing an Exception. It will * try the following: * <ul> * <li>if the object can be serialized, return the object itself</li> * <li>if the object has a serializable oid, return the oid</li> * <li>if the object has a non-serializable oid, return the oid's * toString and the object class</li> * <li>return the object's toString</li> * </ul> * * @param ob the object to convert * @return some serialized representation of the object */ public static Object replaceFailedObject(Object ob) { if (ob == null) return null; if (isSerializable(ob)) return ob; // don't take oid of new objects since it can cause a flush if auto-inc // and the id is meaningless anyway Object oid = getObjectId(ob); if (oid != null && isSerializable(oid)) return oid; // last ditch: stringify the object return toString(ob); }
public static String toClassName(Class<?> cls) { if (cls == null) return ""; if (cls.isArray()) return toClassName(cls.getComponentType())+"[]"; return cls.getName(); }
/** * Convert the specified throwables into a serialzable array. If * any of the nested throwables cannot be serialized, they will * be converted into a Exception with the original message. */ public static Throwable[] replaceNestedThrowables(Throwable[] nested) { if (nested == null || nested.length == 0) return nested; if (isSerializable(nested)) return nested; Throwable[] newNested = new Throwable[nested.length]; for (int i = 0; i < nested.length; i++) { if (isSerializable(nested[i])) newNested[i] = nested[i]; else // guard against a nasty null in the array by using valueOf // instead of toString to prevent throwing yet another // exception newNested[i] = new Exception(String.valueOf(nested[i])); } return newNested; }
Object oid = getObjectId(ob);
Message msg = _loc.get("runtime-optimization-disabled", Exceptions.toClassNames(unenhanced)); if (conf.getRuntimeUnenhancedClassesConstant() == RuntimeUnenhancedClassesModes.WARN) { log.warn(msg); throw new UserException(_loc.get("unspecified-unenhanced-types", Exceptions.toClassNames(classes), unspecified));
private void writeObject(ObjectOutputStream out) throws IOException { out.writeBoolean(_fatal); out.writeObject(Exceptions.replaceFailedObject(_failed)); out.writeObject(Exceptions.replaceNestedThrowables(_nested)); }
public String toString() { return Exceptions.toString(this); }
/** * Convert the specified failed object into a serializable * object for when we are serializing an Exception. It will * try the following: * <ul> * <li>if the object can be serialized, return the object itself</li> * <li>if the object has a serializable oid, return the oid</li> * <li>if the object has a non-serializable oid, return the oid's * toString and the object class</li> * <li>return the object's toString</li> * </ul> * * @param ob the object to convert * @return some serialized representation of the object */ public static Object replaceFailedObject(Object ob) { if (ob == null) return null; if (isSerializable(ob)) return ob; // don't take oid of new objects since it can cause a flush if auto-inc // and the id is meaningless anyway Object oid = getObjectId(ob); if (oid != null && isSerializable(oid)) return oid; // last ditch: stringify the object return toString(ob); }
public void printStackTrace(PrintStream out) { super.printStackTrace(out); Exceptions.printNestedThrowables(this, out); }
public static String toClassName(Class<?> cls) { if (cls == null) return ""; if (cls.isArray()) return toClassName(cls.getComponentType())+"[]"; return cls.getName(); }
/** * Convert the specified throwables into a serialzable array. If * any of the nested throwables cannot be serialized, they will * be converted into a Exception with the original message. */ public static Throwable[] replaceNestedThrowables(Throwable[] nested) { if (nested == null || nested.length == 0) return nested; if (isSerializable(nested)) return nested; Throwable[] newNested = new Throwable[nested.length]; for (int i = 0; i < nested.length; i++) { if (isSerializable(nested[i])) newNested[i] = nested[i]; else // guard against a nasty null in the array by using valueOf // instead of toString to prevent throwing yet another // exception newNested[i] = new Exception(String.valueOf(nested[i])); } return newNested; }