NPE in ConfigAdmin

View: New views
3 Messages — Rating Filter:   Alert me  

NPE in ConfigAdmin

by peterd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        Hi,

I get a NullPointerException in the ConfigAdmin's update thread, that  
is originating from the following piece of code (ConfigurationManager):

private class ManagedServiceFactoryUpdate implements Runnable

(...)

         public void run()
         {
             Factory factory;
             try
             {
                 factory = getFactory( factoryPid );
             }
             catch ( IOException ioe )
             {
                 log( LogService.LOG_ERROR, "Cannot get factory  
mapping for factory PID " + factoryPid, ioe );
                 return;
             }

             String bundleLocation = sr.getBundle().getLocation();


The NPE occurs in the last line. From the context it is clear that  
"sr" is not null, hence, sr.getBundle() returns null.
I guess this is caused by a bundle that is stopped concurrently? I see  
in the log that the bundle that registered the "offending" service is  
stopped around the time of the NPE....

I used version 1.0.1 of configadmin, but the same code fragment is  
still in the trunk.

Regards,
Peter.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: NPE in ConfigAdmin

by Felix Meschberger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Peter,

Though I think, this is certainly a corner case, it is not a nice
behaviour. The correct behaviour would probably be to check whether the
bundle is still set on the service reference and abort processing if not.

Can you please file a JIRA issue to track this ? Thanks.

Regards
Felix

peter.doornbosch schrieb:

>     Hi,
>
> I get a NullPointerException in the ConfigAdmin's update thread, that is
> originating from the following piece of code (ConfigurationManager):
>
> private class ManagedServiceFactoryUpdate implements Runnable
>
> (...)
>
>         public void run()
>         {
>             Factory factory;
>             try
>             {
>                 factory = getFactory( factoryPid );
>             }
>             catch ( IOException ioe )
>             {
>                 log( LogService.LOG_ERROR, "Cannot get factory mapping
> for factory PID " + factoryPid, ioe );
>                 return;
>             }
>
>             String bundleLocation = sr.getBundle().getLocation();
>
>
> The NPE occurs in the last line. From the context it is clear that "sr"
> is not null, hence, sr.getBundle() returns null.
> I guess this is caused by a bundle that is stopped concurrently? I see
> in the log that the bundle that registered the "offending" service is
> stopped around the time of the NPE....
>
> I used version 1.0.1 of configadmin, but the same code fragment is still
> in the trunk.
>
> Regards,
> Peter.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: NPE in ConfigAdmin

by peterd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Felix,


On 26 Sep , 2008, at 17:03 , Felix Meschberger wrote:

> Hi Peter,
>
> Though I think, this is certainly a corner case, it is not a nice
> behaviour. The correct behaviour would probably be to check whether  
> the
> bundle is still set on the service reference and abort processing if  
> not.

Yep.

>
>
> Can you please file a JIRA issue to track this ? Thanks.

Done: https://issues.apache.org/jira/browse/FELIX-740

Regards,
Peter

>
>
> Regards
> Felix
>
> peter.doornbosch schrieb:
>>    Hi,
>>
>> I get a NullPointerException in the ConfigAdmin's update thread,  
>> that is
>> originating from the following piece of code (ConfigurationManager):
>>
>> private class ManagedServiceFactoryUpdate implements Runnable
>>
>> (...)
>>
>>        public void run()
>>        {
>>            Factory factory;
>>            try
>>            {
>>                factory = getFactory( factoryPid );
>>            }
>>            catch ( IOException ioe )
>>            {
>>                log( LogService.LOG_ERROR, "Cannot get factory mapping
>> for factory PID " + factoryPid, ioe );
>>                return;
>>            }
>>
>>            String bundleLocation = sr.getBundle().getLocation();
>>
>>
>> The NPE occurs in the last line. From the context it is clear that  
>> "sr"
>> is not null, hence, sr.getBundle() returns null.
>> I guess this is caused by a bundle that is stopped concurrently? I  
>> see
>> in the log that the bundle that registered the "offending" service is
>> stopped around the time of the NPE....
>>
>> I used version 1.0.1 of configadmin, but the same code fragment is  
>> still
>> in the trunk.
>>
>> Regards,
>> Peter.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price!