This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ArrayIndexOutOfBoundsException in ConfigCompositionDataStatus.parseElements using nRF Mesh Library

Hi,

I am running a modified version of the light switch example, where I have modified the generic on off model to send byte arrays.

So I have been changing my models ids and opcodes ids few days ago in order to be compliant with the spec using vendor models and vendor opcodes, everything worked fine, until now, I probably changed something but I can't figure out what it is, when provisioning a new device, I am getting this error (Here's the full trace) :

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.test, PID: 25402
    java.lang.ArrayIndexOutOfBoundsException: length=26; index=26
        at no.nordicsemi.android.mesh.transport.ConfigCompositionDataStatus.parseElements(ConfigCompositionDataStatus.java:158)
        at no.nordicsemi.android.mesh.transport.ConfigCompositionDataStatus.parseCompositionDataPages(ConfigCompositionDataStatus.java:138)
        at no.nordicsemi.android.mesh.transport.ConfigCompositionDataStatus.parseStatusParameters(ConfigCompositionDataStatus.java:89)
        at no.nordicsemi.android.mesh.transport.ConfigCompositionDataStatus.<init>(ConfigCompositionDataStatus.java:84)
        at no.nordicsemi.android.mesh.transport.DefaultNoOperationMessageState.parseAccessMessage(DefaultNoOperationMessageState.java:86)
        at no.nordicsemi.android.mesh.transport.DefaultNoOperationMessageState.parseMeshPdu(DefaultNoOperationMessageState.java:61)
        at no.nordicsemi.android.mesh.transport.BaseMeshMessageHandler.parseMeshPduNotifications(BaseMeshMessageHandler.java:147)
        at no.nordicsemi.android.mesh.MeshMessageHandler.parseMeshPduNotifications(MeshMessageHandler.java:61)
        at no.nordicsemi.android.mesh.MeshManagerApi.parseNotifications(MeshManagerApi.java:306)
        at no.nordicsemi.android.mesh.MeshManagerApi.handleNotifications(MeshManagerApi.java:278)
        at com.example.meshutilities.repositories.NrfMeshRepository.onDataReceived(NrfMeshRepository.java:690)
        at com.example.meshutilities.ble.BleMeshManager$1.lambda$initialize$0$BleMeshManager$1(BleMeshManager.java:95)
        at com.example.meshutilities.ble.-$$Lambda$BleMeshManager$1$8UAXHAewMpEiHJMD1HWXsyWK96A.onDataReceived(Unknown Source:2)
        at no.nordicsemi.android.ble.ValueChangedCallback.notifyValueChanged(ValueChangedCallback.java:123)
        at no.nordicsemi.android.ble.BleManager$BleManagerGattCallback.onCharacteristicChangedSafe(BleManager.java:2884)
        at no.nordicsemi.android.ble.MainThreadBluetoothGattCallback.lambda$onCharacteristicChanged$4$MainThreadBluetoothGattCallback(MainThreadBluetoothGattCallback.java:135)
        at no.nordicsemi.android.ble.-$$Lambda$MainThreadBluetoothGattCallback$7AU42XLOqZKSRIMVuifw3eecBbw.run(Unknown Source:8)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6810)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

I doubt it has something to do on the mobile application side as it still works when using the vanilla light switch example.

It looks like the composition data that is gathered is wrong which leads to an array index out of bounds exception.

I am developing on a nRF52 DK (nRF52832), with SDK 16.0.0, SDK for mesh 4.0.0 and softdevice s132 v7.0.1 and nRF mesh application on Android or my own application using the nrf mesh library, but both of them crash during the provisioning process.

Do you have an idea what could be the cause of this problem ?

Best regards,

Quentin

Related