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 2009/01/31 09:25:14 UTC
svn commit: r739522 - in /tomcat/tc6.0.x/trunk: ./ STATUS.txt
java/org/apache/catalina/core/StandardContext.java
java/org/apache/catalina/startup/LocalStrings.properties
java/org/apache/catalina/startup/TldConfig.java webapps/docs/changelog.xml
Author: markt
Date: Sat Jan 31 08:25:13 2009
New Revision: 739522
URL: http://svn.apache.org/viewvc?rev=739522&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45933
Don't use xml parser from web-app to process tld files
Modified:
tomcat/tc6.0.x/trunk/ (props changed)
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc6.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 31 08:25:13 2009
@@ -1 +1 @@
-/tomcat/trunk:601180,606992,612607,630314,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,690781,691392,691805,692748,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729809,729815,729934,730250,732859
+/tomcat/trunk:601180,606992,612607,630314,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,690781,691392,691805,692748,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729809,729815,729934,730250,732859
Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=739522&r1=739521&r2=739522&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Jan 31 08:25:13 2009
@@ -89,15 +89,6 @@
0: not sure what to serialize here, don't see it as necessary
-1:
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45933
- Don't use xml parser from web-app to process tld files
- http://svn.apache.org/viewvc?rev=701355&view=rev
- +1: markt, funkman, fhanik
- -0: remm (it is a refactoring, and is not appropriate to me in 6.0.x)
- markt - It is a refactoring but the refactoring was necessary
- to change when TLDs were processed to avoid the bug. It
- isn't refactoring for the sake of refactoring.
-
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45403
See commit message for details of negligable performance impact
http://svn.apache.org/viewvc?rev=701358&view=rev
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=739522&r1=739521&r2=739522&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Sat Jan 31 08:25:13 2009
@@ -4268,10 +4268,6 @@
((Lifecycle) pipeline).start();
}
- if(getProcessTlds()) {
- processTlds();
- }
-
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(START_EVENT, null);
@@ -4442,39 +4438,6 @@
//cacheContext();
}
- /**
- * Processes TLDs.
- *
- * @throws LifecycleException If an error occurs
- */
- protected void processTlds() throws LifecycleException {
- TldConfig tldConfig = new TldConfig();
- tldConfig.setContext(this);
-
- // (1) check if the attribute has been defined
- // on the context element.
- tldConfig.setTldValidation(tldValidation);
- tldConfig.setTldNamespaceAware(tldNamespaceAware);
-
- // (2) if the attribute wasn't defined on the context
- // try the host.
- if (!tldValidation) {
- tldConfig.setTldValidation
- (((StandardHost) getParent()).getXmlValidation());
- }
-
- if (!tldNamespaceAware) {
- tldConfig.setTldNamespaceAware
- (((StandardHost) getParent()).getXmlNamespaceAware());
- }
-
- try {
- tldConfig.execute();
- } catch (Exception ex) {
- log.error("Error reading tld listeners "
- + ex.toString(), ex);
- }
- }
private void cacheContext() {
try {
@@ -5356,6 +5319,10 @@
return;
}
}
+ if (processTlds) {
+ this.addLifecycleListener(new TldConfig());
+ }
+
super.init();
// Notify our interested LifecycleListeners
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=739522&r1=739521&r2=739522&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties Sat Jan 31 08:25:13 2009
@@ -87,6 +87,8 @@
hostConfig.undeploy=Undeploying context [{0}]
hostConfig.undeploy.error=Error undeploying web application at context path {0}
hostConfig.undeploying=Undeploying deployed web applications
+tldConfig.cce=Lifecycle event data object {0} is not a Context
+tldConfig.execute=Error processing TLD files for context path {0}
userConfig.database=Exception loading user database
userConfig.deploy=Deploying web application for user {0}
userConfig.deploying=Deploying user web applications
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java?rev=739522&r1=739521&r2=739522&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/TldConfig.java Sat Jan 31 08:25:13 2009
@@ -48,20 +48,24 @@
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardHost;
import org.apache.catalina.util.StringManager;
import org.apache.tomcat.util.digester.Digester;
import org.xml.sax.InputSource;
/**
- * Startup event listener for a <b>Context</b> that configures the properties
- * of that Context, and the associated defined servlets.
+ * Startup event listener for a <b>Context</b> that configures application
+ * listeners configured in any TLD files.
*
* @author Craig R. McClanahan
* @author Jean-Francois Arcand
* @author Costin Manolache
*/
-public final class TldConfig {
+public final class TldConfig implements LifecycleListener {
// Names of JARs that are known not to contain any TLDs
private static HashSet<String> noTldJars;
@@ -393,20 +397,6 @@
}
/**
- * Create (if necessary) and return a Digester configured to process a tag
- * library descriptor, looking for additional listener classes to be
- * registered.
- */
- private static Digester createTldDigester() {
-
- return DigesterFactory.newDigester(tldValidation,
- tldNamespaceAware,
- new TldRuleSet());
-
- }
-
-
- /**
* Scan the JAR file at the specified resource path for TLDs in the
* <code>META-INF</code> subdirectory, and scan each TLD for application
* event listeners that need to be registered.
@@ -508,10 +498,6 @@
private void tldScanStream(InputSource resourceStream)
throws Exception {
- if (tldDigester == null){
- tldDigester = createTldDigester();
- }
-
synchronized (tldDigester) {
try {
tldDigester.push(this);
@@ -736,4 +722,51 @@
return jarPathMap;
}
+
+ public void lifecycleEvent(LifecycleEvent event) {
+ // Identify the context we are associated with
+ try {
+ context = (Context) event.getLifecycle();
+ } catch (ClassCastException e) {
+ log.error(sm.getString("tldConfig.cce", event.getLifecycle()), e);
+ return;
+ }
+
+ if (event.getType().equals(Lifecycle.INIT_EVENT)) {
+ init();
+ } else if (event.getType().equals(Lifecycle.START_EVENT)) {
+ try {
+ execute();
+ } catch (Exception e) {
+ log.error(sm.getString(
+ "tldConfig.execute", context.getPath()), e);
+ }
+ } // Ignore the other event types - nothing to do
+ }
+
+ private void init() {
+ if (tldDigester == null){
+ // (1) check if the attribute has been defined
+ // on the context element.
+ setTldValidation(context.getTldValidation());
+ setTldNamespaceAware(context.getTldNamespaceAware());
+
+ // (2) if the attribute wasn't defined on the context
+ // try the host.
+ if (!tldValidation) {
+ setTldValidation(
+ ((StandardHost) context.getParent()).getXmlValidation());
+ }
+
+ if (!tldNamespaceAware) {
+ setTldNamespaceAware(
+ ((StandardHost) context.getParent()).getXmlNamespaceAware());
+ }
+
+ tldDigester = DigesterFactory.newDigester(tldValidation,
+ tldNamespaceAware,
+ new TldRuleSet());
+ tldDigester.getParser();
+ }
+ }
}
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=739522&r1=739521&r2=739522&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sat Jan 31 08:25:13 2009
@@ -192,6 +192,10 @@
Correct handle multi-level contexts defined using context.xml files.
(markt)
</fix>
+ <fix>
+ <bug>45933</bug>: Don't use xml parser from web-app to process tld
+ files. (markt)
+ </fix>
<add>
<bug>45951</bug>: Support changing of JSESSIONID cookie name and
jsessionid path parameter name. Based on a patch by Jean-frederic Clere.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org