Source:
<code>public void connect(String port, int baud) throws IOException { CommPortIdentifier portId = null; Enumeration portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier id = (CommPortIdentifier) portList.nextElement(); if (id.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (id.getName().equals(port)) { portId = id; } } } if (portId != null) { try { serialPort = (SerialPort) portId.open("wr3223", 2000); } catch (PortInUseException e) { throw new IOException("Serial port '" + port + "' is already in use.", e); } try { serialPort.setSerialPortParams(baud, SerialPort.DATABITS_7, SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN); } catch (UnsupportedCommOperationException e) { throw new IOException("Serial port '" + port <START> + "' don't support the configuration 7 data bit, 1 stop bit and parity even.", e); <END> } if (!serialPort.isReceiveTimeoutEnabled()) { try { if (logger.isDebugEnabled()) { logger.debug("Add a receive timeout of 2000ms."); } serialPort.enableReceiveTimeout(2000); } catch (UnsupportedCommOperationException e) { logger.warn("Error by adding receive timeout.", e); } } DataInputStream inputStream = new DataInputStream(serialPort.getInputStream()); DataOutputStream outputStream = new DataOutputStream(serialPort.getOutputStream()); connect(inputStream, outputStream); } else { StringBuilder sb = new StringBuilder(); portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier id = (CommPortIdentifier) portList.nextElement(); if (id.getPortType() == CommPortIdentifier.PORT_SERIAL) { sb.append(id.getName() + "\n"); } } throw new IOException( "Serial port '" + port + "' could not be found. Available ports are:\n" + sb.toString()); } }</code><technical_language>"don't" "doesn't"</technical_language>

Target:
public void connect(String port, int baud) throws IOException { CommPortIdentifier portId = null; Enumeration portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier id = (CommPortIdentifier) portList.nextElement(); if (id.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (id.getName().equals(port)) { portId = id; } } } if (portId != null) { try { serialPort = portId.open("wr3223", 2000); } catch (PortInUseException e) { throw new IOException("Serial port '" + port + "' is already in use.", e); } try { serialPort.setSerialPortParams(baud, SerialPort.DATABITS_7, SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN); } catch (UnsupportedCommOperationException e) { throw new IOException("Serial port '" + port + "' doesn't support the configuration 7 data bit, 1 stop bit and parity even.", e); } if (!serialPort.isReceiveTimeoutEnabled()) { try { if (logger.isDebugEnabled()) { logger.debug("Add a receive timeout of 2000ms."); } serialPort.enableReceiveTimeout(2000); } catch (UnsupportedCommOperationException e) { logger.warn("Error by adding receive timeout.", e); } } DataInputStream inputStream = new DataInputStream(serialPort.getInputStream()); DataOutputStream outputStream = new DataOutputStream(serialPort.getOutputStream()); connect(inputStream, outputStream); } else { StringBuilder sb = new StringBuilder(); portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier id = (CommPortIdentifier) portList.nextElement(); if (id.getPortType() == CommPortIdentifier.PORT_SERIAL) { sb.append(id.getName() + "\n"); } } throw new IOException( "Serial port '" + port + "' could not be found. Available ports are:\n" + sb.toString()); } }