-
Notifications
You must be signed in to change notification settings - Fork 834
Description
(First off, thank you for this fantastic library. I appreciate everyone's efforts into making this library better everyday. I am truly thankful for your time invested and for sharing all your expertise)
Expected behavior
Parsing of lengthy data fields succeeds
Actual behavior
Crash due to Java Long java.lang.NumberFormatException
Steps to reproduce this behavior
In lines 644 & 645 of BeaconParser.java, a hexadecimal string is created (because the data field is >= 5 bytes) but the function Long.decode expects a radix specifier ("0x", "0X" or "#" for hexadecimal) in front of the string.
This is due to the function byteArrayToFormattedString converting data fields longer than 4 bytes to hexadecimal. Additionally, if the length is 16, it even adds dashes which can also not be "decoded" by the Long function.
Finally, if the data fields are being inserted into a Long number, I expect there to be a length limitation, but I don't see that documented (it doesn't seem to be enforced in the code either, if I am not mistaken).
I can provide examples if desired.
Android Beacon Library version
Code from Master branch
Again... thank you!