Fixes artf3989: Java SerialPort no longer ignores return value of serialRead

Change-Id: I5d522111189372a3c95b90804abf05ae1d0b553e
This commit is contained in:
Colby Skeggs
2015-01-18 01:30:19 +00:00
parent e614217d41
commit 102c992e50

View File

@@ -362,9 +362,9 @@ public class SerialPort {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
ByteBuffer dataReceivedBuffer = ByteBuffer.allocateDirect(count);
SerialPortJNI.serialRead(m_port, dataReceivedBuffer, count, status.asIntBuffer());
int gotten = SerialPortJNI.serialRead(m_port, dataReceivedBuffer, count, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
byte[] retVal = new byte[count];
byte[] retVal = new byte[gotten];
dataReceivedBuffer.get(retVal);
return retVal;
}