Closed jimtng closed 1 year ago
do you have any more details on the original exception?
I can't reproduce it consistently because it depends on the data, but this is the second time that I've noticed. I have an item loaded with a large metadata that gets updated every night. It contains text and urls, no binary data. I know, I should probably store the data in a json file instead! So sometimes it caused this error, but other times it doesn't. Today it doesn't do that error anymore. Looking in the past log, I found the error:
2022-08-09 22:38:13.797 [WARN ] [ore.internal.scheduler.SchedulerImpl] - Scheduled job '<unknown>' failed and stopped
org.jruby.exceptions.ArgumentError: (ArgumentError) wrong number of arguments (given 1, expected 2)
at org.jruby.RubyEnumerable.each_with_object(org/jruby/RubyEnumerable.java:1148) ~[?:?]
at RUBY.to_ruby_array(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:111) ~[?:?]
at openhab.conf.scripts.ruby.lib.gem_home.gems.openhab_minus_scripting_minus_4_dot_44_dot_0.lib.openhab.dsl.items.metadata.to_ruby(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:119) ~[?:?]
at openhab.conf.scripts.ruby.lib.gem_home.gems.openhab_minus_scripting_minus_4_dot_44_dot_0.lib.openhab.dsl.items.metadata.to_ruby_hash(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:98) ~[?:?]
at org.jruby.RubyHash.each(org/jruby/RubyHash.java:1519) ~[?:?]
at org.jruby.java.proxies.MapJavaProxy.each(org/jruby/java/proxies/MapJavaProxy.java:582) ~[?:?]
at org.jruby.RubyEnumerable.each_with_object(org/jruby/RubyEnumerable.java:1148) ~[?:?]
at RUBY.to_ruby_hash(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:98) ~[?:?]
at openhab.conf.scripts.ruby.lib.gem_home.gems.openhab_minus_scripting_minus_4_dot_44_dot_0.lib.openhab.dsl.items.metadata.to_ruby(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:117) ~[?:?]
at RUBY.initialize(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:31) ~[?:?]
at org.jruby.RubyClass.new(org/jruby/RubyClass.java:888) ~[?:?]
at RUBY.[](/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:143) ~[?:?]
at RUBY.dig(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/items/metadata.rb:178) ~[?:?]
at RUBY.<main>(/openhab/conf/automation/jsr223/ruby/personal/fetch_data.rb:122) ~[?:?]
at RUBY.timer_block(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/timers/timer.rb:86) ~[?:?]
at RUBY.thread_local(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/core/thread_local.rb:24) ~[?:?]
at RUBY.thread_local(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/core/thread_local.rb:36) ~[?:?]
at RUBY.timer_block(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/timers/timer.rb:85) ~[?:?]
at org.jruby.ext.thread.Mutex.synchronize(org/jruby/ext/thread/Mutex.java:171) ~[?:?]
at RUBY.timer_block(/openhab/conf/scripts/ruby/lib/gem_home/gems/openhab-scripting-4.44.0/lib/openhab/dsl/timers/timer.rb:83) ~[?:?]
If I'm not mistaken, line 1148 inside RubyEnumerable.java is this
Converting this to draft because it doesn't fully solve the problem yet. See #631
I encountered ArgumentError in
each_with_object
when accessing certain data inside the metadata. This PR fixed it.