commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils MethodUtils.java
Date Fri, 09 May 2003 14:27:07 GMT
rdonkin     2003/05/09 07:27:06

  Modified:    beanutils/src/java/org/apache/commons/beanutils
                        MethodUtils.java
  Log:
  Now check for JVM version so that the warning message is only displayed when the JVm is
potentially vunerally. Also, improved the way the warning message is phrased. This is in response
to some users becoming confused by the previous message.
  
  Revision  Changes    Path
  1.20      +20 -2     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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- MethodUtils.java	15 Jan 2003 21:59:38 -0000	1.19
  +++ MethodUtils.java	9 May 2003 14:27:06 -0000	1.20
  @@ -580,8 +580,26 @@
               } catch (SecurityException se) {
                   // log but continue just in case the method.invoke works anyway
                   if (!loggedAccessibleWarning) {
  -                    log.warn(
  -                        "Cannot use JVM pre-1.4 access bug workaround die to restrictive
security manager.");
  +                    boolean vunerableJVM = false;
  +                    try {
  +                        String specVersion = System.getProperty("java.specification.version");
  +                        if (specVersion.charAt(0) == '1' && 
  +                                (specVersion.charAt(0) == '0' ||
  +                                 specVersion.charAt(0) == '1' ||
  +                                 specVersion.charAt(0) == '2' ||
  +                                 specVersion.charAt(0) == '3')) {
  +                                 
  +                            vunerableJVM = true;
  +                        }
  +                    } catch (SecurityException e) {
  +                        // don't know - so display warning
  +                        vunerableJVM = true;
  +                    }
  +                    if (vunerableJVM) {
  +                        log.warn(
  +                            "Current Security Manager restricts use of workarounds for
reflection bugs "
  +                            + " in pre-1.4 JVMs.");
  +                    }
                       loggedAccessibleWarning = true;
                   }
                   log.debug(
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message