commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1301177 - /commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java
Date Thu, 15 Mar 2012 20:09:32 GMT
Author: simonetripodi
Date: Thu Mar 15 20:09:31 2012
New Revision: 1301177

URL: http://svn.apache.org/viewvc?rev=1301177&view=rev
Log:
potential fix for [DIGESTER-163]

Modified:
    commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java

Modified: commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java?rev=1301177&r1=1301176&r2=1301177&view=diff
==============================================================================
--- commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java
(original)
+++ commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java
Thu Mar 15 20:09:31 2012
@@ -28,26 +28,26 @@ public abstract class AbstractRulesModul
     implements RulesModule
 {
 
-    private RulesBinder rulesBinder;
+    private final ThreadLocal<RulesBinder> rulesBinders = new ThreadLocal<RulesBinder>();
 
     /**
      * {@inheritDoc}
      */
     public final void configure( RulesBinder rulesBinder )
     {
-        if ( this.rulesBinder != null )
+        if ( rulesBinders.get() != null )
         {
             throw new IllegalStateException( "Re-entry is not allowed." );
         }
 
-        this.rulesBinder = rulesBinder;
+        rulesBinders.set( rulesBinder );
         try
         {
             configure();
         }
         finally
         {
-            this.rulesBinder = null;
+            rulesBinders.remove();
         }
     }
 
@@ -68,7 +68,7 @@ public abstract class AbstractRulesModul
      */
     protected void addError( String messagePattern, Object... arguments )
     {
-        rulesBinder.addError( messagePattern, arguments );
+        rulesBinders.get().addError( messagePattern, arguments );
     }
 
     /**
@@ -80,7 +80,7 @@ public abstract class AbstractRulesModul
      */
     protected void addError( Throwable t )
     {
-        rulesBinder.addError( t );
+        rulesBinders.get().addError( t );
     }
 
     /**
@@ -91,7 +91,7 @@ public abstract class AbstractRulesModul
      */
     protected void install( RulesModule rulesModule )
     {
-        rulesBinder.install( rulesModule );
+        rulesBinders.get().install( rulesModule );
     }
 
     /**
@@ -103,7 +103,7 @@ public abstract class AbstractRulesModul
      */
     protected LinkedRuleBuilder forPattern( String pattern )
     {
-        return rulesBinder.forPattern( pattern );
+        return rulesBinders.get().forPattern( pattern );
     }
 
     /**
@@ -113,7 +113,7 @@ public abstract class AbstractRulesModul
      */
     protected RulesBinder rulesBinder()
     {
-        return rulesBinder;
+        return rulesBinders.get();
     }
 
 }



Mime
View raw message