cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amichai Rothman (JIRA)" <>
Subject [jira] [Created] (DOSGI-164) NullPointerException on export
Date Tue, 02 Apr 2013 23:55:15 GMT
Amichai Rothman created DOSGI-164:

             Summary: NullPointerException on export
                 Key: DOSGI-164
             Project: CXF Distributed OSGi
          Issue Type: Bug
          Components: DSW
    Affects Versions: 1.4.0
         Environment: Oracle JDK 1.7.0_17, Karaf 2.3.1, DOSGi 1.4.0
            Reporter: Amichai Rothman

I got the exception below in the Karaf console on two occasions, once when just starting up
Karaf, and once when a bundle was re-deployed. It looks like it's caused by using the return
value of ServiceReference.getBundle() without a null check (the method's docs explicitly states
it must return null if the service is unregistered).

Note that this looks like the same cause as DOSGI-120 but in a different place in the code
- and it can probably happen in other usages of ServiceReference.getBundle() which are missing
a null check as well. BTW, the fix for DOSGI-120 is not entirely safe either, since it calls
getBundle once for the null check, and again for using it, and the service state (and return
value) might change in between the two - it's a race condition with an unregistering service.
A better approach might be to call getBundle once, storing the result in a local variable,
and then performing the null check and subsequently accessing the (unchanging) local variable.

Exception in thread "pool-16-thread-1" java.lang.NullPointerException
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$
        at Method)
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(
        at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(
        at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.doExportService(
        at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.access$300(
        at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

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:

View raw message