Jonathan Anstey created SMX4NMR-294:
---------------------------------------

             Summary: NPE from OsgiServiceRegistryTracker when service is 
unavailable
                 Key: SMX4NMR-294
                 URL: https://issues.apache.org/jira/browse/SMX4NMR-294
             Project: ServiceMix NMR
          Issue Type: Bug
    Affects Versions: 1.5.0
            Reporter: Jonathan Anstey
            Assignee: Jonathan Anstey
             Fix For: 1.6.0


A big nasty stack is displayed in the console if the service is null in 
OsgiServiceRegistryTracker.addingService:

{code}
ERROR: Bundle org.apache.servicemix.nmr.osgi [223] EventDispatcher: Error 
during dispatch. (java.lang.NullPointerException)
java.lang.NullPointerException
        at 
java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:896)
        at 
org.apache.servicemix.nmr.core.ServiceRegistryImpl.register(ServiceRegistryImpl.java:45)
        at 
org.apache.servicemix.nmr.osgi.OsgiServiceRegistryTracker.addingService(OsgiServiceRegistryTracker.java:78)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
                at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
        at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:234)
        at 
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:941)
        at 
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:934)
        at 
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:795)
        at 
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:544)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4337)
        at org.apache.felix.framework.Felix.registerService(Felix.java:3352)
        at 
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:410)
        at 
org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:184)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.registerServices(BlueprintContainerImpl.java:653)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:336)
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:232)
        at 
org.apache.aries.blueprint.container.BlueprintExtender.checkBundle(BlueprintExtender.java:325)
        at 
org.apache.aries.blueprint.container.BlueprintExtender.bundleChanged(BlueprintExtender.java:244)
        at 
org.apache.aries.blueprint.container.BlueprintExtender$BlueprintBundleTrackerCustomizer.modifiedBundle(BlueprintExtender.java:471)
        at 
org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:495)
        at 
org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:238)
        at 
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:457)
        at 
org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:870)
        at 
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:791)
        at 
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4321)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1945)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:947)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:934)
        at 
org.apache.karaf.shell.osgi.InstallBundle.doExecute(InstallBundle.java:51)
        at 
org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)
        at 
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
        at 
org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
        at 
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
        at 
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
        at org.apache.karaf.shell.console.jline.Console.run(Console.java:226)
        at java.lang.Thread.run(Thread.java:680)
{code}

Would be better to display a helpful message in the logs instead of the NPE in 
the console.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to