Allow waitForSerialEvent() to throw any kind of exception
This commit is contained in:
parent
04d1bb2ae8
commit
e8074068cf
|
@ -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))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue