public boolean isCurrentlyOwned() { return getCurrentOwner() != null; }
public boolean isCurrentlyOwned() { return getCurrentOwner() != null; }
public boolean isCurrentlyOwned() { return getCurrentOwner() != null; }
throw new PortInUseException(getCurrentOwner());
throw new PortInUseException(getCurrentOwner());
if (id.getCurrentOwner() == null || !id.getCurrentOwner().equals(APPLICATION_NAME)) { fail("Wrong or missing owner for this serial port (got \"%s\", expected \"%s\")", id.getCurrentOwner(), APPLICATION_NAME); CommPortIdentifier cpi = cpiEnum.nextElement(); if (cpi.getName().equals(getPortName())) { origOwnerName = cpi.getCurrentOwner(); break; CommPortIdentifier cpi = cpiEnum.nextElement(); if (cpi.getName().equals(getPortName())) { checkOwnerName = cpi.getCurrentOwner(); break;
CommPortIdentifier cpi = cpiEnum.nextElement(); if (cpi.getName().equals(getPortName())) { origOwnerName = cpi.getCurrentOwner(); break; CommPortIdentifier cpi = cpiEnum.nextElement(); if (cpi.getName().equals(getPortName())) { checkOwnerName = cpi.getCurrentOwner(); break;
/** * Returns the serial port instance. * * @param aOptions * the serial port options, cannot be <code>null</code>. * @return the serial port instance, never <code>null</code>. * @throws NoSuchPortException * in case the desired port does not exist; * @throws PortInUseException * in case the desired port is already in use; * @throws IOException * in case of other I/O problems. */ private SerialPort getSerialPort( final CommPortOptions aOptions ) throws NoSuchPortException, PortInUseException, IOException { final CommPortIdentifier commPortId = CommPortIdentifier.getPortIdentifier( aOptions.getPortName() ); if ( commPortId.isCurrentlyOwned() && ( commPortId.getCurrentOwner() != CONNECT_ID ) ) { throw new PortInUseException(); } final CommPort commPort = commPortId.open( CONNECT_ID, 2000 ); if ( !( commPort instanceof SerialPort ) ) { throw new IOException( "Not a serial port?!" ); } return ( SerialPort )commPort; }