You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by gn...@apache.org on 2011/02/17 20:51:24 UTC

svn commit: r1071762 - /aries/branches/0.2-incubating-RCx/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java

Author: gnodet
Date: Thu Feb 17 19:51:23 2011
New Revision: 1071762

URL: http://svn.apache.org/viewvc?rev=1071762&view=rev
Log:
[ARIES-563] The NamespaceHandlerRegistryImpl does not actually reuse parsed schemas

Modified:
    aries/branches/0.2-incubating-RCx/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java

Modified: aries/branches/0.2-incubating-RCx/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/aries/branches/0.2-incubating-RCx/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java?rev=1071762&r1=1071761&r2=1071762&view=diff
==============================================================================
--- aries/branches/0.2-incubating-RCx/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java (original)
+++ aries/branches/0.2-incubating-RCx/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java Thu Feb 17 19:51:23 2011
@@ -214,7 +214,14 @@ public class NamespaceHandlerRegistryImp
         // If it contains additional namespaces, it should not be a problem since
         // they won't be used at all
         for (Map<URI, NamespaceHandler> key : schemas.keySet()) {
-            if (key.equals(handlers)) {
+            boolean found = true;
+            for (URI uri : handlers.keySet()) {
+                if (!handlers.get(uri).equals(key.get(uri))) {
+                    found = false;
+                    break;
+                }
+            }
+            if (found) {
                 schema = schemas.get(key).get();
                 break;
             }
@@ -234,6 +241,22 @@ public class NamespaceHandlerRegistryImp
                     }
                 }
                 schema = getSchemaFactory().newSchema(schemaSources.toArray(new Source[schemaSources.size()]));
+                // Remove schemas that are fully included
+                for (Iterator<Map<URI, NamespaceHandler>> iterator = schemas.keySet().iterator(); iterator.hasNext();) {
+                    Map<URI, NamespaceHandler> key = iterator.next();
+                    boolean found = true;
+                    for (URI uri : key.keySet()) {
+                        if (!key.get(uri).equals(handlers.get(uri))) {
+                            found = false;
+                            break;
+                        }
+                    }
+                    if (found) {
+                        iterator.remove();
+                        break;
+                    }
+                }
+                // Add our new schema
                 schemas.put(handlers, new SoftReference<Schema>(schema));
             } finally {
                 for (StreamSource s : schemaSources) {