Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1350

Namespace handler can't be found even if it's registered correctly

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: blueprint-core-1.4.4
    • Component/s: Blueprint
    • Labels:
      None

      Description

      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:

      case WaitForNamespaceHandlers:
      {
          List<String> missing = new ArrayList<String>();
          List<URI> missingURIs = new ArrayList<URI>();
          for (URI ns : namespaces) {
              if (handlerSet.getNamespaceHandler(ns) == null) {
      

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

      This:

      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);
               }
      

      fixes the problem

        Issue Links

          Activity

          Hide
          gnt Guillaume Nodet added a comment -

          Committing to https://svn.apache.org/repos/asf/aries/trunk ...
          M blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
          Committed r1690235

          Show
          gnt Guillaume Nodet added a comment - Committing to https://svn.apache.org/repos/asf/aries/trunk ... M blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java Committed r1690235

            People

            • Assignee:
              gnt Guillaume Nodet
              Reporter:
              gzres Grzegorz Grzybek
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development