[rfxcom] Convert unsigned byte to int properly for message length (#10830)
Without this, any message over 127 bytes reports a negative length and fails the message start test, which puts the code out of sync with the rfxcom leading to lots of errors, and eventually, complete loss of connection. Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
This commit is contained in:
parent
c49166a069
commit
c12e189a13
|
@ -62,7 +62,7 @@ public class RFXComStreamReader extends Thread {
|
|||
while (!Thread.interrupted()) {
|
||||
// First byte tells us how long the packet is
|
||||
int bytesRead = connector.read(buf, 0, 1);
|
||||
int packetLength = buf[0];
|
||||
int packetLength = Byte.toUnsignedInt(buf[0]);
|
||||
|
||||
if (bytesRead > 0 && packetLength > 0) {
|
||||
logger.trace("Message length is {} bytes", packetLength);
|
||||
|
|
Loading…
Reference in New Issue