Commits

Anonymous committed d80cf14

XW-647 make Enum.values() accessable by ognl default

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1841e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 0f82e75

Comments (0)

Files changed (1)

File src/java/com/opensymphony/xwork2/ognl/StaticMemberAccess.java

 public class StaticMemberAccess extends DefaultMemberAccess {
 
     private boolean allowStaticMethodAccess;
-    
+
     public StaticMemberAccess(boolean method) {
         super(false);
         allowStaticMethodAccess = method;
 
     @Override
     public boolean isAccessible(Map context, Object target, Member member,
-            String propertyName) {
-        
+                                String propertyName) {
+
         boolean allow = true;
         int modifiers = member.getModifiers();
         if (Modifier.isStatic(modifiers)) {
             if (member instanceof Method && !getAllowStaticMethodAccess()) {
                 allow = false;
+                if (target instanceof Class) {
+                    Class clazz = (Class) target;
+                    Method method = (Method) member;
+                    if (Enum.class.isAssignableFrom(clazz) && method.getName().equals("values"))
+                        allow = true;
+                }
             }
         }
-        
+
         // Now check for standard scope rules
         if (allow) {
             return super.isAccessible(context, target, member, propertyName);
         }
-        
+
         return false;
     }
-    
-    
-    
-    
+
 
 }