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

ServiceObjectProvider passes null ServiceInterface parameter when retrieving Service

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • framework
    • None

    Description

      I raised this bug before, however it was closed, but the bug still exists in release 1.0. I can work around this by providing my own service provider, but this seems like a pretty serious bug, basically it means that the service object provider always fails. I'm adding some extra description...

      This bug means that the service object provider throws NullPointerExceptions! Here is the stack where the error is occuring:

      Caused by: java.lang.NullPointerException
      at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:186)
      at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:151)
      at org.apache.hivemind.impl.ModuleImpl.getService(ModuleImpl.java:60)
      at org.apache.hivemind.service.impl.ServiceObjectProvider.provideObject(ServiceObjectProvider.java:39)

      As you can see from line 186 in ServicePointImpl, serviceInterface is null:

      186 if (!serviceInterface.isAssignableFrom(result.getClass()))

      Its a pretty easy fix, currently the ServiceObjectProvider returns:

      return contributingModule.getService(locator, propertyType);

      However, propertyType is null, and therefore causes a NullPointerException to be raised when the service retrieved is checked for assignment compatibility against its service interface.

      The fix is to do as the ServiceTranslator does:

      return contributingModule.getService(
      inputValue,
      propertyType == null ? Object.class : propertyType);

      This ensures that no null service interface is passed through.

      Cheers,
      Trent.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tgmcclen Trent McClenahan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: