Created
April 19, 2011 14:34
-
-
Save anpieber/928064 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected Object invoke(Exchange exchange, final Object serviceObject, Method m, List<Object> params) { | |
| Object res; | |
| try { | |
| Object[] paramArray = new Object[]{}; | |
| if (params != null) { | |
| paramArray = params.toArray(); | |
| } | |
| res = performInvocation(exchange, serviceObject, m, paramArray); | |
| if (exchange.isOneWay()) { | |
| return null; | |
| } | |
| return new MessageContentsList(res); | |
| } catch (InvocationTargetException e) { | |
| Throwable t = e.getCause(); | |
| if (t == null) { | |
| t = e; | |
| } | |
| checkSuspendedInvocation(exchange, serviceObject, m, params, t); | |
| exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); | |
| for (Class<?> cl : m.getExceptionTypes()) { | |
| if (cl.isInstance(t)) { | |
| exchange.getInMessage().put(FaultMode.class, | |
| FaultMode.CHECKED_APPLICATION_FAULT); | |
| } | |
| } | |
| if (t instanceof Fault) { | |
| exchange.getInMessage().put(FaultMode.class, | |
| FaultMode.CHECKED_APPLICATION_FAULT); | |
| throw (Fault)t; | |
| } | |
| throw createFault(t, m, params, true); | |
| } catch (SuspendedInvocationException suspendedEx) { | |
| // to avoid duplicating the same log statement | |
| checkSuspendedInvocation(exchange, serviceObject, m, params, suspendedEx); | |
| // unreachable | |
| throw suspendedEx; | |
| } catch (Fault f) { | |
| exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); | |
| throw f; | |
| } catch (Exception e) { | |
| checkSuspendedInvocation(exchange, serviceObject, m, params, e); | |
| exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); | |
| throw createFault(e, m, params, false); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment