[ https://issues.apache.org/jira/browse/FELIX-3842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard S. Hall resolved FELIX-3842. ------------------------------------ Resolution: Fixed Assignee: Richard S. Hall This is actually related to FELIX-3806, since technically service events are synchronous so the service reference bundle shouldn't be null. However, we try to be good and not invoke callbacks while holding locks, so we actually release the bundle lock before sending the event (actually, as of FELIX-3761, we don't even get the bundle lock when registering). In short, it is not clear what is the best thing here in the framework, but I'd rather error on the side of holding fewer locks than more. I committed the null check in bundle repository because it is otherwise harmless. Please close if satisfied. Thanks. > NPE in LocalRepositoryImpl > -------------------------- > > Key: FELIX-3842 > URL: https://issues.apache.org/jira/browse/FELIX-3842 > Project: Felix > Issue Type: Bug > Components: Bundle Repository (OBR) > Affects Versions: bundlerepository-1.6.6 > Environment: Tried on v1.6.6 > Reporter: Jad Naous > Assignee: Richard S. Hall > Fix For: bundlerepository-1.6.8 > > > NPE due to time-of-check-to-time-of-check kind of bug. By the time > {{LocalRepositoryImpl.serviceChanged}} gets called, the bundle may have been > uninstalled, it seems. A patch for version 1.6.7-SNAPSHOT follows below the > stack trace. > ERROR: Bundle org.apache.felix.bundlerepository [29] EventDispatcher: Error > during dispatch. (java.lang.NullPointerException) > java.lang.NullPointerException > at > org.apache.felix.bundlerepository.impl.LocalRepositoryImpl.serviceChanged(LocalRepositoryImpl.java:71) > at > org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932) > at > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793) > at > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543) > at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4346) > at org.apache.felix.framework.Felix.registerService(Felix.java:3356) > at > org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346) > at org.apache.felix.ipojo.IPojoFactory.start(IPojoFactory.java:615) > at > org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:520) > at org.apache.felix.ipojo.Extender.parse(Extender.java:301) > at > org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237) > at org.apache.felix.ipojo.Extender.access$600(Extender.java:52) > at > org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:772) > at java.lang.Thread.run(Thread.java:662) > Index: > bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java > =================================================================== > --- > bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java > (revision 1430286) > +++ > bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/LocalRepositoryImpl.java > (working copy) > @@ -68,7 +68,7 @@ > public void serviceChanged(ServiceEvent event) > { > Bundle bundle = event.getServiceReference().getBundle(); > - if (bundle.getState() == Bundle.ACTIVE && event.getType() != > ServiceEvent.MODIFIED) > + if (bundle != null && bundle.getState() == Bundle.ACTIVE && > event.getType() != ServiceEvent.MODIFIED) > { > synchronized (this) > { -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira