NeuronRobotics / nrjavaserial

A Java Serial Port system. This is a fork of the RXTX project that uses in jar loading of the native code.
Other
345 stars 143 forks source link

SerialInputStream does not throw IOException #143

Closed t5keeper closed 4 years ago

t5keeper commented 5 years ago

gnu.io.RXTXPort$SerialInputStream.read(byte[]) does not throws IOException when called on closed port.

t5keeper commented 5 years ago

gnu.io.RXTXPort$SerialInputStream.write(byte[]) has the same problem.

Gerry33 commented 5 years ago

Same here: Reading on a removed device does throw lots of errors "Error 0x5 at src/windows/termios.c(2725): Access denied", but no Exception to catch

madhephaestus commented 4 years ago

Use the https://github.com/NeuronRobotics/nrjavaserial/releases/tag/5.0.3-prerelease nrjavaserial-5.0.3-pre.jar and this code example:

https://github.com/NeuronRobotics/nrjavaserial/blob/issue75-serialEventExitsOnHardwareLoss/test/src/test/ReadTest.java#L39

to detect when the hardware is disconnected.