mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-08 00:16:13 +00:00
improve error quality + test for PR #339
This commit is contained in:
parent
fc610a9764
commit
85d0348844
@ -1846,7 +1846,7 @@ public class DeviceTest {
|
|||||||
try {
|
try {
|
||||||
usb.open(EnumSet.of(UsbWrapper.OpenCloseFlags.NO_IOMANAGER_THREAD, UsbWrapper.OpenCloseFlags.NO_DEVICE_CONNECTION));
|
usb.open(EnumSet.of(UsbWrapper.OpenCloseFlags.NO_IOMANAGER_THREAD, UsbWrapper.OpenCloseFlags.NO_DEVICE_CONNECTION));
|
||||||
fail("open error expected");
|
fail("open error expected");
|
||||||
} catch (IOException ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
usb.open(EnumSet.of(UsbWrapper.OpenCloseFlags.NO_IOMANAGER_THREAD));
|
usb.open(EnumSet.of(UsbWrapper.OpenCloseFlags.NO_IOMANAGER_THREAD));
|
||||||
|
@ -93,6 +93,9 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
|||||||
if (mConnection != null) {
|
if (mConnection != null) {
|
||||||
throw new IOException("Already open");
|
throw new IOException("Already open");
|
||||||
}
|
}
|
||||||
|
if(connection == null) {
|
||||||
|
throw new IllegalArgumentException("Connection is null");
|
||||||
|
}
|
||||||
mConnection = connection;
|
mConnection = connection;
|
||||||
try {
|
try {
|
||||||
openInt(connection);
|
openInt(connection);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user