Error: Cannot invoke method tokenize() on null object


#1

@bravenel I've run in to an issue in Rule Machine 3.0 running 2.0.9.133

I was creating this new Triggered Rule:

I was in the "Select Actions for True" window and had just added the switches per mode action. I was clicking through the "Select Action Type to set" dropdown list trying to find which action type to select to be able to run a RM action when I got this error message:

image

It threw me back to the "Define a Triggered Rule" window with the first action saved. Every time I try to go in to the "Select Actions for True" now I get the same error message.

The logs do not add much to the error message:


#2

I get a similar error when trying to go in to "Select Actions for False": java.lang.NullPointerException: Cannot invoke method tokenize() on null object (selectActionsFalse)


#3

I have created a new rule with the same settings but I was unable to reproduce the error there. I've still got the failing rule if you want to have a look at it


#4

I'll look into it. Thanks.


#5

Can you show me the app status for the broken rule? Gear icon.


#6
Settings

Name Type Value

actSubTypeTrue.1 enum Set these switches per mode
actTypeTrue.1 enum Control Switches, Capture or Restore
actTypeTrue.2 enum Set Dimmers
cond enum Illuminance of Sensor - Master Bedroom is > 20
isDev1 bool false
origLabel text Master Bedroom Faulty - Motion Detection
rCapab1 enum Illuminance
rCapab2 enum Motion
rDev1 capability.illuminanceMeasurement Sensor - Master Bedroom
rDev2 capability.motionSensor Sensor - Master Bedroom
RelrDev1 enum >
state1 number 20
state2 enum active
switchModesTrue.1 enum ["1","2","65","34","33"]
switchMTrue.1 capability.switch Virtual Switch - Master Bedroom Lights State
switchTrue.11 enum on
switchTrue.12 enum on
switchTrue.133 enum on
switchTrue.134 enum on
switchTrue.165 enum on
tCapab1 enum Motion
tDev1 capability.motionSensor Sensor - Master Bedroom
tstate1 enum active
Event Subscriptions

Source Event Handler Filter

Sensor - Master Bedroom motion.active allHandler true
Application State

Name Value

actCondNdx -1
actionDone true
actionListTrue [1]
actionsTrue {1={wait=, modes={}, method=getModeSwitch, cond=0}}
actLabelIndent
actNdx 2
cancelList []
cancelListPend []
capabActDone false
capabDone true
capabsfalse {2.false=Sensor - Master Bedroom active, 1.false=Illuminance of Sensor - Master Bedroom is > 20, 3.false={}}
capabstrue {1.true=Sensor - Master Bedroom active, 2.true={}}
certainTimes []
condOper oper
convertedFromRule true
cstCmds [{334_1=[setVolume(40), musicPlayer]}, {324_1=[refresh(), switch]}, {335_1=[setVolume(50), musicPlayer]}, {282_1=[setVolume(85), musicPlayer]}, {280_1=[setVolume(75), musicPlayer]}, {165_1=[on1(), switch]}, {326_2=[configure(120,1), switch]}, {169_1=[off1(), switch]}, {175_1=[on2(), switch]}, {176_1=[off2(), switch]}, {326_1=[updateSingleParam(120,1), switch]}, {428_1=[arrived(), presenceSensor]}, {429_1=[departed(), presenceSensor]}]
editCondIf
eval [2, AND, 1]
firstR true
globVars
hasAll false
hasCondition false
hasDevice null() on null
hasElse false
howMany 3
howManyT 14
inIf false
inRepeat false
installedCapabs [Polling, PowerMeter, PushableButton, IlluminanceMeasurement, ReleasableButton, Battery, Outlet, MotionSensor, AudioVolume, SpeechSynthesis, ColorTemperature, PresenceSensor, Light, Refresh, EnergyMeter, RelaySwitch, MusicPlayer, ColorMode, TemperatureMeasurement, HoldableButton, SwitchLevel, Switch, ChangeLevel, Configuration, Actuator, ColorControl, Sensor, VoltageMeasurement]
isExpert true
lastCodes {}
lastEvtDate 05/11/2019
lastEvtName Sensor - Master Bedroom
lastEvtTime 10:49
lastEvtValue active
ndx.false 3
ndx.true 2
paramNdx 1
paramsDone false
parenLev 0
parens 0
paused true
private true
repeating {}
ruleType tule
skipIfActionsTrue false
skipRepeatActionsTrue false
subscribedVariables []
success true
token 3
varUseList {}
wasEndSR false
wasRepeating {}
Scheduled Jobs

No Scheduled Jobs are set.


#7

Did you edit those actions before or after adding the Switch per mode? Was there some other action there that was deleted? Like maybe a Custom Action?


#8

I was creating the Triggered rule as it's displayed in the screenshot above, from top to bottom in one go. I had just added the first action for true (the switches per mode) and went on to add a second action. I was clicking through the action type dropdowns to see what options there were in the actions dropdown for each type when it threw me out, but I didn't add another action


#9

OK, thanks for the clarification.


#10

I've managed to reproduce it once now. I'm currently documenting every step I'm doing trying to reproduce it again


#11

While I was able to reproduce it once, I don't remember exactly what I did to trigger the issue. I have tried over 90 different combinations now, while documenting it, but haven't been able to reproduce.

The steps I know I did when I was able to reproduce it were:

  1. Create new Rule
  2. Set the conditions and define rule
  3. Convert to triggered rule
  4. Set the trigger event
  5. Set the switches per mode as actions for true (don't click "Done with actions for true")
  6. Select an action type from the dropdown list
  7. Select an action from the dropdown list, without adding this action
  8. Repeat 6-7 with different action types and actions until it errors

I'm pretty sure I was somewhere in the bottom 4 action types ("Set Private Boolean, Run/Stop", "Run Custom Action or Custom command", "Delay or Repeat Actions" or "Conditional Actions") when the issue last occurred, but I was unable to reproduce that later.


#12

ah ha, so there was more going on. The thing is, the application state you showed revealed that Custom Action had been selected. And, I found a problem with selecting Custom Action but not completing it. That is most likely what threw the error, although I'm not able to get it happen either. A fix for this has been done, and will be in the next release.


#13

Sorry about the wild goose chase but it did lead to a bug being found at least. Hopefully it was also that bug that caused my issue. Thank you!