When multiply services visible for autowire, builder silently ignores and this 
lead to NPE
------------------------------------------------------------------------------------------

                 Key: HIVEMIND-188
                 URL: http://issues.apache.org/jira/browse/HIVEMIND-188
             Project: HiveMind
          Issue Type: Improvement
          Components: framework
    Affects Versions: 1.1.1, 1.1
            Reporter: Andrey


When multiply service points with same interface are visible for autowiring 
builer, 
builder silently skips initialization of dependent service, because method
of the RegistryInfrastructureImpl return invalid information about
availability of the service for given interface. Here should be some
diagnostics message (such as "requested services for interface, but
 multiply interfaces found"), possibly with error thrown (I think this is
undefined behavoir, that some requested service is multipy defined,
and someone try to lookup such service by interface only).


    public boolean containsService(Class serviceInterface, Module module)
    {
     
....

   Iterator i = servicePoints.iterator();
        while (i.hasNext())
        {
            ServicePoint point = (ServicePoint) i.next();

            if (point.visibleToModule(module))
                count++;
        }
/////////////////////
  here is logical error, this method returns false in both cases:
   - no services with given interface
   - multilply services with given interface
/////////////////////
        return count == 1;
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to