DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21618>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21618

MappedPropertyDescriptor requires more permissions than necessary





------- Additional Comments From [EMAIL PROTECTED]  2003-10-06 16:25 -------
I was just about to report a similar problem (and the same solution!) when I 
found this report. In my case, I wanted to use BeanUtils in a sandboxed Java 
Web Start environment.

I patched MappedPropertyDescriptor.getPublicDeclaredMethods() as follows, which 
fixed the problem for me:

    private static synchronized Method[] getPublicDeclaredMethods(Class clz) {
        // Looking up Class.getMethods is relatively expensive,
        // so we cache the results.
        final Class fclz = clz;
        Method[] result = (Method[]) declaredMethodCache.get(fclz);
        if (result != null) {
            return result;
        }

        // We have to raise privilege for getMethods
        result =
            (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                return fclz.getMethods();
            }
        });

        // Null out any methods not belonging to us
        for (int i = 0; i < result.length; i++) {
            Method method = result[i];
            Class declClass = method.getDeclaringClass();
            if (declClass != fclz) {
                result[i] = null;
            }
        }

        // Add it to the cache.
        declaredMethodCache.put(clz, result);
        return result;
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to