List of usage examples for java.lang.reflect InvocationTargetException getTargetException
public Throwable getTargetException()
From source file:org.bytesoft.bytetcc.supports.spring.SpringContainerContextImpl.java
public void cancel(CompensableInvocation invocation) throws RuntimeException { Method method = invocation.getMethod(); Object[] args = invocation.getArgs(); String beanName = invocation.getCancellableKey(); Object instance = this.applicationContext.getBean(beanName); try {/*w ww. j a va 2 s . c om*/ method.invoke(instance, args); } catch (InvocationTargetException itex) { throw new RuntimeException(itex.getTargetException()); } catch (RuntimeException rex) { throw rex; } catch (Throwable throwable) { throw new RuntimeException(throwable); } }
From source file:org.phprpc.spring.remoting.PHPRPC_ClientInterceptor.java
public Object invoke(MethodInvocation invocation) throws Throwable { if (phprpcProxy == null) { throw new IllegalStateException("PHPRPC_ClientInterceptor is not properly initialized - " + "invoke 'prepare' before attempting any operations"); }/*w ww . j a v a 2 s. c o m*/ try { return invocation.getMethod().invoke(phprpcProxy, invocation.getArguments()); } catch (InvocationTargetException ex) { throw ex.getTargetException(); } catch (Throwable ex) { throw new RemoteProxyFailureException( "Failed to invoke PHPRPC proxy for remote service [" + getServiceUrl() + "]", ex); } }
From source file:grails.plugin.quartz2.GrailsArtefactJob.java
public void execute(final JobExecutionContext context) throws JobExecutionException { try {/*from w w w. j a v a 2 s.c om*/ if (passExecutionContext) { executeMethod.invoke(job, context); } else { executeMethod.invoke(job); } } catch (InvocationTargetException ite) { Throwable targetException = ite.getTargetException(); if (targetException instanceof JobExecutionException) { throw (JobExecutionException) targetException; } else { throw new JobExecutionException(targetException); } } catch (IllegalAccessException iae) { JobExecutionException criticalError = new JobExecutionException( "Cannot invoke " + job.getClass().getName() + "#execute() method", iae); criticalError.setUnscheduleAllTriggers(true); throw criticalError; } }
From source file:com.ben12.openhab.model.util.BeanCopy.java
@Override public void set(final String name, final Object value) { try {// www. j av a2 s . co m final Object target = get(name); if (isCopyable(target)) { BeanUtils.copyProperties(wrap(target), value); } else { super.set(name, value); } } catch (final InvocationTargetException ite) { final Throwable cause = ite.getTargetException(); throw new IllegalArgumentException("Error setting property '" + name + "' nested exception - " + cause, ite); } catch (final Exception e) { throw new IllegalArgumentException("Error setting property '" + name + "', exception - " + e, e); } }
From source file:de.betterform.xml.xforms.action.UpdateSequencer.java
/** * Performs the next deferred update if any. * <p/>/*from w w w .j a va 2 s.c om*/ * The update method name is removed from the sequence of updates to be * deferred further. * * @return <code>true</code> if an deferred update has been performed, * otherwise <code>false</code>. * @throws Exception if any error occurred during the update. */ public boolean perform() throws Exception { this.updateRunning = false; if (this.updateSequence.size() > 0) { String name = this.updateSequence.removeFirst().toString(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("performing sequenced " + name + " level: " + this.updateSequence.size()); for (int i = 0; i < this.updateSequence.size(); i++) { LOGGER.debug("sequence " + i + " level: " + this.updateSequence.get(i)); } } try { this.model.getClass().getDeclaredMethod(name, (Class[]) null).invoke(this.model, (Object[]) null); } catch (InvocationTargetException e) { throw new Exception(e.getTargetException()); } return true; } return false; }
From source file:org.piraso.server.spring.remoting.HttpInvokerReflectionHelper.java
private Object invokeMethod(String name, Class<?>[] paramTypes, Object[] args) throws IOException { try {/*w ww. j av a2 s . c o m*/ Method method = findMethod(name, paramTypes); return method.invoke(instance, args); } catch (InvocationTargetException e) { if (RuntimeException.class.isInstance(e.getTargetException())) { throw (RuntimeException) e.getTargetException(); } else if (IOException.class.isInstance(e.getTargetException())) { throw (IOException) e.getTargetException(); } throw new HttpInvokerReflectionException(e); } catch (IllegalAccessException e) { throw new HttpInvokerReflectionException(e); } }
From source file:com.daveoxley.cbus.CGateException.java
/** * * @param response//from w w w .j a va2 s .c o m * @param e */ public CGateException(String response, Exception e) { super(response, e); String message = getMessage(); Throwable traced_exception = e; while (traced_exception instanceof InvocationTargetException) { InvocationTargetException ite = (InvocationTargetException) traced_exception; traced_exception = ite.getTargetException(); } if (traced_exception instanceof CGateException) return; StringWriter sw = new StringWriter(); PrintWriter pr = new PrintWriter(sw); printStackTrace(pr); message += new_line + new_line + sw.toString(); log.fatal(message); }
From source file:com.espertech.esper.dataflow.core.EPDataFlowEmitterExceptionHandler.java
public void handleException(Object targetObject, FastMethod fastMethod, InvocationTargetException ex, Object[] parameters) {//from w w w . j av a 2 s .com log.error("Exception encountered: " + ex.getTargetException().getMessage(), ex.getTargetException()); if (optionalExceptionHandler != null) { optionalExceptionHandler.handle(new EPDataFlowExceptionContext(dataFlowName, operatorName, operatorNumber, operatorPrettyPrint, ex.getTargetException())); } }
From source file:com.epam.reportportal.auth.DynamicAuthProvider.java
/** * Builds proxy instance of {@link RestTemplate} which load OAuth resouce details from DB on each operation * * @param name Name/ID of resource of {@link RestTemplate} * @param oauth2ClientContext OAuth Client context * @return Proxy instance of {@link RestTemplate} *//*w ww .ja va 2 s.c o m*/ public OAuth2RestOperations getRestTemplate(String name, OAuth2ClientContext oauth2ClientContext) { return newProxy(OAuth2RestOperations.class, (proxy, method, args) -> { try { return method.invoke(new OAuth2RestTemplate(loadResourceDetails(name), oauth2ClientContext), args); } catch (InvocationTargetException e) { throw e.getTargetException(); } }); }
From source file:org.openamf.invoker.SpringBeanInvoker.java
public Object invokeService() throws ServiceInvocationException { Class serviceClass = null;/*from w w w . j av a 2 s .c o m*/ Object service = null; Object serviceResult = null; try { service = this.getPersistentServiceObject(); if (service == null) { service = this.context.getBean(this.getRequest().getServiceName()); } serviceClass = service.getClass(); serviceResult = invokeServiceMethod(service, serviceClass, this.getRequest().getServiceMethodName(), this.getRequest().getParameters()); this.setPersistentServiceObject(service); } catch (InvocationTargetException e) { throw new ServiceInvocationException(request, e.getTargetException()); } catch (Exception e) { throw new ServiceInvocationException(request, e); } return serviceResult; }