Skip to content

Commit

Permalink
Don't swallow exceptions in EJB proxy method handler
Browse files Browse the repository at this point in the history
  • Loading branch information
nickarls committed Dec 3, 2009
1 parent 1ab1fef commit c78384b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -120,7 +120,7 @@ public Object invoke(Object self, Method method, Method proceed, Object[] args)
Class<?> businessInterface = getBusinessInterface(method);
Object proxiedInstance = reference.getBusinessObject(businessInterface);
Method proxiedMethod = Reflections.lookupMethod(method, proxiedInstance);
Object returnValue = Reflections.invokeAndWrap(proxiedMethod, proxiedInstance, args);
Object returnValue = Reflections.invoke(proxiedMethod, proxiedInstance, args);
log.trace(CALL_PROXIED_METHOD, method, proxiedInstance, args, returnValue);
return returnValue;
}
Expand Down
9 changes: 7 additions & 2 deletions impl/src/main/java/org/jboss/weld/util/Reflections.java
Expand Up @@ -536,8 +536,7 @@ public static Object invokeAndWrap(Method method, Object instance, Object... par
{
try
{
method.setAccessible(true);
return method.invoke(instance, parameters);
return invoke(method, instance, parameters);
}
catch (IllegalArgumentException e)
{
Expand All @@ -553,6 +552,12 @@ public static Object invokeAndWrap(Method method, Object instance, Object... par
}
}

public static Object invoke(Method method, Object instance, Object... parameters) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
ensureAccessible(method);
return method.invoke(instance, parameters);
}

public static Object invokeAndWrap(String methodName, Object instance, Object... parameters)
{
Class<?>[] parameterTypes = new Class<?>[parameters.length];
Expand Down

0 comments on commit c78384b

Please sign in to comment.