SensorProcessor gets a java.lang.NullPointerException if there is a multiprobe sensor script with no probe set


Description

If you delete a subprobe of a multiprobe but fail to delete the associated sensor script, SensorProcessor generates a null pointer exception. This can also happen if the "ReactsTo Probe" is set to empty in the discovery_sensor_multi_probe record.

java.lang.NullPointerException: java.lang.NullPointerException: com.snc.discovery.SensorProcessor.matchesProbeVersion(SensorProcessor.java:750)
com.snc.discovery.SensorProcessor.shouldProcess(SensorProcessor.java:663)
com.snc.discovery.SensorProcessor.processSinglePage(SensorProcessor.java:381)
com.snc.discovery.SensorProcessor.process(SensorProcessor.java:211)
sun.reflect.GeneratedMethodAccessor1266.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:292)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2585)
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1501)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:829)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:152)
org.mozilla.javascript.Context$ScriptCaller.call(Context.java:2939)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:151)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1501)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:829)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:152)
org.mozilla.javascript.Context$ScriptCaller.call(Context.java:2939)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:151)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3429)
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:164)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.Evaluator.evaluatePossiblePrefixedString(Evaluator.java:210)
com.glide.job.RunScriptJob.evaluateScript(RunScriptJob.java:166)
com.glide.job.RunScriptJob.execute(RunScriptJob.java:87)
com.glide.schedule.JobExecutor.lambda$executeJob$0(JobExecutor.java:108)
com.snc.db.data_replicate.replicator.DataReplicationAdvisors.runInOriginatorContext(DataReplicationAdvisors.java:67)
com.glide.schedule.JobExecutor.lambda$inDataReplicationContext$2(JobExecutor.java:138)
com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:111)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:95)
com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:329)

Steps to Reproduce

  1. Take a stock instance with Discovery installed
  2. Delete one of the Unix - Classify subprobes but do not remove the associated script
  3. Discover a unix server
  4. An java.lang.NullPointerException occurs in SensorProcessor

Workaround

  1. Navigate to the MultiSensor sensor throwing the error
  2. Select the "Responds to Probes" related list
  3. Look at the column "Reacts to Probe"
  4. Find the record where "Reacts to Probe" column is empty
  5. Populate with the correct probe

Related Problem: PRB1370188