MonitorAdmin -  NullPointerException while calling MonitoringJob.stop()
-----------------------------------------------------------------------

                 Key: FELIX-810
                 URL: https://issues.apache.org/jira/browse/FELIX-810
             Project: Felix
          Issue Type: Bug
          Components: Sandbox
            Reporter: Martin Thelian


I've started a scheduled job with:

|> this.monitorService.startScheduledJob(
|>    PID, // listener.id
|>    variableNames.toArray(new String[variableNames.size()]),
|>    60, // seconds
|>    0   // Forever
|> );   

If I then need to stop the job via 
|> this.currentMonitorJob.stop();

e.g. because the variableName list has changed I'm getting the following 
NullpointerException:

-----
|> java.lang.NullPointerException
|>         at 
org.apache.felix.sandbox.monitor.MonitorAdminImpl$MonitoringJobImpl.unsubscribeStatusVariables(MonitorAdminImpl.java:185)
|>         at 
org.apache.felix.sandbox.monitor.MonitorAdminImpl$MonitoringJobImpl.stop(MonitorAdminImpl.java:162)
-----

The problem seems to be that there are no subscriptions in a scheduled job and 
therefore the variable "list" shown in the code fragment below is null.
|> private void unsubscribeStatusVariables() {
|> [...]
|>              List list=(List)subscriptions.get(statusVariableName);
|>              if(list!=null) {
|>                      list.remove(this);
|>              } // else never occurs
|>              if(list.isEmpty())
|>                      subscriptions.remove(statusVariableName);
|>      }               
|> }




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to