I was waiting until I had a really good list of things to post but decided this would be better done as a collaborative effort.
So everyone post some Rules errors you have encountered, what they mean, and how you solved them.
I’ll start with a couple.
Rule Errors and their actual Meaning
IllegalStateException: this occurs when you have two copies of a Rule running at the same time trying to access the same data, in particular a container like a HashMap or List. Put a ReentrantLock around the access or the entire rule so only one instance can access the data at a time.
NullPointerException: this is a catchall exception which usually means:
- you are referencing an Item that doesn’t exist
- you are trying to cast the state of an Item that is NULL/Undefined to a type (e.g. DecimalType)
- you are trying to parse a String into a Number and the String is of an invalid format
Ambiguous method call: this usually occurs when you try to call the postUpdate or sendCommand using a DecimalType. The problem is a DecimalType is also a Number and there are two different methods, one that takes a DecimalType and one that takes a Number and the interpreter doesn’t know which one you meant. Cast the DecimalType to Number.
More to follow. Please share your own!