Is there a difference between null and NULL?

(Carsten Wuthenow) #1

After switching to openhab 2.3 and re-engineering all my KNX items and things I had some strange behaviors with some rules. Deep diving I found ItemStateEvents that change the state of an item from null to NULL. Working with a lot of hash maps in my rules I have a lot of If statements that filter items states that contains a null (!== null). As I’m not an expert in Java I was wondering if there is a difference between null and NULL and in which use-case I need to check whether a “null” or a “NULL” state of an item.

Hope someone can bring some light into this :slight_smile:


[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule <rulename>': null
(SiHui) #2

The name 'NULL' cannot be resolved to an item or type
(Carsten Wuthenow) #3

Great! thx for clarification. Could not really use the search function on this or I was too stupid to run the search case sensitive

(SiHui) #4

Just include @rlkoshak in your searches and you will find almost any solution :grinning:

(Carsten Wuthenow) #5

Yes I know :slight_smile:

Root cause for the strange behavior found: I used find+replace function to replace != null to !== null in my rules. I think that operation was not done case sensitive and it was also replaced for the states. Maybe a good learning for others who switch to 2.3