Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

ArrayIndex Out of Bounds in case the adress is 100 #438

Closed
JozefDropco opened this issue Jan 14, 2019 · 2 comments
Closed

ArrayIndex Out of Bounds in case the adress is 100 #438

JozefDropco opened this issue Jan 14, 2019 · 2 comments

Comments

@JozefDropco
Copy link

Hi,
this is a great library to use with Raspberry. I really appreciate your effort.

There is a small bug in code which causes array out of bounds. While checking the Pin cache size you are comparing adress with array length. Instead it should be length-1 as the index cannot be 100 this caused an issue in my code.
java.lang.ArrayIndexOutOfBoundsException: 100
at com.pi4j.io.gpio.GpioProviderBase.getPinCache(GpioProviderBase.java:88)
at com.pi4j.io.gpio.GpioProviderBase.export(GpioProviderBase.java:119)
at com.pi4j.io.gpio.GpioProviderBase.export(GpioProviderBase.java:100)
at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)

I would like also to ask is there any plan for release 1.2?

@savageautomate
Copy link
Member

FIX #438; array auto-expansion should be triggered if requested pin address is GREATER THAN or EQUAL to the current pin cache length.

@savageautomate
Copy link
Member

Yes, working on a 1.2 release now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants