boc-tothefuture / openhab-jruby

JRuby Libraries for Openhab
Eclipse Public License 2.0
6 stars 9 forks source link

Comparing an item with a NULL state against QuantityType caused an ArgumentError #611

Closed jimtng closed 2 years ago

jimtng commented 2 years ago

Item:

Number:Power        NumberPower1        "Test [%.2 W]"

Script:

NumberPower1.update NULL
logger.info 'test' if (2 | 'W') < NumberPower1

Error:

13:34:45.277 [ERROR] [ript.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/test1.rb': Error during evaluation of Ruby in org/jruby/RubyComparable.java at line 209: (ArgumentError) comparison of Java::OrgOpenhabCoreLibraryTypes::QuantityType with OpenHAB::Core::ItemProxy failed
ccutrer commented 2 years ago

this is expected behavior. compare with 2 < nil (ArgumentError (comparison of Integer with nil failed)).