From: markt
Date: Tue, 3 Aug 2010 16:16:15 +0000 (+0000)
Subject: Add SKIP_IDENTIFIER_CHECK system property to control checking of EL expressions
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=441f45e54a3cd41ebeadb4d9999522e3b175f2c9;p=tomcat7.0
Add SKIP_IDENTIFIER_CHECK system property to control checking of EL expressions
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@981951 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/java/org/apache/el/util/Validation.java b/java/org/apache/el/util/Validation.java
index b291fed11..152dc2e1c 100644
--- a/java/org/apache/el/util/Validation.java
+++ b/java/org/apache/el/util/Validation.java
@@ -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(){
+ @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;
diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml
index 344720cd8..9e33abee7 100644
--- a/webapps/docs/config/systemprops.xml
+++ b/webapps/docs/config/systemprops.xml
@@ -73,6 +73,13 @@
true will be used.
+
+ If true, 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
+ false will be used.
+
+