/** A helper to get a boolean property. */ protected static boolean getBoolean(String name, boolean defaultValue) { name = NestedThrowable.class.getName() + "." + name; String value = System.getProperty(name, String.valueOf(defaultValue)); // HACK see getLogger() for details Logger log = getLogger(); log.debug(name + "=" + value); return new Boolean(value).booleanValue(); }
/** * Check and possibly warn if the nested exception type is the same * as the parent type (duplicate nesting). */ public static void checkNested(final NestedThrowable parent, final Throwable child) { if (!DETECT_DUPLICATE_NESTING || parent == null || child == null) return; Class<?> parentType = parent.getClass(); Class<?> childType = child.getClass(); // // This might be backwards... I always get this confused // if (parentType.isAssignableFrom(childType)) { // HACK see getLogger() for details Logger log = getLogger(); log.warn("Duplicate throwable nesting of same base type: " + parentType + " is assignable from: " + childType); } }