diff --git a/src/java/ognl/OgnlRuntime.java b/src/java/ognl/OgnlRuntime.java index 272dcec3..153b03b6 100644 --- a/src/java/ognl/OgnlRuntime.java +++ b/src/java/ognl/OgnlRuntime.java @@ -2174,7 +2174,12 @@ public static Map getMethods(Class targetClass, boolean staticMethods) } private static void collectMethods(Class c, Map result, boolean staticMethods) { - Method[] ma = c.getDeclaredMethods(); + Method[] ma; + try { + ma = c.getDeclaredMethods(); + } catch (SecurityException ignored) { + ma = c.getMethods(); + } for (int i = 0, icount = ma.length; i < icount; i++) { if (c.isInterface()) @@ -2304,7 +2309,11 @@ public static Map getFields(Class targetClass) Field fa[]; result = new HashMap(23); - fa = targetClass.getDeclaredFields(); + try { + fa = targetClass.getDeclaredFields(); + } catch (SecurityException ignored) { + fa = targetClass.getFields(); + } for (int i = 0; i < fa.length; i++) { result.put(fa[i].getName(), fa[i]); } @@ -2602,7 +2611,12 @@ public static List getDeclaredMethods(Class targetClass, String propertyName, bo private static void collectAccessors(Class c, String baseName, List result, boolean findSets) { - final Method[] methods = c.getDeclaredMethods(); + Method[] methods; + try { + methods = c.getDeclaredMethods(); + } catch (SecurityException ignored) { + methods = c.getMethods(); + } for (int i = 0; i < methods.length; i++) { if (c.isInterface()) { if (isDefaultMethod(methods[i]) || isNonDefaultPublicInterfaceMethod(methods[i])) {