JRuby: ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1

Hello everyone,

Since switching to openHAB 4.3, I get the following error message in a JRuby Rule.

Rule

logger.info("#{event.item.name} Triggered the rule")

speedtestImageUrl = "#{SpeedtestResultImageUrl.state}.png"
SpeedtestResultImage.update_from_url(speedtestImageUrl)

Error log

2024-12-21 17:23:24.219 [DEBUG] [penhab.automation.jrubyscripting.dsl] - openHAB JRuby Scripting Library Version 5.33.1 Loaded
2024-12-21 17:23:26.499 [ERROR] [.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'rSpeedtestImageUpdate' failed: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
2024-12-21 17:24:38.950 [DEBUG] [ng.internal.JRubyScriptEngineFactory] - Scope Values: {se=org.openhab.core.automation.module.script.internal.ScriptExtensionManagerWrapperImpl@1dfcd520, scriptExtension=org.openhab.core.automation.module.script.internal.ScriptExtensionManagerWrapperImpl@1dfcd520}
2024-12-21 17:24:38.952 [DEBUG] [ng.internal.JRubyScriptEngineFactory] - Scope Values: {voice=org.openhab.core.voice.internal.VoiceManagerImpl@5552058e, DOWN=DOWN, StringType=class org.openhab.core.library.types.StringType, rules=org.openhab.core.automation.internal.RuleRegistryImpl@578ee5b3, NextPreviousType=class org.openhab.core.library.types.NextPreviousType, PLAY=PLAY, Month=class java.time.Month, ImperialUnits=class org.openhab.core.library.unit.ImperialUnits, ZonedDateTime=class java.time.ZonedDateTime, INCREASE=INCREASE, OpenClosedType=class org.openhab.core.library.types.OpenClosedType, things=org.openhab.core.thing.internal.ThingRegistryImpl@c0fecae, UP=UP, RawType=class org.openhab.core.library.types.RawType, StringListType=class org.openhab.core.library.types.StringListType, events=org.openhab.core.automation.module.script.internal.defaultscope.ScriptBusEventImpl@5a32e56a, SIUnits=class org.openhab.core.library.unit.SIUnits, itemRegistry=org.openhab.core.internal.items.ItemRegistryImpl@1f09e5d7, NULL=NULL, STOP=STOP, UnDefType=class org.openhab.core.types.UnDefType, ir=org.openhab.core.internal.items.ItemRegistryImpl@1f09e5d7, Duration=class java.time.Duration, RefreshType=class org.openhab.core.types.RefreshType, Units=class org.openhab.core.library.unit.Units, RewindFastforwardType=class org.openhab.core.library.types.RewindFastforwardType, DateTimeType=class org.openhab.core.library.types.DateTimeType, QuantityType=class org.openhab.core.library.types.QuantityType, State=interface org.openhab.core.types.State, DecimalType=class org.openhab.core.library.types.DecimalType, IncreaseDecreaseType=class org.openhab.core.library.types.IncreaseDecreaseType, BinaryPrefix=class org.openhab.core.library.unit.BinaryPrefix, File=class java.io.File, items=org.openhab.core.automation.module.script.internal.defaultscope.ItemRegistryDelegate@3f0a38f8, actions=org.openhab.core.automation.module.script.internal.defaultscope.ScriptThingActionsImpl@4c93d92b, IpCameraActions=class org.openhab.binding.ipcamera.internal.IpCameraActions, CLOSED=CLOSED, REFRESH=REFRESH, MetricPrefix=class org.openhab.core.library.unit.MetricPrefix, DECREASE=DECREASE, StopMoveType=class org.openhab.core.library.types.StopMoveType, OFF=OFF, PREVIOUS=PREVIOUS, PAUSE=PAUSE, NEXT=NEXT, REWIND=REWIND, Paths=class java.nio.file.Paths, audio=org.openhab.core.audio.internal.AudioManagerImpl@1477c66, URLEncoder=class java.net.URLEncoder, Files=class java.nio.file.Files, HSBType=class org.openhab.core.library.types.HSBType, ON=ON, Path=interface java.nio.file.Path, DayOfWeek=class java.time.DayOfWeek, ZoneId=class java.time.ZoneId, UpDownType=class org.openhab.core.library.types.UpDownType, PercentType=class org.openhab.core.library.types.PercentType, AstroActions=class org.openhab.binding.astro.internal.action.AstroActions, OPEN=OPEN, MQTTActions=class org.openhab.binding.mqtt.internal.action.MQTTActions, NetworkActions=class org.openhab.binding.network.internal.action.NetworkActions, MOVE=MOVE, OnOffType=class org.openhab.core.library.types.OnOffType, Command=interface org.openhab.core.types.Command, lifecycleTracker=org.openhab.core.automation.module.script.LifecycleScriptExtensionProvider$LifecycleTracker@724c911f, PlayPauseType=class org.openhab.core.library.types.PlayPauseType, FASTFORWARD=FASTFORWARD, PointType=class org.openhab.core.library.types.PointType, UNDEF=UNDEF, ChronoUnit=class java.time.temporal.ChronoUnit}
2024-12-21 17:24:40.964 [DEBUG] [ng.internal.JRubyScriptEngineFactory] - Scope Values: {privateCache=org.openhab.core.automation.module.script.rulesupport.internal.CacheScriptExtension$ValueCacheImpl@7c9df76, sharedCache=org.openhab.core.automation.module.script.rulesupport.internal.CacheScriptExtension$TrackingValueCacheImpl@4155a77f}
2024-12-21 17:24:41.287 [DEBUG] [penhab.automation.jrubyscripting.dsl] - openHAB JRuby Scripting Library Version 5.33.1 Loaded
2024-12-21 17:24:43.229 [ERROR] [.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'rSpeedtestImageUpdate' failed: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1

I don’t usually use JRuby, but I found this code to create an image from a URL, which has worked great so far.

Unfortunately it is not clear to me why and how it goes wrong.

SpeedtestResultImageUrl.state returns

https://www.speedtest.net/result/c/2e12a4ce-71bd-48cb-b0e5-6adc750c1326

Hi Holger,

Can you please uninstall the built-in jrubyscripting automation add-on, and then place this jar into your CONF/addons/ folder?

https://github.com/jimtng/openhab-addons/releases/download/jrubyscripting-oh43-1/org.openhab.automation.jrubyscripting-4.3.1-SNAPSHOT.jar

Please let me know if this solved the problem.

@jimtng Thanks for the quick feedback!

The problem is solved with the new version