Uploaded image for project: 'HiveMind'
  1. HiveMind
  2. HIVEMIND-188

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1, 1.1.1
    • None
    • framework
    • None

    Description

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            aka50 Andrey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: