Revision: 1027
          http://stripes.svn.sourceforge.net/stripes/?rev=1027&view=rev
Author:   bengunter
Date:     2008-12-23 21:43:12 +0000 (Tue, 23 Dec 2008)

Log Message:
-----------
Fixed STS-620 the best I could. BootstrapPropertyResolver will catch 
AccessControlExceptions when getting property values and log a debug message 
telling what happened if it can't read the property. ResolverUtil has changed 
significantly since this problem was reported and does not appear to have the 
same problems as before. Aside from the two changes noted below, everything 
worked fine after this code change.

Stripes still requires java.lang.RuntimePermission "accessDeclaredMembers", 
which is not in the default catalina.policy. It needs that one to find the 
event handler methods in the ActionBean classes.

I also had to allow file read for WEB-INF/classes/logging.properties. That 
appears to be normal since there was already a template in the catalina.policy 
file for it.

Modified Paths:
--------------
    
trunk/stripes/src/net/sourceforge/stripes/config/BootstrapPropertyResolver.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/config/BootstrapPropertyResolver.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/config/BootstrapPropertyResolver.java 
    2008-12-23 19:37:56 UTC (rev 1026)
+++ 
trunk/stripes/src/net/sourceforge/stripes/config/BootstrapPropertyResolver.java 
    2008-12-23 21:43:12 UTC (rev 1027)
@@ -15,6 +15,7 @@
 package net.sourceforge.stripes.config;
 
 import java.lang.reflect.Modifier;
+import java.security.AccessControlException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -75,14 +76,34 @@
      * @return String the value of the configuration item or null
      */
     public String getProperty(String key) {
-        String value = this.filterConfig.getInitParameter(key);
+        String value = null;
 
+        try {
+            value = this.filterConfig.getInitParameter(key);
+        }
+        catch (AccessControlException e) {
+            log.debug("Security manager prevented " + getClass().getName()
+                    + " from reading filter init-param" + key);
+        }
+
         if (value == null) {
-            value = 
this.filterConfig.getServletContext().getInitParameter(key);
+            try {
+                value = 
this.filterConfig.getServletContext().getInitParameter(key);
+            }
+            catch (AccessControlException e) {
+                log.debug("Security manager prevented " + getClass().getName()
+                        + " from reading servlet context init-param" + key);
+            }
         }
 
         if (value == null) {
-            value = System.getProperty(key);
+            try {
+                value = System.getProperty(key);
+            }
+            catch (AccessControlException e) {
+                log.debug("Security manager prevented " + getClass().getName()
+                        + " from reading system property " + key);
+            }
         }
 
         return value;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to