diff options
author | Sven Gothel <[email protected]> | 2011-11-24 17:25:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-24 17:25:56 +0100 |
commit | 2bad18b9af99a7e073535e15f9cace6503625587 (patch) | |
tree | ef3f3fb19ce33ec969bad6d4a1f57b2fcadd5d16 /src | |
parent | 1467d813c86d2c7c3d2dfbbb94a872aeceffe331 (diff) |
ReflectionUtil: Catch NoClassDefFoundError @ getMethod() for robustness
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/common/util/ReflectionUtil.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/java/com/jogamp/common/util/ReflectionUtil.java b/src/java/com/jogamp/common/util/ReflectionUtil.java index c771544..db98d6e 100644 --- a/src/java/com/jogamp/common/util/ReflectionUtil.java +++ b/src/java/com/jogamp/common/util/ReflectionUtil.java @@ -274,11 +274,19 @@ public final class ReflectionUtil { 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; } /** |