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 2013/12/07 22:04:42 UTC
svn commit: r1548967 - in /tomcat/tc7.0.x/trunk: ./
java/org/apache/catalina/startup/ContextConfig.java
webapps/docs/changelog.xml
Author: markt
Date: Sat Dec 7 21:04:41 2013
New Revision: 1548967
URL: http://svn.apache.org/r1548967
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55811
Do not parse web-fragment.xml files when an empty absolute-ordering element is present.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1548966
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1548967&r1=1548966&r2=1548967&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java Sat Dec 7 21:04:41 2013
@@ -1258,7 +1258,7 @@ public class ContextConfig implements Li
// Step 1. Identify all the JARs packaged with the application
// If the JARs have a web-fragment.xml it will be parsed at this
// point.
- Map<String,WebXml> fragments = processJarsForWebFragments();
+ Map<String,WebXml> fragments = processJarsForWebFragments(webXml);
// Step 2. Order the fragments.
Set<WebXml> orderedFragments = null;
@@ -1939,10 +1939,21 @@ public class ContextConfig implements Li
*
* @return A map of JAR name to processed web fragment (if any)
*/
- protected Map<String,WebXml> processJarsForWebFragments() {
+ protected Map<String,WebXml> processJarsForWebFragments(WebXml application) {
JarScanner jarScanner = context.getJarScanner();
- FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
+
+ boolean parseRequired = true;
+ Set<String> absoluteOrder = application.getAbsoluteOrdering();
+ if (absoluteOrder != null && absoluteOrder.isEmpty() &&
+ !context.getXmlValidation()) {
+ // Skip parsing when there is an empty absolute ordering and
+ // validation is not enabled
+ parseRequired = false;
+ }
+
+ FragmentJarScannerCallback callback =
+ new FragmentJarScannerCallback(parseRequired);
jarScanner.scan(context.getServletContext(),
context.getLoader().getClassLoader(), callback,
@@ -2672,7 +2683,12 @@ public class ContextConfig implements Li
private static final String FRAGMENT_LOCATION =
"META-INF/web-fragment.xml";
private Map<String,WebXml> fragments = new HashMap<String,WebXml>();
+ private final boolean parseRequired;
+ public FragmentJarScannerCallback(boolean parseRequired) {
+ this.parseRequired = parseRequired;
+ }
+
@Override
public void scan(JarURLConnection jarConn) throws IOException {
@@ -2684,11 +2700,13 @@ public class ContextConfig implements Li
try {
jar = JarFactory.newInstance(url);
- is = jar.getInputStream(FRAGMENT_LOCATION);
+ if (parseRequired || context.getXmlValidation()) {
+ is = jar.getInputStream(FRAGMENT_LOCATION);
+ }
if (is == null) {
- // If there is no web.xml, normal JAR no impact on
- // distributable
+ // If there is no web-fragment.xml to process there is no
+ // impact on distributable
fragment.setDistributable(true);
} else {
InputSource source = new InputSource(
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=1548967&r1=1548966&r2=1548967&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sat Dec 7 21:04:41 2013
@@ -198,6 +198,11 @@
<bug>55804</bug>: If the GSSCredential for the cached Principal expires
when using SPNEGO authentication, force a re-authentication. (markt)
</fix>
+ <add>
+ <bug>55811</bug>: If the main web.xml contains an empty
+ absolute-ordering element and validation of web.xml is not enabled, skip
+ parsing any web-fragment.xml files as the result is never used. (markt)
+ </add>
<fix>
<bug>55839</bug>: Extend support for digest prefixes {MD5}, {SHA} and
{SSHA} to all Realms rather than just the JNDIRealm. (markt)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org