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

Serial::write(String string) throwing java.lang.StringIndexOutOfBoundsException #76

Closed
prsebastian opened this issue Feb 10, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@prsebastian
Copy link

In some situations, the above-mentioned method is throwing a StringIndexOutOfBoundsException.

Example:

serial.write( ":VAL\u0000VM\u0000\u0001\u0000\u0001A\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FFVariableR\n\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00FF\u00D0" );

This is by the way the same bug as in Issue 37: #37
which you didn't really fix :) but rather postponed it by not calling write(new String(data)); anymore,
as seen in 8c0ebb5
but the bug itself is not in write(byte[] bytes) but in write(String string).

best regards,
Sebastian.

@savageautomate savageautomate self-assigned this Feb 12, 2015
@savageautomate savageautomate added this to the RELEASE 1.1 milestone Feb 15, 2015
@savageautomate
Copy link
Member

I have been working on a new serial implementation to properly support a byte level interface for working with the data. I suggest that you try the experimental build 1.1-SNAPSHOT. The serial API is completely overhauled and should provide far better results when working with bytes.

GITHUB BRANCH:
https://github.com/Pi4J/pi4j/tree/serial_enhancements

DOWNLOAD:
http://get.pi4j.com/download/pi4j-1.1-SNAPSHOT.zip

Please let me know if you find any problems ... remember it is very new and experimental :-)

@savageautomate
Copy link
Member

Fixed in 1.1-SNAPSHOT build

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

No branches or pull requests

2 participants