Grzegorz Grzybek created ARIES-1350:
---------------------------------------

             Summary: Namespace handler can't be found even if it's registered 
correctly
                 Key: ARIES-1350
                 URL: https://issues.apache.org/jira/browse/ARIES-1350
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
            Reporter: Grzegorz Grzybek
            Priority: Critical


{{org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.NamespaceHandlerSetImpl}}
 class deals with namespace handlers for single BP container.
During creation, it takes all already registered handlers from global NS 
registry.
After creation it is added to {{sets}} field in the registry to get notified 
about newly registered NS handlers.
But when NS handler is registered between the above two steps, BP stays in 
GRACE_PERIOD state infinitely, because this "case" in BP container impl:
{code:java}
case WaitForNamespaceHandlers:
{
    List<String> missing = new ArrayList<String>();
    List<URI> missingURIs = new ArrayList<URI>();
    for (URI ns : namespaces) {
        if (handlerSet.getNamespaceHandler(ns) == null) {
{code}

won't ever get namespace handler, because it looks in the handler set obtained 
when {{NamespaceHandlerRegistryImpl.NamespaceHandlerSetImpl}} was constructed.

This:
{noformat}
10:51 $ git diff
diff --git 
a/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
 
b/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
index 7688924..d53ea5c 100644
--- 
a/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
+++ 
b/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
@@ -535,6 +535,9 @@ public class NamespaceHandlerRegistryImpl implements 
NamespaceHandlerRegistry, S
         }
 
         public NamespaceHandler getNamespaceHandler(URI namespace) {
+            if (!handlers.containsKey(namespace)) {
+                findCompatibleNamespaceHandler(namespace);
+            }
             return handlers.get(namespace);
         }
{noformat}

fixes the problem



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to