You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/03/19 16:04:07 UTC

svn commit: r1579251 - in /tomcat/tc6.0.x/trunk: ./ java/org/apache/catalina/ java/org/apache/catalina/core/ java/org/apache/jasper/ java/org/apache/jasper/compiler/ webapps/docs/

Author: markt
Date: Wed Mar 19 15:04:07 2014
New Revision: 1579251

URL: http://svn.apache.org/r1579251
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56208
Restore validateXml option in Jasper.
Motivation: It is mentioned in documentation and some users complained on removal of this option in Tomcat 7, as that broke their build scripts.

Modified:
    tomcat/tc6.0.x/trunk/   (props changed)
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/Globals.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/Constants.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc6.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/tc7.0.x/trunk:r1570163

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Mar 19 15:04:07 2014
@@ -28,16 +28,6 @@ None
 PATCHES PROPOSED TO BACKPORT:
   [ New proposals should be added at the end of the list ]
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56208
-  Restore validateXml option in Jasper.
-  Motivation: It is mentioned in documentation and some users complained on
-  removal of this option in Tomcat 7, as that broke their build scripts.
-  (The r1564747 backport proposal above have to be applied first, as it
-  modified adjacent lines to this one)
-  http://svn.apache.org/r1570163
-  +1: kkolinko, markt, remm
-  -1:
-
 * Don't log to standard out in SSLValve.
   Simplify: s/new String("xxx")/"xxx"/
   http://svn.apache.org/r1081118

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/Globals.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/Globals.java?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/Globals.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/Globals.java Wed Mar 19 15:04:07 2014
@@ -364,6 +364,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/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java Wed Mar 19 15:04:07 2014
@@ -259,6 +259,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
@@ -291,6 +295,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/tc6.0.x/trunk/java/org/apache/jasper/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/Constants.java?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/Constants.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/Constants.java Wed Mar 19 15:04:07 2014
@@ -216,6 +216,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/tc6.0.x/trunk/java/org/apache/jasper/JspC.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/JspC.java Wed Mar 19 15:04:07 2014
@@ -124,6 +124,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";
@@ -146,6 +147,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;
@@ -357,6 +359,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)) {
@@ -854,6 +858,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/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspConfig.java Wed Mar 19 15:04:07 2014
@@ -89,7 +89,7 @@ public class JspConfig {
             ip.setSystemId(uri.toExternalForm());
 
             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/tc6.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java Wed Mar 19 15:04:07 2014
@@ -295,7 +295,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/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1579251&r1=1579250&r2=1579251&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Mar 19 15:04:07 2014
@@ -68,6 +68,12 @@
         Change the default behaviour of JspC to block XML external entities by
         default. (kkolinko) 
       </fix>
+      <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="Web applications">



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