Author: markt
Date: Thu Feb 20 11:55:22 2014
New Revision: 1570163

URL: http://svn.apache.org/r1570163
Log:
Restore the validateXml option to Jasper that was previously renamed 
validateTld. Both options are now supported. validateXml controls the 
validation of web.xml files when Jasper parses them and validateTld controls 
the validation of *.tld files when Jasper parses them.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/Globals.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/JspC.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/Globals.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/Globals.java?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/Globals.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/Globals.java Thu Feb 20 
11:55:22 2014
@@ -334,6 +334,16 @@ public final class Globals {
 
     /**
      * Name of the ServletContext init-param that determines if the JSP engine
+     * should validate web.xml files when parsing them.
+     * <p>
+     * This must be kept in sync with org.apache.jasper.Constants
+     */
+    public static final String JASPER_XML_VALIDATION_INIT_PARAM =
+            "org.apache.jasper.XML_VALIDATE";
+
+
+    /**
+     * Name of the ServletContext init-param that determines if the JSP engine
      * will block external entities from being used in *.tld, *.jspx, *.tagx 
and
      * tagplugin.xml files.
      * <p>

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java 
Thu Feb 20 11:55:22 2014
@@ -324,6 +324,10 @@ public class ApplicationContext
                 context.getTldValidation()) {
             return "true";
         }
+        if (Globals.JASPER_XML_VALIDATION_INIT_PARAM.equals(name) &&
+                context.getXmlValidation()) {
+            return "true";
+        }
         if (Globals.JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM.equals(name)) {
             if (!context.getXmlBlockExternal()) {
                 // System admin has explicitly changed the default
@@ -347,6 +351,9 @@ public class ApplicationContext
         if (context.getTldValidation()) {
             names.add(Globals.JASPER_XML_VALIDATION_TLD_INIT_PARAM);
         }
+        if (context.getXmlValidation()) {
+            names.add(Globals.JASPER_XML_VALIDATION_INIT_PARAM);
+        }
         if (!context.getXmlBlockExternal()) {
             names.add(Globals.JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM);
         }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java Thu Feb 20 
11:55:22 2014
@@ -244,6 +244,15 @@ public class Constants {
 
     /**
      * Name of the ServletContext init-param that determines if the XML parsers
+     * used for web.xml files will be validating or not.
+     * <p>
+     * This must be kept in sync with org.apache.catalina.Globals
+     */
+    public static final String XML_VALIDATION_INIT_PARAM =
+            "org.apache.jasper.XML_VALIDATE";
+
+    /**
+     * Name of the ServletContext init-param that determines if the XML parsers
      * will block the resolution of external entities.
      * <p>
      * This must be kept in sync with org.apache.catalina.Globals

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/JspC.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/JspC.java?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/JspC.java Thu Feb 20 11:55:22 
2014
@@ -127,6 +127,7 @@ public class JspC extends Task implement
     protected static final String SWITCH_SMAP = "-smap";
     protected static final String SWITCH_DUMP_SMAP = "-dumpsmap";
     protected static final String SWITCH_VALIDATE_TLD = "-validateTld";
+    protected static final String SWITCH_VALIDATE_XML = "-validateXml";
     protected static final String SWITCH_BLOCK_EXTERNAL = "-blockExternal";
     protected static final String SWITCH_NO_BLOCK_EXTERNAL = 
"-no-blockExternal";
     protected static final String SHOW_SUCCESS ="-s";
@@ -160,6 +161,7 @@ public class JspC extends Task implement
     protected boolean trimSpaces = false;
     protected boolean genStringAsCharArray = false;
     protected boolean validateTld;
+    protected boolean validateXml;
     protected boolean blockExternal = true;
     protected boolean xpoweredBy;
     protected boolean mappedFile = false;
@@ -370,6 +372,8 @@ public class JspC extends Task implement
                 smapDumped = true;
             } else if (tok.equals(SWITCH_VALIDATE_TLD)) {
                 setValidateTld(true);
+            } else if (tok.equals(SWITCH_VALIDATE_XML)) {
+                setValidateXml(true);
             } else if (tok.equals(SWITCH_BLOCK_EXTERNAL)) {
                 setBlockExternal(true);
             } else if (tok.equals(SWITCH_NO_BLOCK_EXTERNAL)) {
@@ -861,6 +865,14 @@ public class JspC extends Task implement
         return validateTld;
     }
 
+    public void setValidateXml( boolean b ) {
+        this.validateXml = b;
+    }
+
+    public boolean isValidateXml() {
+        return validateXml;
+    }
+
     public void setBlockExternal( boolean b ) {
         this.blockExternal = b;
     }
@@ -1450,6 +1462,9 @@ public class JspC extends Task implement
         if (isValidateTld()) {
             context.setInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM, 
"true");
         }
+        if (isValidateXml()) {
+            context.setInitParameter(Constants.XML_VALIDATION_INIT_PARAM, 
"true");
+        }
         context.setInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM,
                 String.valueOf(isBlockExternal()));
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java Thu Feb 
20 11:55:22 2014
@@ -79,7 +79,7 @@ public class JspConfig {
             webXml = new WebXml(ctxt);
             
             boolean validate = Boolean.parseBoolean(
-                    
ctxt.getInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM));
+                    
ctxt.getInitParameter(Constants.XML_VALIDATION_INIT_PARAM));
             String blockExternalString =
                     
ctxt.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
             boolean blockExternal;

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java 
Thu Feb 20 11:55:22 2014
@@ -288,7 +288,7 @@ public class TldLocationsCache {
 
             boolean validate = Boolean.parseBoolean(
                     ctxt.getInitParameter(
-                            Constants.XML_VALIDATION_TLD_INIT_PARAM));
+                            Constants.XML_VALIDATION_INIT_PARAM));
             String blockExternalString = ctxt.getInitParameter(
                     Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
             boolean blockExternal;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1570163&r1=1570162&r2=1570163&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Feb 20 11:55:22 2014
@@ -70,6 +70,16 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        Restore the validateXml option to Jasper that was previously renamed
+        validateTld. Both options are now supported. validateXml controls the
+        validation of web.xml files when Jasper parses them and validateTld
+        controls the validation of *.tld files when Jasper parses them. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="WebSocket">
     <changelog>
       <fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to