public T run() { try { return getWrapper().newInstance(mRef); } catch (Exception e) { ThrowUnchecked.fire(e); return null; } } });
for (Class declaredType : declaredTypes) { if (declaredType.isInstance(cause)) { fire(cause); fireDeclaredCause(t, declaredTypes);
/** * Throws the cause of the given exception if it is unchecked or an * instance of any of the given declared types. Otherwise, it is thrown as * an UndeclaredThrowableException. If the cause is null, then the original * exception is thrown. This method only returns normally if the exception * is null. * * @param t exception whose cause is to be thrown * @param declaredTypes if exception is checked and is not an instance of * any of these types, then it is thrown as an * UndeclaredThrowableException. */ public static void fireDeclaredCause(Throwable t, Class... declaredTypes) { if (t != null) { Throwable cause = t.getCause(); if (cause == null) { cause = t; } fireDeclared(cause, declaredTypes); } }
private static Class<?>[] getCovariantTypes(BeanProperty property) { // Access via reflection since this is a feature not available in all // versions of Cojen. if (cCovariantTypesMethod != null) { try { return (Class[]) cCovariantTypesMethod.invoke(property, (Object[]) null); } catch (InvocationTargetException e) { ThrowUnchecked.fireDeclaredCause(e); } catch (IllegalAccessException e) { ThrowUnchecked.fireDeclared(e); } } return EMPTY_CLASSES_ARRAY; }
/** * Throws the root cause of the given exception, even though it may be * checked. If the root cause is null, then the original exception is * thrown. This method only returns normally if the exception is null. * * @param t exception whose root cause is to be thrown */ public static void fireRootCause(Throwable t) { org.cojen.util.ThrowUnchecked.fireRootCause(t); }
/** * Throws the cause of the given exception if it is unchecked or an * instance of any of the given declared types. Otherwise, it is thrown as * an UndeclaredThrowableException. If the cause is null, then the original * exception is thrown. This method only returns normally if the exception * is null. * * @param t exception whose cause is to be thrown * @param declaredTypes if exception is checked and is not an instance of * any of these types, then it is thrown as an * UndeclaredThrowableException. */ public static void fireDeclaredCause(Throwable t, Class... declaredTypes) { org.cojen.util.ThrowUnchecked.fireDeclaredCause(t, declaredTypes); }
/** * Throws the root cause of the given exception if it is unchecked or an * instance of any of the given declared types. Otherwise, it is thrown as * an UndeclaredThrowableException. If the root cause is null, then the * original exception is thrown. This method only returns normally if the * exception is null. * * @param t exception whose root cause is to be thrown * @param declaredTypes if exception is checked and is not an instance of * any of these types, then it is thrown as an * UndeclaredThrowableException. */ public static void fireDeclaredRootCause(Throwable t, Class... declaredTypes) { org.cojen.util.ThrowUnchecked.fireDeclaredRootCause(t, declaredTypes); }
/** * Throws the cause of the given exception, even though it may be * checked. If the cause is null, then the original exception is * thrown. This method only returns normally if the exception is null. * * @param t exception whose cause is to be thrown */ public static void fireCause(Throwable t) { org.cojen.util.ThrowUnchecked.fireCause(t); }
private static Class<?>[] getCovariantTypes(BeanProperty property) { // Access via reflection since this is a feature not available in all // versions of Cojen. if (cCovariantTypesMethod != null) { try { return (Class[]) cCovariantTypesMethod.invoke(property, (Object[]) null); } catch (InvocationTargetException e) { ThrowUnchecked.fireDeclaredCause(e); } catch (IllegalAccessException e) { ThrowUnchecked.fireDeclared(e); } } return EMPTY_CLASSES_ARRAY; }
propValue = m.invoke(value); } catch (Exception e) { ThrowUnchecked.fireRootCause(e); return null;
/** * Throws the cause of the given exception if it is unchecked or an * instance of any of the given declared types. Otherwise, it is thrown as * an UndeclaredThrowableException. If the cause is null, then the original * exception is thrown. This method only returns normally if the exception * is null. * * @param t exception whose cause is to be thrown * @param declaredTypes if exception is checked and is not an instance of * any of these types, then it is thrown as an * UndeclaredThrowableException. */ public static void fireDeclaredCause(Throwable t, Class... declaredTypes) { org.cojen.util.ThrowUnchecked.fireDeclaredCause(t, declaredTypes); }
impl.doFire(t);
/** * Throws the root cause of the given exception if it is unchecked or an * instance of any of the given declared types. Otherwise, it is thrown as * an UndeclaredThrowableException. If the root cause is null, then the * original exception is thrown. This method only returns normally if the * exception is null. * * @param t exception whose root cause is to be thrown * @param declaredTypes if exception is checked and is not an instance of * any of these types, then it is thrown as an * UndeclaredThrowableException. */ public static void fireDeclaredRootCause(Throwable t, Class... declaredTypes) { org.cojen.util.ThrowUnchecked.fireDeclaredRootCause(t, declaredTypes); }
/** * Throws the cause of the given exception, even though it may be * checked. If the cause is null, then the original exception is * thrown. This method only returns normally if the exception is null. * * @param t exception whose cause is to be thrown */ public static void fireCause(Throwable t) { org.cojen.util.ThrowUnchecked.fireCause(t); }
/** * Throws the cause of the given exception, even though it may be * checked. If the cause is null, then the original exception is * thrown. This method only returns normally if the exception is null. * * @param t exception whose cause is to be thrown */ public static void fireCause(Throwable t) { if (t != null) { Throwable cause = t.getCause(); if (cause == null) { cause = t; } fire(cause); } }
for (Class declaredType : declaredTypes) { if (declaredType.isInstance(cause)) { fire(cause); fireDeclaredCause(t, declaredTypes);
/** * Throws the root cause of the given exception if it is unchecked or an * instance of any of the given declared types. Otherwise, it is thrown as * an UndeclaredThrowableException. If the root cause is null, then the * original exception is thrown. This method only returns normally if the * exception is null. * * @param t exception whose root cause is to be thrown * @param declaredTypes if exception is checked and is not an instance of * any of these types, then it is thrown as an * UndeclaredThrowableException. */ public static void fireDeclaredRootCause(Throwable t, Class... declaredTypes) { Throwable root = t; while (root != null) { Throwable cause = root.getCause(); if (cause == null) { break; } root = cause; } fireDeclared(root, declaredTypes); }
/** * Throws the root cause of the given exception, even though it may be * checked. If the root cause is null, then the original exception is * thrown. This method only returns normally if the exception is null. * * @param t exception whose root cause is to be thrown */ public static void fireRootCause(Throwable t) { org.cojen.util.ThrowUnchecked.fireRootCause(t); }
/** * Returns a wrapper instance around the given delegate. * * @param delegate delegate to wrap * @throws IllegalArgumentException if delegate is null or arguments are * required * @throws UndeclaredThrowableException if constructor throws a checked exception */ public B wrap(D delegate) { if (delegate == null) { throw new IllegalArgumentException("Delegate is null"); } Constructor<B> ctor = mConstructor; if (ctor == null) { throw new IllegalArgumentException("Arguments are required"); } try { return ctor.newInstance(delegate); } catch (InstantiationException e) { throw new AssertionError(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException e) { ThrowUnchecked.fireDeclaredCause(e); throw null; } }