Skip to content

java.lang.ArrayIndexOutOfBoundsException when accessing coil index #87

@paulorb

Description

@paulorb

When performing a read of coils

           val request = ReadCoilsRequest()
            request.serverAddress = 1
            request.startAddress = 0
            request.transactionId = 0
            request.quantity = 123
            val response = m.processRequest(request) as ReadCoilsResponse

When trying to get the value of an individual coil, it gives an exception java.lang.ArrayIndexOutOfBoundsException when accessing a specific coil index

println("test: ${response.modbusCoils.get(120)}")

As a workaround I am using the coils property (which is indicated to be deprecated)

println("test: ${response.coils.get(120)}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions