Jad Naous created FELIX-3842:
--------------------------------

             Summary: NPE in LocalRepositoryImpl
                 Key: FELIX-3842
                 URL: https://issues.apache.org/jira/browse/FELIX-3842
             Project: Felix
          Issue Type: Bug
          Components: Bundle Repository (OBR)
         Environment: Tried on v1.6.6
            Reporter: Jad Naous


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

Reply via email to