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 2002/11/19 22:51:06 UTC
cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils MethodUtils.java
rdonkin 2002/11/19 13:51:06
Modified: beanutils/src/java/org/apache/commons/beanutils
MethodUtils.java
Log:
Added code to prevent excessive logging at warn level when running in restrictive security environment (bug #14394).
Revision Changes Path
1.16 +18 -6 jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MethodUtils.java
Index: MethodUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MethodUtils.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- MethodUtils.java 25 Oct 2002 00:21:01 -0000 1.15
+++ MethodUtils.java 19 Nov 2002 21:51:06 -0000 1.16
@@ -101,6 +101,8 @@
* All logging goes through this logger
*/
private static Log log = LogFactory.getLog(MethodUtils.class);
+ /** Only log warning about accessibility work around once */
+ private static boolean loggedAccessibleWarning = false;
/** An empty class array */
private static final Class[] emptyClassArray = new Class[0];
@@ -577,9 +579,14 @@
} catch (SecurityException se) {
// log but continue just in case the method.invoke works anyway
- log.warn(
- "Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.",
- se);
+ if (!loggedAccessibleWarning) {
+ log.warn(
+ "Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.");
+ loggedAccessibleWarning = true;
+ }
+ log.debug(
+ "Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.",
+ se);
}
return method;
@@ -633,9 +640,14 @@
} catch (SecurityException se) {
// log but continue just in case the method.invoke works anyway
- log.warn(
- "Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.",
- se);
+ if (!loggedAccessibleWarning) {
+ log.warn(
+ "Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.");
+ loggedAccessibleWarning = true;
+ }
+ log.debug(
+ "Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.",
+ se);
}
return method;
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>