InvocationTargetException getCause - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for InvocationTargetException getCause method.

This code example shows how to use the following methods:getCause
    public T newInstance(Object[] args) throws Throwable {
        constructor.setAccessible(true);
        try { 
            return constructor.newInstance(args);
        } catch (InvocationTargetException e) {
            throw e.getCause();
        } 
    } 
 
    @Override 
    public String toString() {
        return constructor.toString();
    } 
} 
8
CodeRank
This code example shows how to use the following methods:getCause
mWebSettings_setDatabaseEnabled.invoke(e);
		   } 
		   catch (InvocationTargetException ite) {
	           /* unpack original exception when possible */ 
	           Throwable cause = ite.getCause();
	           if (cause instanceof IOException) {
	               throw (IOException) cause;
	           } else if (cause instanceof RuntimeException) {
	               throw (RuntimeException) cause;
	           } else if (cause instanceof Error) {
	               throw (Error) cause;
	           } else { 
	               /* unexpected checked exception; wrap and re-throw */ 
	               throw new RuntimeException(ite);
	           } 
	       } catch (IllegalAccessException ie) {
	           System.err.println("unexpected " + ie);
	       }	    
	   }	    
8
CodeRank
This code example shows how to use the following methods:getCause
        try { 
            methodInvoker.invoke(o, parameters);
        } catch (IllegalAccessException e) {
            throw new AssertionError(e); // a security manager is blocking us, we're hosed
        } catch (InvocationTargetException userException) {
            Throwable cause = userException.getCause() != null
                    ? userException.getCause()
                    : userException;
            errors.withSource(injectionPoint).errorInjectingMethod(cause);
        } 
    } 
} 
8
CodeRank
This code example shows how to use the following methods:getCause
    public T newInstance(Object[] args) throws Throwable {
        constructor.setAccessible(true);
        try { 
            return constructor.newInstance(args);
        } catch (InvocationTargetException e) {
            throw e.getCause();
        } 
    } 
 
    @Override 
    public String toString() {
        return constructor.toString();
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getCause
            membersInjector.injectMembers(t, errors, context);
            membersInjector.notifyListeners(t, errors);
 
            return t;
        } catch (InvocationTargetException userException) {
            Throwable cause = userException.getCause() != null
                    ? userException.getCause()
                    : userException;
            throw errors.withSource(constructionProxy.getInjectionPoint())
                    .errorInjectingConstructor(cause).toException();
        } finally { 
            constructionContext.removeCurrentReference();
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getCause
This code example shows how to use the following methods:getCause
 
			initialized = true;
		} catch (NoSuchMethodException e) {
			Logger.logError(e);
		} catch (InvocationTargetException e) {
			Logger.logError(e);
		} catch (IllegalAccessException e) {
			Logger.logError(e);
		} catch (ClassNotFoundException e) {
			Logger.logError(e);
			if (!foundCore) {
				Logger.logError("Can't find robocode.core-1.x.jar module near to robocode.jar"); 
				Logger.logError("Class path: " + System.getProperty("robocode.class.path", null));
			} 
			System.exit(-1);
		} catch (MalformedURLException e) {
			Logger.logError(e);
		} catch (Error e) {
			Logger.logError(e);
			throw e;

7
CodeRank
This code example shows how to use the following methods:getCause
    public Object processInvocation(final InterceptorContext context) throws Exception {
        final Object instance = context.getPrivateData(ComponentInstance.class).getInstance();
        try { 
            return method.invoke(instance, context.getPrivateData(PARAMETERS_KEY));
        } catch (InvocationTargetException e) {
            throw Interceptors.rethrow(e.getCause());
        } 
    } 
} 
8
CodeRank
This code example shows how to use the following methods:getCause
            if (!Modifier.isStatic(suiteMethod.getModifiers())) {
                throw new Exception(klass.getName() + ".suite() must be static");
            } 
            suite = (Test) suiteMethod.invoke(null); // static method
        } catch (InvocationTargetException e) {
            throw e.getCause();
        } 
        return suite;
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getCause
    protected Object handle(Method method, Object[] args) throws Throwable {
        try { 
            return method.invoke(this, args);
        } 
        catch (InvocationTargetException e) {
            throw e.getCause();
        } 
    } 
 
    public abstract int hashCode(); 
 
    @Override 
    public final Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (method.getDeclaringClass().equals(Object.class))
            return handle(method, args);
        return doInvoke(proxy, method, args);
    } 
} 
8
CodeRank
getCause Method Overview
Returns the cause of this exception (the thrown target exception, which may be null).
See Code Examples for other Java 8 InvocationTargetException Methods: