felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jad Naous (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-3842) NPE in LocalRepositoryImpl
Date Tue, 08 Jan 2013 18:32:13 GMT

    [ https://issues.apache.org/jira/browse/FELIX-3842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13547090#comment-13547090
] 

Jad Naous commented on FELIX-3842:
----------------------------------

It would be good to do a quick check to see where ServiceReference.getBundle() gets called
without a lock and add null checks there to avoid such NPEs.
                
> 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

Mime
View raw message