Allow waitForSerialEvent() to throw any kind of exception

This commit is contained in:
hedgecrw85 2019-09-03 13:49:53 -05:00
parent 04d1bb2ae8
commit e8074068cf
1 changed files with 3 additions and 3 deletions

View File

@ -1245,7 +1245,7 @@ public final class SerialPort
while (isListening && isOpened) while (isListening && isOpened)
{ {
try { waitForSerialEvent(); } try { waitForSerialEvent(); }
catch (NullPointerException e) catch (Exception e)
{ {
isListening = false; isListening = false;
if (userDataListener instanceof SerialPortDataListenerWithExceptions) if (userDataListener instanceof SerialPortDataListenerWithExceptions)
@ -1267,12 +1267,12 @@ public final class SerialPort
int oldEventFlags = eventFlags; int oldEventFlags = eventFlags;
eventFlags = 0; eventFlags = 0;
configEventFlags(portHandle); configEventFlags(portHandle);
eventFlags = oldEventFlags;
try { serialEventThread.join(); } catch (InterruptedException e) {} try { serialEventThread.join(); } catch (InterruptedException e) {}
serialEventThread = null; serialEventThread = null;
eventFlags = oldEventFlags;
} }
public final void waitForSerialEvent() throws NullPointerException public final void waitForSerialEvent() throws Exception
{ {
switch (waitForEvent(portHandle)) switch (waitForEvent(portHandle))
{ {