Code example for InvocationTargetException

Methods: getTargetException

            } catch (InstantiationException e) {
                throw new InstantiationError(e.getMessage());
            } catch (IllegalAccessException e) {
                throw new IllegalAccessError(e.getMessage());
            } catch (InvocationTargetException e) {
                Throwable ex = e.getTargetException();
                if(ex instanceof RuntimeException)
                    throw (RuntimeException)ex;
                if(ex instanceof Error)
                    throw (Error)ex;
                throw new Error(e);
            } catch (NoSuchMethodException e) {
                throw new NoSuchMethodError(e.getMessage());
        return o;
    public synchronized <T> void setTearOff(Class<T> type, T instance) {
        Map<Class,Object> m = tearOffs;
Connect your IDE to all the code out there  Get Codota for Java