You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2004/06/03 23:16:56 UTC
cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils MappedPropertyDescriptor.java
rdonkin 2004/06/03 14:16:56
Modified: beanutils/src/java/org/apache/commons/beanutils
MappedPropertyDescriptor.java
Log:
Added catch block and workaround for security limited environments. Fix for bug #21618
Revision Changes Path
1.18 +24 -5 jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java
Index: MappedPropertyDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MappedPropertyDescriptor.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- MappedPropertyDescriptor.java 28 Feb 2004 13:18:33 -0000 1.17
+++ MappedPropertyDescriptor.java 3 Jun 2004 21:16:56 -0000 1.18
@@ -337,16 +337,35 @@
result = (Method[])
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- return fclz.getDeclaredMethods();
+ try{
+
+ return fclz.getDeclaredMethods();
+
+ } catch (SecurityException ex) {
+ // this means we're in a limited security environment
+ // so let's try going through the public methods
+ // and null those those that are not from the declaring
+ // class
+ Method[] methods = fclz.getMethods();
+ for (int i = 0, size = methods.length; i < size; i++) {
+ Method method = methods[i];
+ if (!(fclz.equals(method.getDeclaringClass()))) {
+ methods[i] = null;
+ }
+ }
+ return methods;
+ }
}
});
// Null out any non-public methods.
for (int i = 0; i < result.length; i++) {
Method method = result[i];
- int mods = method.getModifiers();
- if (!Modifier.isPublic(mods)) {
- result[i] = null;
+ if (method != null) {
+ int mods = method.getModifiers();
+ if (!Modifier.isPublic(mods)) {
+ result[i] = null;
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org