Skip to content

Commit

Permalink
ReflectionUtil: Catch NoClassDefFoundError @ getMethod() for robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
sgothel committed Nov 24, 2011
1 parent 1467d81 commit 2bad18b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/java/com/jogamp/common/util/ReflectionUtil.java
Expand Up @@ -274,11 +274,19 @@ public static boolean isAWTComponent(Class<?> clazz) {
public static final Method getMethod(Class<?> clazz, String methodName, Class<?> ... argTypes)
throws JogampRuntimeException, RuntimeException
{
Throwable t = null;
Method m = null;
try {
return clazz.getDeclaredMethod(methodName, argTypes);
} catch (NoSuchMethodException ex) {
throw new JogampRuntimeException("Method: '" + clazz + "." + methodName + "(" + asString(argTypes) + ")' not found", ex);
m = clazz.getDeclaredMethod(methodName, argTypes);
} catch (NoClassDefFoundError ex0) {
t = ex0;
} catch (NoSuchMethodException ex1) {
t = ex1;
}
if(null != t) {
throw new JogampRuntimeException("Method: '" + clazz + "." + methodName + "(" + asString(argTypes) + ")' not found", t);
}
return m;
}

/**
Expand Down

0 comments on commit 2bad18b

Please sign in to comment.