From 2bad18b9af99a7e073535e15f9cace6503625587 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 24 Nov 2011 17:25:56 +0100 Subject: ReflectionUtil: Catch NoClassDefFoundError @ getMethod() for robustness --- src/java/com/jogamp/common/util/ReflectionUtil.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/java/com') 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; } /** -- cgit v1.2.3