tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r796016 - /tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java
Date Mon, 20 Jul 2009 21:22:37 GMT
Author: markt
Date: Mon Jul 20 21:22:33 2009
New Revision: 796016

URL: http://svn.apache.org/viewvc?rev=796016&view=rev
Log:
Make sure the duplicateUri flag is reset each time a TLD file is parsed. This was causing
seemly random TCK failures depending on the order the tests were run in.

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java?rev=796016&r1=796015&r2=796016&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java Mon Jul 20 21:22:33 2009
@@ -88,7 +88,10 @@
      */
     public void addRuleInstances(Digester digester) {
 
+        // Note the sharing of state between rules
         TaglibUriRule taglibUriRule = new TaglibUriRule(); 
+
+        digester.addRule(prefix + "taglib", new TaglibRule(taglibUriRule));
         
         digester.addRule(prefix + "taglib/uri", taglibUriRule);
 
@@ -100,8 +103,26 @@
 
 }
 
+/*
+ * This rule only exists to reset the duplicateUri flag on the TaglibUriRule.
+ */
+final class TaglibRule extends Rule {
+    private final TaglibUriRule taglibUriRule;
+    
+    public TaglibRule(TaglibUriRule taglibUriRule) {
+        this.taglibUriRule = taglibUriRule;
+    }
+    
+    public void body(String namespace, String name, String text)
+    throws Exception {
+        taglibUriRule.setDuplicateUri(false);
+    }
+
+}
+
 final class TaglibUriRule extends Rule {
     
+    // This is set to false for each fiel processed by the TaglibRule
     private boolean duplicateUri;
     
     public TaglibUriRule() {
@@ -128,7 +149,6 @@
             }
         } else {
             // New URI. Add it to known list and carry on
-            duplicateUri = false;
             tldConfig.addTaglibUri(text);
         }
     }
@@ -136,6 +156,11 @@
     public boolean isDuplicateUri() {
         return duplicateUri;
     }
+
+    public void setDuplicateUri(boolean duplciateUri) {
+        this.duplicateUri = duplciateUri;
+    }
+
 }
 
 final class TaglibListenerRule extends Rule {



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


Mime
View raw message