Author: markt
Date: Tue Aug  3 16:16:15 2010
New Revision: 981951

URL: http://svn.apache.org/viewvc?rev=981951&view=rev
Log:
Add SKIP_IDENTIFIER_CHECK system property to control checking of EL expressions

Modified:
    tomcat/trunk/java/org/apache/el/util/Validation.java
    tomcat/trunk/webapps/docs/config/systemprops.xml

Modified: tomcat/trunk/java/org/apache/el/util/Validation.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/util/Validation.java?rev=981951&r1=981950&r2=981951&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/util/Validation.java (original)
+++ tomcat/trunk/java/org/apache/el/util/Validation.java Tue Aug  3 16:16:15 
2010
@@ -17,6 +17,9 @@
 
 package org.apache.el.util;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 public class Validation {
 
     // Java keywords, boolean literals & the null literal in alphabetical order
@@ -30,6 +33,30 @@ public class Validation {
         "throw", "throws", "transient", "true", "try", "void", "volatile",
         "while" };
     
+    private static final boolean IS_SECURITY_ENABLED =
+            (System.getSecurityManager() != null);
+
+    private static final boolean SKIP_IDENTIFIER_CHECK;
+
+    static {
+        if (IS_SECURITY_ENABLED) {
+            SKIP_IDENTIFIER_CHECK = AccessController.doPrivileged(
+                    new PrivilegedAction<Boolean>(){
+                        @Override
+                        public Boolean run() {
+                            return Boolean.valueOf(System.getProperty(
+                                    
"org.apache.el.parser.SKIP_IDENTIFIER_CHECK",
+                            "false"));
+                        }
+                    }
+            ).booleanValue();
+        } else {
+            SKIP_IDENTIFIER_CHECK = Boolean.valueOf(System.getProperty(
+                    "org.apache.el.parser.SKIP_IDENTIFIER_CHECK",
+            "false")).booleanValue();
+        }
+    }
+    
     
     private Validation() {
         // Utility class. Hide default constructor
@@ -40,6 +67,10 @@ public class Validation {
      */
     public static boolean isIdentifier(String key) {
         
+        if (SKIP_IDENTIFIER_CHECK) {
+            return true;
+        }
+
         // Should not be the case but check to be sure
         if (key == null || key.length() == 0) {
             return false;

Modified: tomcat/trunk/webapps/docs/config/systemprops.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=981951&r1=981950&r2=981951&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/trunk/webapps/docs/config/systemprops.xml Tue Aug  3 16:16:15 2010
@@ -73,6 +73,13 @@
       <code>true</code> will be used.</p>
     </property>
 
+    <property name="org.apache.el.parser.SKIP_IDENTIFIER_CHECK">
+      <p>If <code>true</code>, when parsing expressions, identifiers will not 
be
+      checked to ensure that they conform to the Java Language Specification 
for
+      Java identifiers. If not specified, the default value of
+      <code>false</code> will be used.</p>
+    </property>
+
   </properties>
 </section>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to