diff --git a/src/java/jssc/SerialPort.java b/src/java/jssc/SerialPort.java index 7dfd827..b7fd849 100644 --- a/src/java/jssc/SerialPort.java +++ b/src/java/jssc/SerialPort.java @@ -151,14 +151,15 @@ public class SerialPort { else { throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_NULL_NOT_PERMITTED);//since 2.1.0 -> NULL port name fix } - //since 0.9.0 -> - if(portHandle == -1){ + if(portHandle == -1){//since 0.9.0 -> throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_BUSY); } else if(portHandle == -2){ throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_NOT_FOUND); - } - //<- since 0.9.0 + }//<- since 0.9.0 + else if(portHandle == -3){//since 2.2.0 -> + throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PERMISSION_DENIED); + }//<- since 2.2.0 portOpened = true; return true; }