Program: 72365
Project: 72365
Buggy source:
/** 
 * Generate "Hello XBee World!" on a XBee radio connected to a serial port. <p>To send data, the two radios need to be in api mode.  See <a href="https://docs.digi.com/display/XBJLIB/Building+your+first+XBee+Java+application#in_browser" target="_top">https://docs.digi.com/display/XBJLIB/Building+your+first+XBee+Java+application</a>.</p> <p>To list the ports, use:</p> <pre> java -classpath ${PTII}:${PTII}/lib/nrjavaserial-3.11.0.devel.jar:${PTII}/lib/xbjlib-1.1.0.nrjavaserial.jar:${PTII}/lib/slf4j-api-1.7.13.jar:${PTII}/lib/slf4j-nop-1.7.13.jar ptolemy.actor.lib.jjs.modules.xbee.test.XBeeHello </pre> <p>To send data on a port, append the port name:</p> <pre> java -classpath ${PTII}:${PTII}/lib/nrjavaserial-3.11.0.devel.jar:${PTII}/lib/xbjlib-1.1.0.nrjavaserial.jar:${PTII}/lib/slf4j-api-1.7.13.jar:${PTII}/lib/slf4j-nop-1.7.13.jar ptolemy.actor.lib.jjs.modules.xbee.test.XBeeHello /dev/xxyy </pre> <p>To send data on a port and get debugging:</p> <ul> <li> Set <code>-Dorg.slf4j.simpleLogger.defaultLogLevel=trace</code>. See <a href="http://www.slf4j.org/apidocs/org/slf4j/impl/SimpleLogger.html#in_browser" target="_top">http://www.slf4j.org/apidocs/org/slf4j/impl/SimpleLogger.html</a> for details.</li> <li> use slf4j-simple*.jar instead of slf4j-nop*.jar</li> <li> append the port name</li> </ul> <p>For example:</p> <pre> java -Dorg.slf4j.simpleLogger.defaultLogLevel=trace -classpath ${PTII}:${PTII}/lib/nrjavaserial-3.11.0.devel.jar:${PTII}/lib/xbjlib-1.1.0.nrjavaserial.jar:${PTII}/lib/slf4j-api-1.7.13.jar:${PTII}/lib/slf4j-simple-1.7.13.jar ptolemy.actor.lib.jjs.modules.xbee.test.XBeeHello /dev/tty.usbserial-DA01QZI2 </pre>
 */
public static void main(String[] args){
  if (args.length != 1) {
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    Enumeration ports=CommPortIdentifier.getPortIdentifiers();
    while (ports.hasMoreElements()) {
      CommPortIdentifier identifier=(CommPortIdentifier)ports.nextElement();
      System.err.println(identifier.getName());
    }
    StringUtilities.exit(1);
  }
  int baudRate=9600;
  XBeeDevice xBeeDevice=new XBeeDevice(args[0],baudRate);
  String dataToSend="String_Node_Str";
  byte[] dataToSendBytes=dataToSend.getBytes();
  try {
    xBeeDevice.open();
    System.out.println("String_Node_Str" + dataToSend + "String_Node_Str");
    xBeeDevice.sendBroadcastData(dataToSendBytes);
    System.out.println("String_Node_Str");
  }
 catch (  Throwable throwable) {
    throwable.printStackTrace();
    StringUtilities.exit(1);
  }
 finally {
    xBeeDevice.close();
  }
}

Fixed version (ground truth):
/** 
 * Generate "Hello XBee World!" on a XBee radio connected to a serial port. <p>To send data, the two radios need to be in api mode.  See <a href="https://docs.digi.com/display/XBJLIB/Building+your+first+XBee+Java+application#in_browser" target="_top">https://docs.digi.com/display/XBJLIB/Building+your+first+XBee+Java+application</a>.</p> <p>To list the ports, use:</p> <pre> java -classpath ${PTII}:${PTII}/lib/nrjavaserial-3.11.0.devel.jar:${PTII}/lib/xbjlib-1.1.0.nrjavaserial.jar:${PTII}/lib/slf4j-api-1.7.13.jar:${PTII}/lib/slf4j-nop-1.7.13.jar ptolemy.actor.lib.jjs.modules.xbee.test.XBeeHello </pre> <p>To send data on a port, append the port name:</p> <pre> java -classpath ${PTII}:${PTII}/lib/nrjavaserial-3.11.0.devel.jar:${PTII}/lib/xbjlib-1.1.0.nrjavaserial.jar:${PTII}/lib/slf4j-api-1.7.13.jar:${PTII}/lib/slf4j-nop-1.7.13.jar ptolemy.actor.lib.jjs.modules.xbee.test.XBeeHello /dev/xxyy </pre> <p>To send data on a port and get debugging:</p> <ul> <li> Set <code>-Dorg.slf4j.simpleLogger.defaultLogLevel=trace</code>. See <a href="http://www.slf4j.org/apidocs/org/slf4j/impl/SimpleLogger.html#in_browser" target="_top">http://www.slf4j.org/apidocs/org/slf4j/impl/SimpleLogger.html</a> for details.</li> <li> use slf4j-simple*.jar instead of slf4j-nop*.jar</li> <li> append the port name</li> </ul> <p>For example:</p> <pre> java -Dorg.slf4j.simpleLogger.defaultLogLevel=trace -classpath ${PTII}:${PTII}/lib/nrjavaserial-3.11.0.devel.jar:${PTII}/lib/xbjlib-1.1.0.nrjavaserial.jar:${PTII}/lib/slf4j-api-1.7.13.jar:${PTII}/lib/slf4j-simple-1.7.13.jar ptolemy.actor.lib.jjs.modules.xbee.test.XBeeHello /dev/tty.usbserial-DA01QZI2 </pre>
 */
public static void main(String[] args){
  if (args.length != 1) {
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str");
    Enumeration ports=CommPortIdentifier.getPortIdentifiers();
    while (ports.hasMoreElements()) {
      CommPortIdentifier identifier=(CommPortIdentifier)ports.nextElement();
      System.err.println(identifier.getName());
    }
    StringUtilities.exit(1);
  }
  int baudRate=9600;
  XBeeDevice xBeeDevice=new XBeeDevice(args[0],baudRate);
  String dataToSend="String_Node_Str";
  byte[] dataToSendBytes=dataToSend.getBytes(StandardCharsets.UTF_8);
  try {
    xBeeDevice.open();
    System.out.println("String_Node_Str" + dataToSend + "String_Node_Str");
    xBeeDevice.sendBroadcastData(dataToSendBytes);
    System.out.println("String_Node_Str");
  }
 catch (  Throwable throwable) {
    throwable.printStackTrace();
    StringUtilities.exit(1);
  }
 finally {
    xBeeDevice.close();
  }
}