[
https://issues.apache.org/jira/browse/PLC4X-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17630964#comment-17630964
]
Lukas Ott commented on PLC4X-345:
---------------------------------
This issue has been migrated to https://github.com/apache/plc4x/issues/641
> Read coil request throws java.lang.ArrayIndexOutOfBoundsException: Index 1
> out of bounds for length 1
> -----------------------------------------------------------------------------------------------------
>
> Key: PLC4X-345
> URL: https://issues.apache.org/jira/browse/PLC4X-345
> Project: Apache PLC4X
> Issue Type: Bug
> Components: Driver-Modbus, PLC4J
> Affects Versions: 0.10.0
> Environment: Windows 10,
> openjdk version "11.0.12" 2021-07-20
> org.apache.plc4x:plc4j-driver-modbus:0.10.0-SNAPSHOT
> (https://repository.apache.org/content/repositories/snapshots/org/apache/plc4x/plc4j-driver-modbus/0.10.0-SNAPSHOT/plc4j-driver-modbus-0.10.0-20220603.220457-1.jar)
> Reporter: Mohammaduvez Payawala
> Priority: Major
>
> Run hello-world-plc4x java example with cli options:
> {code:java}
> --field-addresses 02084 {code}
> Throws exception:
> {code:java}
> io.netty.handler.codec.DecoderException:
> java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
> at
> io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)
> at
> io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
> at
> io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
> at
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299)
> at
> io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
> at
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
> at
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
> at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
> at
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
> at
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
> at
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
> at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds
> for length 1
> at com.github.jinahya.bit.io.ArrayByteInput.read(ArrayByteInput.java:106)
> at com.github.jinahya.bit.io.DefaultBitInput.read(DefaultBitInput.java:57)
> at
> com.github.jinahya.bit.io.AbstractBitInput.unsigned8(AbstractBitInput.java:63)
> at
> com.github.jinahya.bit.io.AbstractBitInput.unsigned16(AbstractBitInput.java:92)
> at
> com.github.jinahya.bit.io.AbstractBitInput.readInt(AbstractBitInput.java:135)
> at
> org.apache.plc4x.java.spi.generation.ReadBufferByteBased.readUnsignedInt(ReadBufferByteBased.java:174)
> at
> org.apache.plc4x.java.modbus.readwrite.DataItem.staticParse(DataItem.java:51)
> at
> org.apache.plc4x.java.modbus.base.protocol.ModbusProtocolLogic.readBooleanList(ModbusProtocolLogic.java:328)
> at
> org.apache.plc4x.java.modbus.base.protocol.ModbusProtocolLogic.toPlcValue(ModbusProtocolLogic.java:232)
> at
> org.apache.plc4x.java.modbus.tcp.protocol.ModbusTcpProtocolLogic.lambda$read$2(ModbusTcpProtocolLogic.java:104)
> at
> org.apache.plc4x.java.spi.Plc4xNettyWrapper.decode(Plc4xNettyWrapper.java:175)
> at
> io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81)
> at
> io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
> ... 23 common frames omitted {code}
> It is working fine on release 0.9.1
--
This message was sent by Atlassian Jira
(v8.20.10#820010)