commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1301817 - /commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
Date Fri, 16 Mar 2012 23:10:41 GMT
Author: simonetripodi
Date: Fri Mar 16 23:10:41 2012
New Revision: 1301817

URL: http://svn.apache.org/viewvc?rev=1301817&view=rev
Log:
no needs to store system ids to a ThreadLocal, modules not invoked in lazy-loading way anymore

Modified:
    commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java

Modified: commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java?rev=1301817&r1=1301816&r2=1301817&view=diff
==============================================================================
--- commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
(original)
+++ commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
Fri Mar 16 23:10:41 2012
@@ -52,7 +52,7 @@ public abstract class FromXmlRulesModule
 
     private final URL xmlRulesDtdUrl = FromXmlRulesModule.class.getResource( DIGESTER_DTD_PATH
);
 
-    private final ThreadLocal<Set<String>> systemIds = new ThreadLocal<Set<String>>();
+    private final Set<String> systemIds = new HashSet<String>();
 
     private String rootPath;
 
@@ -62,19 +62,18 @@ public abstract class FromXmlRulesModule
     @Override
     protected void configure()
     {
-        if ( systemIds.get() != null )
+        if ( !systemIds.isEmpty() )
         {
             throw new IllegalStateException( "Re-entry is not allowed." );
         }
 
-        systemIds.set( new HashSet<String>() );
         try
         {
             loadRules();
         }
         finally
         {
-            systemIds.remove();
+            systemIds.clear();
         }
     }
 
@@ -96,7 +95,7 @@ public abstract class FromXmlRulesModule
         }
 
         String systemId = inputSource.getSystemId();
-        if ( systemId != null && !systemIds.get().add( systemId ) )
+        if ( systemId != null && !systemIds.add( systemId ) )
         {
             addError( "XML rules file '%s' already bound", systemId );
         }
@@ -254,7 +253,7 @@ public abstract class FromXmlRulesModule
      */
     public final Set<String> getSystemIds()
     {
-        return unmodifiableSet( systemIds.get() );
+        return unmodifiableSet( systemIds );
     }
 
 }



Mime
View raw message