nus-yam/ex-repair huggingface dataset:
Program: 62455
Project: 62455
Buggy source:
public void scheduleConnect(){
  logger.debug("String_Node_Str");
  cancelConnect();
  connectFuture=scheduler.schedule(connectRunnable,connectDelay,SECONDS);
}

Fixed version (ground truth):
public synchronized void scheduleConnect(){
  logger.debug("String_Node_Str");
  cancelConnect();
  connectFuture=scheduler.schedule(connectRunnable,connectDelay,SECONDS);
}
Program: 62456
Project: 62456
Buggy source:
@Before public void Before(){
  cubeCommand=new S_ConfigCommand(rfTestAddress,testRoom,ConfigCommandType.SetRoom);
}

Fixed version (ground truth):
@Before public void Before(){
  cubeCommand=new S_ConfigCommand(RF_TEST_ADDRESS,TEST_ROOM,ConfigCommandType.SetRoom);
}
Program: 62457
Project: 62457
Buggy source:
@Test public void removeRoomTest(){
  cubeCommand=new S_ConfigCommand(rfTestAddress,1,ConfigCommandType.RemoveRoom);
  String commandString=cubeCommand.getCommandString();
  assertEquals("String_Node_Str",commandString);
}

Fixed version (ground truth):
@Test public void removeRoomTest(){
  cubeCommand=new S_ConfigCommand(RF_TEST_ADDRESS,1,ConfigCommandType.RemoveRoom);
  String commandString=cubeCommand.getCommandString();
  assertEquals("String_Node_Str",commandString);
}
Program: 62458
Project: 62458
Buggy source:
@Test public void setRoomTest(){
  cubeCommand=new S_ConfigCommand(rfTestAddress,testRoom,ConfigCommandType.SetRoom);
  String commandString=cubeCommand.getCommandString();
  assertEquals("String_Node_Str",commandString);
}

Fixed version (ground truth):
@Test public void setRoomTest(){
  cubeCommand=new S_ConfigCommand(RF_TEST_ADDRESS,TEST_ROOM,ConfigCommandType.SetRoom);
  String commandString=cubeCommand.getCommandString();
  assertEquals("String_Node_Str",commandString);
}
Program: 62459
Project: 62459
Buggy source:
@Before public void Before(){
  message=new C_Message(rawData);
}

Fixed version (ground truth):
@Before public void Before(){
  message=new C_Message(RAW_DATA);
}
Program: 62460
Project: 62460
Buggy source:
@Before public void Before(){
  c_message=new C_Message(rawData);
  configuration=DeviceConfiguration.create(c_message);
}

Fixed version (ground truth):
@Before public void Before(){
  c_message=new C_Message(RAW_DATA);
  configuration=DeviceConfiguration.create(c_message);
}
Program: 62461
Project: 62461
Buggy source:
@Before public void Before(){
  message=new F_Message(rawData);
}

Fixed version (ground truth):
@Before public void Before(){
  message=new F_Message(RAW_DATA);
}
Program: 62462
Project: 62462
Buggy source:
@Before public void Before(){
  message=new H_Message(rawData);
}

Fixed version (ground truth):
@Before public void Before(){
  message=new H_Message(RAW_DATA);
}
Program: 62463
Project: 62463
Buggy source:
@Before public void Before(){
  message=new M_Message(rawData);
}

Fixed version (ground truth):
@Before public void Before(){
  message=new M_Message(RAW_DATA);
}
Program: 62464
Project: 62464
Buggy source:
@Test public void deviceInformationTypeTest1(){
  ArrayList<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(1);
  assertEquals(DeviceType.HeatingThermostat,deviceInformation.getDeviceType());
}

Fixed version (ground truth):
@Test public void deviceInformationTypeTest1(){
  List<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(1);
  assertEquals(DeviceType.HeatingThermostat,deviceInformation.getDeviceType());
}
Program: 62465
Project: 62465
Buggy source:
@Test public void deviceInformationTest(){
  ArrayList<DeviceInformation> allDevicesInformation=message.devices;
  assertEquals(8,allDevicesInformation.size());
  DeviceInformation deviceInformation=allDevicesInformation.get(0);
  assertEquals("String_Node_Str",deviceInformation.getName());
  assertEquals("String_Node_Str",deviceInformation.getRFAddress());
  assertEquals(1,deviceInformation.getRoomId());
  assertEquals("String_Node_Str",deviceInformation.getSerialNumber());
  assertEquals(DeviceType.HeatingThermostatPlus,deviceInformation.getDeviceType());
}

Fixed version (ground truth):
@Test public void deviceInformationTest(){
  List<DeviceInformation> allDevicesInformation=message.devices;
  assertEquals(8,allDevicesInformation.size());
  DeviceInformation deviceInformation=allDevicesInformation.get(0);
  assertEquals("String_Node_Str",deviceInformation.getName());
  assertEquals("String_Node_Str",deviceInformation.getRFAddress());
  assertEquals(1,deviceInformation.getRoomId());
  assertEquals("String_Node_Str",deviceInformation.getSerialNumber());
  assertEquals(DeviceType.HeatingThermostatPlus,deviceInformation.getDeviceType());
}
Program: 62466
Project: 62466
Buggy source:
@Test public void deviceInformationTypeTest3(){
  ArrayList<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(4);
  assertEquals(DeviceType.EcoSwitch,deviceInformation.getDeviceType());
}

Fixed version (ground truth):
@Test public void deviceInformationTypeTest3(){
  List<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(4);
  assertEquals(DeviceType.EcoSwitch,deviceInformation.getDeviceType());
}
Program: 62467
Project: 62467
Buggy source:
@Test public void deviceInformationTypeTest2(){
  ArrayList<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(2);
  assertEquals(DeviceType.WallMountedThermostat,deviceInformation.getDeviceType());
}

Fixed version (ground truth):
@Test public void deviceInformationTypeTest2(){
  List<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(2);
  assertEquals(DeviceType.WallMountedThermostat,deviceInformation.getDeviceType());
}
Program: 62468
Project: 62468
Buggy source:
@Test public void deviceInformationTypeTest4(){
  ArrayList<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(5);
  assertEquals(DeviceType.ShutterContact,deviceInformation.getDeviceType());
}

Fixed version (ground truth):
@Test public void deviceInformationTypeTest4(){
  List<DeviceInformation> allDevicesInformation=message.devices;
  DeviceInformation deviceInformation=allDevicesInformation.get(5);
  assertEquals(DeviceType.ShutterContact,deviceInformation.getDeviceType());
}
Program: 62469
Project: 62469
Buggy source:
@Test public void roomInformationTest(){
  ArrayList<RoomInformation> roomInformation=message.rooms;
  assertEquals(5,roomInformation.size());
  assertEquals("String_Node_Str",roomInformation.get(0).getName());
}

Fixed version (ground truth):
@Test public void roomInformationTest(){
  List<RoomInformation> roomInformation=message.rooms;
  assertEquals(5,roomInformation.size());
  assertEquals("String_Node_Str",roomInformation.get(0).getName());
}
Program: 62470
Project: 62470
Buggy source:
@Before public void Before(){
  message=new N_Message(rawData);
}

Fixed version (ground truth):
@Before public void Before(){
  message=new N_Message(RAW_DATA);
}
Program: 62471
Project: 62471
Buggy source:
@Before public void Before(){
  message1=new S_Message(rawData1);
  message2=new S_Message(rawData2);
}

Fixed version (ground truth):
@Before public void Before(){
  message1=new S_Message(RAW_DATA_1);
  message2=new S_Message(RAW_DATA_2);
}
Program: 62472
Project: 62472
Buggy source:
@Test public void fromHexTest(){
  int ar0=Utils.fromHex("String_Node_Str");
  int ar1=Utils.fromHex("String_Node_Str");
  int ar31=Utils.fromHex("String_Node_Str");
  int ar255=Utils.fromHex("String_Node_Str");
  assertEquals(0,ar0);
  assertEquals(1,ar1);
  assertEquals(31,ar31);
  assertEquals(255,ar255);
}

Fixed version (ground truth):
@Test public void fromHexTest(){
  assertEquals(0x00,Utils.fromHex("String_Node_Str"));
  assertEquals(0x01,Utils.fromHex("String_Node_Str"));
  assertEquals(0x1F,Utils.fromHex("String_Node_Str"));
  assertEquals(0xFF,Utils.fromHex("String_Node_Str"));
}
Program: 62473
Project: 62473
Buggy source:
/** 
 * Updates the Cube the NTP info
 * @param ntpServer1
 * @param ntpServer2
 */
public F_Command(String ntpServer1,String ntpServer2){
  this.ntpServer1=ntpServer1 != null ? ntpServer1 : "String_Node_Str";
  this.ntpServer2=ntpServer2 != null ? ntpServer2 : "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Updates the Cube the NTP info
 */
public F_Command(String ntpServer1,String ntpServer2){
  this.ntpServer1=ntpServer1 != null ? ntpServer1 : "String_Node_Str";
  this.ntpServer2=ntpServer2 != null ? ntpServer2 : "String_Node_Str";
}
Program: 62474
Project: 62474
Buggy source:
@Override public String getCommandString(){
  String servers;
  if (ntpServer1.length() > 0 && ntpServer2.length() > 0) {
    servers=ntpServer1 + "String_Node_Str" + ntpServer2;
  }
 else {
    servers=ntpServer1 + ntpServer2;
  }
  String cmd="String_Node_Str" + servers + '\r'+ '\n';
  return cmd;
}

Fixed version (ground truth):
@Override public String getCommandString(){
  final String servers;
  if (ntpServer1.length() > 0 && ntpServer2.length() > 0) {
    servers=ntpServer1 + "String_Node_Str" + ntpServer2;
  }
 else {
    servers=ntpServer1 + ntpServer2;
  }
  return "String_Node_Str" + servers + '\r'+ '\n';
}
Program: 62475
Project: 62475
Buggy source:
/** 
 * Handle setting the color. The Feican bulb has a separate command for the brightness. This brightness value is applied to any color value send. Because in the color command the brightness is also calculated this would mean the brightness will be applied twice; first when getting the RGB values and second in the bulb itself when passing a color value a earlier set brightness value is applied. To work around this, the brightness value is first send to the bulb and the color is send with a 100% brightness. So the brightness is controlled by the bulb. This is also needed for 2 reasons. First color temperature also works with brightness and thus to set it with color temperature the brightness must be set on the bulb. Secondly when setting brightness in the color widget only the brightness value is passed and no color value is available, therefore this binding then sets the brightness on the bulb.
 * @param channelUID Channel the command is for
 * @param command color to set
 * @throws IOException Connection to the bulb failed
 */
private void handleColor(ChannelUID channelUID,HSBType command) throws IOException {
  if (CHANNEL_COLOR.equals(channelUID.getId())) {
    handleBrightness(command.getBrightness());
    connection.sendCommand(commands.color(new HSBType(command.getHue(),command.getSaturation(),PercentType.HUNDRED)));
    handleOnOff((OnOffType)command.as(OnOffType.class));
  }
}

Fixed version (ground truth):
/** 
 * Handle setting the color. The Feican bulb has a separate command for the brightness. This brightness value is applied to any color value send. Because in the color command the brightness is also calculated this would mean the brightness will be applied twice; first when getting the RGB values and second in the bulb itself when passing a color value a earlier set brightness value is applied. To work around this, the brightness value is first send to the bulb and the color is send with a 100% brightness. So the brightness is controlled by the bulb. This is also needed for 2 reasons. First color temperature also works with brightness and thus to set it with color temperature the brightness must be set on the bulb. Secondly when setting brightness in the color widget only the brightness value is passed and no color value is available, therefore this binding then sets the brightness on the bulb.
 * @param channelUID Channel the command is for
 * @param command color to set
 * @throws IOException Connection to the bulb failed
 */
private void handleColor(ChannelUID channelUID,HSBType command) throws IOException {
  if (CHANNEL_COLOR.equals(channelUID.getId())) {
    handleBrightness(command.getBrightness());
    connection.sendCommand(commands.color(new HSBType(command.getHue(),command.getSaturation(),PercentType.HUNDRED)));
    handleOnOff(command);
  }
}
Program: 62476
Project: 62476
Buggy source:
/** 
 * Handle for   {@link OnOffType} commands.
 * @param channelUID
 * @param onOff value to set: on or off
 * @throws IOException Connection to the bulb failed
 */
private void handleOnOff(OnOffType onOff) throws IOException {
  connection.sendCommand(commands.switchOnOff(onOff));
}

Fixed version (ground truth):
/** 
 * Handle for   {@link DecimalType} as an {@link OnOffType} command.
 * @param value value to derive on or off state from
 * @throws IOException Connection to the bulb failed
 */
private void handleOnOff(DecimalType value) throws IOException {
  handleOnOff(DecimalType.ZERO.equals(value) ? OnOffType.OFF : OnOffType.ON);
}
Program: 62477
Project: 62477
Buggy source:
/** 
 * Handle percentType commands. Action depends on what channel send the command. For brightness related channels after the brightness command an extra onOff command is send to update the onOff state conform the brightness state.
 * @param channelUID Channel the command is for
 * @param command The percentType command
 * @throws IOException Connection to the bulb failed
 */
private void handlePercentage(ChannelUID channelUID,PercentType command) throws IOException {
  String id=channelUID.getId();
switch (id) {
case CHANNEL_COLOR:
    handleBrightness(command);
  handleOnOff((OnOffType)command.as(OnOffType.class));
break;
case CHANNEL_COLOR_TEMPERATURE:
handleColorTemperature(command);
handleOnOff(OnOffType.ON);
break;
case CHANNEL_PROGRAM_SPEED:
handleProgramSpeed(command);
handleOnOff(OnOffType.ON);
break;
}
}

Fixed version (ground truth):
/** 
 * Handle percentType commands. Action depends on what channel send the command. For brightness related channels after the brightness command an extra onOff command is send to update the onOff state conform the brightness state.
 * @param channelUID Channel the command is for
 * @param command The percentType command
 * @throws IOException Connection to the bulb failed
 */
private void handlePercentage(ChannelUID channelUID,PercentType command) throws IOException {
  String id=channelUID.getId();
switch (id) {
case CHANNEL_COLOR:
    handleBrightness(command);
  handleOnOff(command);
break;
case CHANNEL_COLOR_TEMPERATURE:
handleColorTemperature(command);
handleOnOff(OnOffType.ON);
break;
case CHANNEL_PROGRAM_SPEED:
handleProgramSpeed(command);
handleOnOff(OnOffType.ON);
break;
}
}
Program: 62478
Project: 62478
Buggy source:
private boolean handleBrightness(String channelId,Connection connection,Command command,TPLinkSmartHomeConfiguration configuration) throws IOException {
  HasErrorResponse response=null;
  if (command instanceof OnOffType) {
    response=setOnOffState(connection,(OnOffType)command);
  }
 else   if (command instanceof DecimalType) {
    DecimalType decimalCommand=(DecimalType)command;
    response=commands.setDimmerBrightnessResponse(connection.sendCommand(commands.setDimmerBrightness((decimalCommand).intValue())));
    checkErrors(response);
    response=setOnOffState(connection,(OnOffType)decimalCommand.as(OnOffType.class));
  }
  checkErrors(response);
  return response != null;
}

Fixed version (ground truth):
private boolean handleBrightness(String channelId,Connection connection,Command command,TPLinkSmartHomeConfiguration configuration) throws IOException {
  HasErrorResponse response=null;
  if (command instanceof OnOffType) {
    response=setOnOffState(connection,(OnOffType)command);
  }
 else   if (command instanceof DecimalType) {
    DecimalType decimalCommand=(DecimalType)command;
    response=commands.setDimmerBrightnessResponse(connection.sendCommand(commands.setDimmerBrightness((decimalCommand).intValue())));
    checkErrors(response);
    response=setOnOffState(connection,DecimalType.ZERO.equals(decimalCommand) ? OnOffType.OFF : OnOffType.ON);
  }
  checkErrors(response);
  return response != null;
}
Program: 62479
Project: 62479
Buggy source:
protected void createAndLinkItems(){
  thing.getChannels().forEach(c -> {
    String itemName=getItemName(c.getUID().getId());
    GenericItem item=itemFactory.createItem(c.getAcceptedItemType(),itemName);
    if (item != null) {
      itemRegistry.add(item);
    }
    managedItemChannelLinkProvider.add(new ItemChannelLink(itemName,c.getUID()));
  }
);
}

Fixed version (ground truth):
protected void createAndLinkItems(){
  thing.getChannels().forEach(c -> {
    String itemName=getItemName(c.getUID().getId());
    Item item=itemFactory.createItem(c.getAcceptedItemType(),itemName);
    if (item != null) {
      itemRegistry.add(item);
    }
    managedItemChannelLinkProvider.add(new ItemChannelLink(itemName,c.getUID()));
  }
);
}
Program: 62482
Project: 62482
Buggy source:
@Override public void handleCommand(ChannelUID channelUID,Command command){
  logger.debug("String_Node_Str",channelUID,command);
  if (command instanceof RefreshType) {
    return;
  }
  if (dscAlarmBridgeHandler != null && dscAlarmBridgeHandler.isConnected() && channelUID.getId() == ZONE_BYPASS_MODE) {
    if (command == OnOffType.OFF) {
      String data=String.valueOf(getPartitionNumber()) + "String_Node_Str" + String.format("String_Node_Str",getZoneNumber())+ "String_Node_Str";
      dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.KeySequence,data);
    }
 else     if (command == OnOffType.ON) {
      String data=String.valueOf(getPartitionNumber()) + "String_Node_Str" + String.format("String_Node_Str",getZoneNumber())+ "String_Node_Str";
      dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.KeySequence,data);
    }
  }
}

Fixed version (ground truth):
@Override public void handleCommand(ChannelUID channelUID,Command command){
  logger.debug("String_Node_Str",channelUID,command);
  if (command instanceof RefreshType) {
    return;
  }
  if (dscAlarmBridgeHandler != null && dscAlarmBridgeHandler.isConnected() && channelUID.getId().equals(ZONE_BYPASS_MODE)) {
    String data=String.valueOf(getPartitionNumber()) + "String_Node_Str" + String.format("String_Node_Str",getZoneNumber())+ "String_Node_Str";
    dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.KeySequence,data);
  }
}
Program: 62483
Project: 62483
Buggy source:
private void setVolumeInternal(int volume){
  JsonObject params=new JsonObject();
  params.addProperty("String_Node_Str",this.volume);
  socket.callMethod("String_Node_Str",params);
}

Fixed version (ground truth):
private void setVolumeInternal(int volume){
  JsonObject params=new JsonObject();
  params.addProperty("String_Node_Str",volume);
  socket.callMethod("String_Node_Str",params);
}
Program: 62486
Project: 62486
Buggy source:
@Override void execute(ChannelUID channelUID,Command command){
  if (CHANNEL_SWITCH_CH0.equals(channelUID.getId())) {
    String status=command.toString().toLowerCase();
    getXiaomiBridgeHandler().writeToDevice(getItemId(),new String[]{CHANNEL_0},new Object[]{status});
  }
  logger.error("String_Node_Str",command,channelUID);
}

Fixed version (ground truth):
@Override void execute(ChannelUID channelUID,Command command){
  if (CHANNEL_SWITCH_CH0.equals(channelUID.getId())) {
    String status=command.toString().toLowerCase();
    getXiaomiBridgeHandler().writeToDevice(getItemId(),new String[]{CHANNEL_0},new Object[]{status});
    return;
  }
  logger.error("String_Node_Str",command,channelUID);
}
Program: 62487
Project: 62487
Buggy source:
@Override public void onDataReceived(JsonObject message){
  logger.trace("String_Node_Str",message);
  String sid=message.has("String_Node_Str") ? message.get("String_Node_Str").getAsString() : null;
  String command=message.get("String_Node_Str").getAsString();
  updateDeviceStatus(sid);
  updateStatus(ThingStatus.ONLINE);
switch (command) {
case "String_Node_Str":
    return;
case "String_Node_Str":
  if (message.has("String_Node_Str")) {
    this.gatewayToken=message.get("String_Node_Str").getAsString();
  }
break;
case "String_Node_Str":
JsonArray devices=PARSER.parse(message.get("String_Node_Str").getAsString()).getAsJsonArray();
for (JsonElement deviceId : devices) {
String device=deviceId.getAsString();
sendCommandToBridge("String_Node_Str",device);
}
sendCommandToBridge("String_Node_Str",getGatewaySid());
return;
case "String_Node_Str":
logger.debug("String_Node_Str",sid);
retend(sid,message);
break;
case "String_Node_Str":
logger.debug("String_Node_Str",sid);
break;
}
notifyListeners(command,message);
}

Fixed version (ground truth):
@Override public void onDataReceived(JsonObject message){
  logger.trace("String_Node_Str",message);
  String sid=message.has("String_Node_Str") ? message.get("String_Node_Str").getAsString() : null;
  String command=message.get("String_Node_Str").getAsString();
  updateDeviceStatus(sid);
  updateStatus(ThingStatus.ONLINE);
switch (command) {
case "String_Node_Str":
    return;
case "String_Node_Str":
  if (message.has("String_Node_Str")) {
    this.gatewayToken=message.get("String_Node_Str").getAsString();
  }
break;
case "String_Node_Str":
JsonArray devices=PARSER.parse(message.get("String_Node_Str").getAsString()).getAsJsonArray();
for (JsonElement deviceId : devices) {
String device=deviceId.getAsString();
sendCommandToBridge("String_Node_Str",device);
}
sendCommandToBridge("String_Node_Str",getGatewaySid());
return;
case "String_Node_Str":
logger.debug("String_Node_Str",sid);
defer(sid,message);
break;
case "String_Node_Str":
logger.debug("String_Node_Str",sid);
break;
}
notifyListeners(command,message);
}
Program: 62488
Project: 62488
Buggy source:
@Override public synchronized void run(){
synchronized (retentionBox) {
    retentionBox.remove(sid);
  }
}

Fixed version (ground truth):
@Override public synchronized void run(){
synchronized (retentionInbox) {
    retentionInbox.remove(sid);
  }
}
Program: 62489
Project: 62489
Buggy source:
@Override public void handleCommand(ChannelUID channelUID,Command command){
  logger.debug("String_Node_Str",getItemId(),channelUID,command);
  if (command instanceof RefreshType) {
    JsonObject message=getXiaomiBridgeHandler().getRetentedMessage(getItemId());
    if (message != null) {
      String cmd=message.get("String_Node_Str").getAsString();
      logger.debug("String_Node_Str",getItemId());
      onItemUpdate(getItemId(),cmd,message);
    }
    return;
  }
  execute(channelUID,command);
}

Fixed version (ground truth):
@Override public void handleCommand(ChannelUID channelUID,Command command){
  logger.debug("String_Node_Str",getItemId(),channelUID,command);
  if (command instanceof RefreshType) {
    JsonObject message=getXiaomiBridgeHandler().getDeferredMessage(getItemId());
    if (message != null) {
      String cmd=message.get("String_Node_Str").getAsString();
      logger.debug("String_Node_Str",getItemId());
      onItemUpdate(getItemId(),cmd,message);
    }
    return;
  }
  execute(channelUID,command);
}
Program: 62490
Project: 62490
Buggy source:
@Override public void initialize(){
  setItemId((String)getConfig().get(ITEM_ID));
  onlineCheckTask=scheduler.scheduleWithFixedDelay(new Runnable(){
    @Override public void run(){
      updateThingStatus();
    }
  }
,0,ONLINE_TIMEOUT_MILLIS / 2,TimeUnit.MILLISECONDS);
}

Fixed version (ground truth):
@Override public void initialize(){
  setItemId((String)getConfig().get(ITEM_ID));
  onlineCheckTask=scheduler.scheduleWithFixedDelay(this::updateThingStatus,0,ONLINE_TIMEOUT_MILLIS / 2,TimeUnit.MILLISECONDS);
}
Program: 62491
Project: 62491
Buggy source:
/** 
 * Use the native ping utility of the operating system to detect device presence.
 * @param hostname The DNS name, IPv4 or IPv6 address. Must not be null.
 * @param timeoutInMS Timeout in milliseconds. Be aware that DNS resolution is not part of this timeout.
 * @return Returns true if the device responded
 * @throws IOException The ping command could probably not be found
 */
public boolean nativePing(IpPingMethodEnum method,String hostname,int timeoutInMS) throws IOException, InterruptedException {
  Process proc;
switch (method) {
case IPUTILS_LINUX_PING:
    proc=new ProcessBuilder("String_Node_Str","String_Node_Str",String.valueOf(timeoutInMS / 1000),"String_Node_Str","String_Node_Str",hostname).start();
  break;
case MAC_OS_PING:
proc=new ProcessBuilder("String_Node_Str","String_Node_Str",String.valueOf(timeoutInMS / 1000),"String_Node_Str","String_Node_Str",hostname).start();
break;
case WINDOWS_PING:
proc=new ProcessBuilder("String_Node_Str","String_Node_Str",String.valueOf(timeoutInMS),"String_Node_Str","String_Node_Str",hostname).start();
break;
case JAVA_PING:
default :
return false;
}
return proc.waitFor() == 0;
}

Fixed version (ground truth):
/** 
 * Use the native ping utility of the operating system to detect device presence.
 * @param hostname The DNS name, IPv4 or IPv6 address. Must not be null.
 * @param timeoutInMS Timeout in milliseconds. Be aware that DNS resolution is not part of this timeout.
 * @return Returns true if the device responded
 * @throws IOException The ping command could probably not be found
 */
public boolean nativePing(IpPingMethodEnum method,String hostname,int timeoutInMS) throws IOException, InterruptedException {
  Process proc;
switch (method) {
case IPUTILS_LINUX_PING:
    proc=new ProcessBuilder("String_Node_Str","String_Node_Str",String.valueOf(timeoutInMS / 1000),"String_Node_Str","String_Node_Str",hostname).start();
  break;
case MAC_OS_PING:
proc=new ProcessBuilder("String_Node_Str","String_Node_Str",String.valueOf(timeoutInMS / 1000),"String_Node_Str","String_Node_Str",hostname).start();
break;
case WINDOWS_PING:
proc=new ProcessBuilder("String_Node_Str","String_Node_Str",String.valueOf(timeoutInMS),"String_Node_Str","String_Node_Str",hostname).start();
break;
case JAVA_PING:
default :
return false;
}
if (method != IpPingMethodEnum.WINDOWS_PING) {
return proc.waitFor() == 0;
}
int result=proc.waitFor();
if (result != 0) {
return false;
}
try (BufferedReader r=new BufferedReader(new InputStreamReader(proc.getInputStream()))){
String line=r.readLine();
if (line == null) {
throw new IOException("String_Node_Str");
}
do {
if (line.contains("String_Node_Str") || line.contains("String_Node_Str") || line.contains("String_Node_Str")) {
return false;
}
line=r.readLine();
}
 while (line != null);
return true;
}
 }
Program: 62492
Project: 62492
Buggy source:
@Override public Void parse(TclScriptDataList resultList) throws IOException {
  if (resultList.getEntries() != null) {
    Map<String,HmDevice> devicesByAddress=new HashMap<String,HmDevice>();
    for (    HmDevice device : devices) {
      devicesByAddress.put(device.getAddress(),device);
    }
    for (    TclScriptDataEntry entry : resultList.getEntries()) {
      HmDevice device=devicesByAddress.get(getAddress(entry.name));
      if (device != null) {
        device.setName(entry.value);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Void parse(TclScriptDataList resultList) throws IOException {
  if (resultList.getEntries() != null) {
    Map<String,HmDevice> devicesByAddress=new HashMap<String,HmDevice>();
    for (    HmDevice device : devices) {
      devicesByAddress.put(device.getAddress(),device);
    }
    for (    TclScriptDataEntry entry : resultList.getEntries()) {
      HmDevice device=devicesByAddress.get(getSanitizedAddress(entry.name));
      if (device != null) {
        device.setName(entry.value);
      }
    }
  }
  return null;
}
Program: 62493
Project: 62493
Buggy source:
@Override public List<String> parse(Object[] message) throws IOException {
  List<String> adresses=new ArrayList<String>();
  if (message != null && message.length > 1) {
    Object[] data=(Object[])message[1];
    for (int i=0; i < message.length; i++) {
      String address=toString(data[i]);
      boolean isDevice=!StringUtils.contains(address,"String_Node_Str") && !StringUtils.startsWithIgnoreCase(address,"String_Node_Str");
      if (isDevice) {
        adresses.add(address);
      }
    }
  }
  return adresses;
}

Fixed version (ground truth):
@Override public List<String> parse(Object[] message) throws IOException {
  List<String> adresses=new ArrayList<String>();
  if (message != null && message.length > 1) {
    Object[] data=(Object[])message[1];
    for (int i=0; i < message.length; i++) {
      String address=getSanitizedAddress(data[i]);
      boolean isDevice=!StringUtils.contains(address,"String_Node_Str") && !StringUtils.startsWithIgnoreCase(address,"String_Node_Str");
      if (isDevice) {
        adresses.add(address);
      }
    }
  }
  return adresses;
}
Program: 62494
Project: 62494
Buggy source:
@Override public HmDatapointInfo parse(Object[] message) throws IOException {
  String address;
  Integer channel=0;
  String addressWithChannel=toString(message[1]);
  if ("String_Node_Str".equals(addressWithChannel)) {
    address=HmDevice.ADDRESS_GATEWAY_EXTRAS;
    channel=HmChannel.CHANNEL_NUMBER_VARIABLE;
  }
 else {
    String[] configParts=StringUtils.trimToEmpty(addressWithChannel).split("String_Node_Str");
    address=getAddress(configParts[0]);
    if (configParts.length > 1) {
      channel=NumberUtils.createInteger(configParts[1]);
    }
  }
  String name=toString(message[2]);
  value=message[3];
  return new HmDatapointInfo(address,HmParamsetType.VALUES,channel,name);
}

Fixed version (ground truth):
@Override public HmDatapointInfo parse(Object[] message) throws IOException {
  String address;
  Integer channel=0;
  String addressWithChannel=toString(message[1]);
  if ("String_Node_Str".equals(addressWithChannel)) {
    address=HmDevice.ADDRESS_GATEWAY_EXTRAS;
    channel=HmChannel.CHANNEL_NUMBER_VARIABLE;
  }
 else {
    String[] configParts=StringUtils.trimToEmpty(addressWithChannel).split("String_Node_Str");
    address=getSanitizedAddress(configParts[0]);
    if (configParts.length > 1) {
      channel=NumberUtils.createInteger(configParts[1]);
    }
  }
  String name=toString(message[2]);
  value=message[3];
  return new HmDatapointInfo(address,HmParamsetType.VALUES,channel,name);
}
Program: 62495
Project: 62495
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public Void parse(Object[] message) throws IOException {
  Map<String,HmDevice> devicesById=new HashMap<String,HmDevice>();
  for (  HmDevice device : devices) {
    devicesById.put(device.getHomegearId(),device);
  }
  message=(Object[])message[0];
  for (int i=0; i < message.length; i++) {
    Map<String,?> data=(Map<String,?>)message[i];
    String id=toString(data.get("String_Node_Str"));
    String name=toString(data.get("String_Node_Str"));
    HmDevice device=devicesById.get(getAddress(id));
    if (device != null) {
      device.setName(name);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public Void parse(Object[] message) throws IOException {
  Map<String,HmDevice> devicesById=new HashMap<String,HmDevice>();
  for (  HmDevice device : devices) {
    devicesById.put(device.getHomegearId(),device);
  }
  message=(Object[])message[0];
  for (int i=0; i < message.length; i++) {
    Map<String,?> data=(Map<String,?>)message[i];
    String id=toString(data.get("String_Node_Str"));
    String name=toString(data.get("String_Node_Str"));
    HmDevice device=devicesById.get(getSanitizedAddress(id));
    if (device != null) {
      device.setName(name);
    }
  }
  return null;
}
Program: 62496
Project: 62496
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public ListBidcosInterfacesParser parse(Object[] message) throws IOException {
  if (message != null && message.length > 0) {
    message=(Object[])message[0];
    for (int i=0; i < message.length; i++) {
      Map<String,?> mapMessage=(Map<String,?>)message[i];
      boolean isDefault=toBoolean(mapMessage.get("String_Node_Str"));
      if (isDefault) {
        type=toString(mapMessage.get("String_Node_Str"));
        firmware=toString(mapMessage.get("String_Node_Str"));
        gatewayAddress=toString(mapMessage.get("String_Node_Str"));
      }
    }
  }
  return this;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public ListBidcosInterfacesParser parse(Object[] message) throws IOException {
  if (message != null && message.length > 0) {
    message=(Object[])message[0];
    for (int i=0; i < message.length; i++) {
      Map<String,?> mapMessage=(Map<String,?>)message[i];
      boolean isDefault=toBoolean(mapMessage.get("String_Node_Str"));
      if (isDefault) {
        type=toString(mapMessage.get("String_Node_Str"));
        firmware=toString(mapMessage.get("String_Node_Str"));
        gatewayAddress=getSanitizedAddress(mapMessage.get("String_Node_Str"));
      }
    }
  }
  return this;
}
Program: 62497
Project: 62497
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public Collection<HmDevice> parse(Object[] message) throws IOException {
  message=(Object[])message[0];
  Map<String,HmDevice> devices=new HashMap<String,HmDevice>();
  for (int i=0; i < message.length; i++) {
    Map<String,?> data=(Map<String,?>)message[i];
    boolean isDevice=!StringUtils.contains(toString(data.get("String_Node_Str")),"String_Node_Str");
    if (isDevice) {
      String address=getAddress(data.get("String_Node_Str"));
      String type=MiscUtils.validateCharacters(toString(data.get("String_Node_Str")),"String_Node_Str","String_Node_Str");
      String id=toString(data.get("String_Node_Str"));
      String firmware=toString(data.get("String_Node_Str"));
      devices.put(address,new HmDevice(address,hmInterface,type,config.getGatewayInfo().getId(),id,firmware));
    }
 else {
      String deviceAddress=getAddress(data.get("String_Node_Str"));
      HmDevice device=devices.get(deviceAddress);
      String type=toString(data.get("String_Node_Str"));
      Integer number=toInteger(data.get("String_Node_Str"));
      device.addChannel(new HmChannel(type,number));
    }
  }
  return devices.values();
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public Collection<HmDevice> parse(Object[] message) throws IOException {
  message=(Object[])message[0];
  Map<String,HmDevice> devices=new HashMap<String,HmDevice>();
  for (int i=0; i < message.length; i++) {
    Map<String,?> data=(Map<String,?>)message[i];
    boolean isDevice=!StringUtils.contains(toString(data.get("String_Node_Str")),"String_Node_Str");
    if (isDevice) {
      String address=getSanitizedAddress(data.get("String_Node_Str"));
      String type=MiscUtils.validateCharacters(toString(data.get("String_Node_Str")),"String_Node_Str","String_Node_Str");
      String id=toString(data.get("String_Node_Str"));
      String firmware=toString(data.get("String_Node_Str"));
      devices.put(address,new HmDevice(address,hmInterface,type,config.getGatewayInfo().getId(),id,firmware));
    }
 else {
      String deviceAddress=getSanitizedAddress(data.get("String_Node_Str"));
      HmDevice device=devices.get(deviceAddress);
      String type=toString(data.get("String_Node_Str"));
      Integer number=toInteger(data.get("String_Node_Str"));
      device.addChannel(new HmChannel(type,number));
    }
  }
  return devices.values();
}
Program: 62498
Project: 62498
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public List<String> parse(Object[] message) throws IOException {
  List<String> adresses=new ArrayList<String>();
  if (message != null && message.length > 1) {
    message=(Object[])message[1];
    for (int i=0; i < message.length; i++) {
      Map<String,?> data=(Map<String,?>)message[i];
      String address=toString(data.get("String_Node_Str"));
      boolean isDevice=!StringUtils.contains(address,"String_Node_Str") && !StringUtils.startsWithIgnoreCase(address,"String_Node_Str");
      if (isDevice) {
        adresses.add(address);
      }
    }
  }
  return adresses;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public List<String> parse(Object[] message) throws IOException {
  List<String> adresses=new ArrayList<String>();
  if (message != null && message.length > 1) {
    message=(Object[])message[1];
    for (int i=0; i < message.length; i++) {
      Map<String,?> data=(Map<String,?>)message[i];
      String address=toString(data.get("String_Node_Str"));
      boolean isDevice=!StringUtils.contains(address,"String_Node_Str") && !StringUtils.startsWithIgnoreCase(address,"String_Node_Str");
      if (isDevice) {
        adresses.add(getSanitizedAddress(address));
      }
    }
  }
  return adresses;
}
Program: 62499
Project: 62499
Buggy source:
@Test public void validateTemperatureConversion(){
  assertEquals(BigDecimal.ZERO,HeatingModel.fromCelsius(null));
  assertEquals(HeatingModel.TEMP_FRITZ_MIN,HeatingModel.fromCelsius(BigDecimal.ONE));
  assertEquals(HeatingModel.TEMP_FRITZ_MIN,HeatingModel.fromCelsius(new BigDecimal(7.5)));
  assertEquals(new BigDecimal(16),HeatingModel.fromCelsius(new BigDecimal(8)));
  assertEquals(new BigDecimal(28),HeatingModel.fromCelsius(new BigDecimal(14)));
  assertEquals(new BigDecimal(29),HeatingModel.fromCelsius(new BigDecimal(14.5)));
  assertEquals(new BigDecimal(56),HeatingModel.fromCelsius(new BigDecimal(28)));
  assertEquals(HeatingModel.TEMP_FRITZ_MAX,HeatingModel.fromCelsius(new BigDecimal(28.5)));
  assertEquals(HeatingModel.TEMP_FRITZ_MAX,HeatingModel.fromCelsius(new BigDecimal(30)));
  assertEquals(BigDecimal.ZERO,HeatingModel.toCelsius(null));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal(28)));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal(29)));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal(253)));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal(254)));
}

Fixed version (ground truth):
@Test public void validateTemperatureConversion(){
  assertEquals(BigDecimal.ZERO,HeatingModel.fromCelsius(null));
  assertEquals(HeatingModel.TEMP_FRITZ_MIN,HeatingModel.fromCelsius(BigDecimal.ONE));
  assertEquals(HeatingModel.TEMP_FRITZ_MIN,HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(HeatingModel.TEMP_FRITZ_MAX,HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(HeatingModel.TEMP_FRITZ_MAX,HeatingModel.fromCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(BigDecimal.ZERO,HeatingModel.toCelsius(null));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal("String_Node_Str")));
  assertEquals(new BigDecimal("String_Node_Str"),HeatingModel.toCelsius(new BigDecimal("String_Node_Str")));
}
Program: 62501
Project: 62501
Buggy source:
public static BigDecimal fromCelsius(BigDecimal celsiusValue){
  if (celsiusValue == null) {
    return BigDecimal.ZERO;
  }
 else   if (TEMP_CELSIUS_MIN.compareTo(celsiusValue) == 1) {
    return TEMP_FRITZ_MIN;
  }
 else   if (TEMP_CELSIUS_MAX.compareTo(celsiusValue) == -1) {
    return TEMP_FRITZ_MAX;
  }
  return celsiusValue.divide(TEMP_FACTOR);
}

Fixed version (ground truth):
public static BigDecimal fromCelsius(BigDecimal celsiusValue){
  if (celsiusValue == null) {
    return BigDecimal.ZERO;
  }
 else   if (TEMP_CELSIUS_MIN.compareTo(celsiusValue) == 1) {
    return TEMP_FRITZ_MIN;
  }
 else   if (TEMP_CELSIUS_MAX.compareTo(celsiusValue) == -1) {
    return TEMP_FRITZ_MAX;
  }
  return BIG_DECIMAL_TWO.multiply(celsiusValue);
}
Program: 62502
Project: 62502
Buggy source:
public static BigDecimal toCelsius(BigDecimal fritzValue){
  if (fritzValue == null) {
    return BigDecimal.ZERO;
  }
 else   if (TEMP_FRITZ_ON.compareTo(fritzValue) == 0) {
    return TEMP_CELSIUS_MAX.add(new BigDecimal("String_Node_Str"));
  }
 else   if (TEMP_FRITZ_OFF.compareTo(fritzValue) == 0) {
    return TEMP_CELSIUS_MIN.subtract(new BigDecimal("String_Node_Str"));
  }
  return TEMP_FACTOR.multiply(fritzValue);
}

Fixed version (ground truth):
public static BigDecimal toCelsius(BigDecimal fritzValue){
  if (fritzValue == null) {
    return BigDecimal.ZERO;
  }
 else   if (TEMP_FRITZ_ON.compareTo(fritzValue) == 0) {
    return TEMP_CELSIUS_MAX.add(BIG_DECIMAL_TWO);
  }
 else   if (TEMP_FRITZ_OFF.compareTo(fritzValue) == 0) {
    return TEMP_CELSIUS_MIN.subtract(BIG_DECIMAL_TWO);
  }
  return TEMP_FACTOR.multiply(fritzValue);
}
Program: 62503
Project: 62503
Buggy source:
@GET @Produces({MediaType.TEXT_PLAIN}) public Response getValue(@PathParam("String_Node_Str") String actionName){
  if ("String_Node_Str".equalsIgnoreCase(actionName)) {
    logger.debug("String_Node_Str");
    ClientInstaller.getInstance().check(true);
  }
 else {
    logger.error("String_Node_Str",actionName);
    return Response.status(404).build();
  }
  return Response.ok().build();
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.TEXT_PLAIN}) public Response getValue(@PathParam("String_Node_Str") String actionName){
  if ("String_Node_Str".equalsIgnoreCase(actionName)) {
    logger.debug("String_Node_Str");
    ClientInstaller.getInstance().check(true);
  }
 else {
    logger.error("String_Node_Str",actionName);
    return Response.status(404).build();
  }
  return Response.ok().build();
}
Program: 62504
Project: 62504
Buggy source:
private void readConfiguration(final Map<String,Object> properties){
  if (properties != null) {
    setProperties(properties);
    if (properties.get(Config.COMETVISU_WEBFOLDER_PROPERTY) != null) {
      Config.COMETVISU_WEBFOLDER=(String)properties.get(Config.COMETVISU_WEBFOLDER_PROPERTY);
    }
    if (properties.get(Config.COMETVISU_WEBAPP_ALIAS_PROPERTY) != null) {
      Config.COMETVISU_WEBAPP_ALIAS=(String)properties.get(Config.COMETVISU_WEBAPP_ALIAS_PROPERTY);
    }
    if (properties.get(Config.COMETVISU_AUTODOWNLOAD_PROPERTY) != null) {
      Boolean newValue=(Boolean)properties.get(Config.COMETVISU_AUTODOWNLOAD_PROPERTY);
      boolean changed=Config.COMETVISU_AUTO_DOWNLOAD != newValue;
      Config.COMETVISU_AUTO_DOWNLOAD=newValue;
      if (Config.COMETVISU_AUTO_DOWNLOAD && changed) {
        installer.check();
      }
      Config.COMETVISU_AUTO_DOWNLOAD=newValue;
    }
    for (    String key : properties.keySet()) {
      String[] parts=key.split("String_Node_Str");
      String propKey=parts.length > 1 ? parts[1] : parts[0];
      String propPid=parts.length > 1 ? parts[0] : "String_Node_Str";
      logger.debug("String_Node_Str",propPid,propKey,properties.get(key),parts.length);
      if (!propPid.isEmpty()) {
        if (Config.configMappings.containsKey(propPid)) {
          Config.configMappings.get(propPid).put(propKey,properties.get(key));
        }
      }
    }
  }
}

Fixed version (ground truth):
private void readConfiguration(final Map<String,Object> properties){
  if (properties != null) {
    setProperties(properties);
    if (properties.get(Config.COMETVISU_WEBFOLDER_PROPERTY) != null) {
      Config.COMETVISU_WEBFOLDER=(String)properties.get(Config.COMETVISU_WEBFOLDER_PROPERTY);
    }
    if (properties.get(Config.COMETVISU_WEBAPP_ALIAS_PROPERTY) != null) {
      Config.COMETVISU_WEBAPP_ALIAS=(String)properties.get(Config.COMETVISU_WEBAPP_ALIAS_PROPERTY);
    }
    if (properties.get(Config.COMETVISU_AUTODOWNLOAD_PROPERTY) != null) {
      Boolean newValue=Boolean.valueOf((String)properties.get(Config.COMETVISU_AUTODOWNLOAD_PROPERTY));
      boolean changed=Config.COMETVISU_AUTO_DOWNLOAD != newValue;
      Config.COMETVISU_AUTO_DOWNLOAD=newValue;
      if (Config.COMETVISU_AUTO_DOWNLOAD && changed) {
        installer.check();
      }
      Config.COMETVISU_AUTO_DOWNLOAD=newValue;
    }
    for (    String key : properties.keySet()) {
      String[] parts=key.split("String_Node_Str");
      String propKey=parts.length > 1 ? parts[1] : parts[0];
      String propPid=parts.length > 1 ? parts[0] : "String_Node_Str";
      logger.debug("String_Node_Str",propPid,propKey,properties.get(key),parts.length);
      if (!propPid.isEmpty()) {
        if (Config.configMappings.containsKey(propPid)) {
          Config.configMappings.get(propPid).put(propKey,properties.get(key));
        }
      }
    }
  }
}
Program: 62505
Project: 62505
Buggy source:
private void restorePlayerState(){
  logger.debug("String_Node_Str");
  if (!playerState.isStopped()) {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.playPlaylistItem(mac,playerState.getPlaylistIndex());
    squeezeBoxServerHandler.setPlayingTime(mac,playerState.getPlayingTime());
  }
 else   if (!playerState.isPlaying()) {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.pause(mac);
  }
 else {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.stop(mac);
  }
  squeezeBoxServerHandler.setVolume(mac,playerState.getVolume());
  if (playerState.isShuffling()) {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.setShuffleMode(mac,playerState.getShuffle());
  }
  if (playerState.isRepeating()) {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.setRepeatMode(mac,playerState.getRepeat());
  }
  if (playerState.isMuted()) {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.mute(mac);
  }
  if (!playerState.isPoweredOn()) {
    logger.debug("String_Node_Str");
    squeezeBoxServerHandler.powerOff(mac);
  }
}

Fixed version (ground truth):
private void restorePlayerState(){
  logger.debug("String_Node_Str");
  squeezeBoxServerHandler.playPlaylistItem(mac,playerState.getPlaylistIndex());
  squeezeBoxServerHandler.setPlayingTime(mac,playerState.getPlayingTime());
switch (playerState.getPlayState()) {
case PLAY:
    logger.debug("String_Node_Str");
  break;
case PAUSE:
logger.debug("String_Node_Str");
squeezeBoxServerHandler.pause(mac);
break;
case STOP:
logger.debug("String_Node_Str");
squeezeBoxServerHandler.stop(mac);
break;
}
squeezeBoxServerHandler.setVolume(mac,playerState.getVolume());
if (playerState.isShuffling()) {
logger.debug("String_Node_Str");
squeezeBoxServerHandler.setShuffleMode(mac,playerState.getShuffle());
}
if (playerState.isRepeating()) {
logger.debug("String_Node_Str");
squeezeBoxServerHandler.setRepeatMode(mac,playerState.getRepeat());
}
if (playerState.isMuted()) {
logger.debug("String_Node_Str");
squeezeBoxServerHandler.mute(mac);
}
if (!playerState.isPoweredOn()) {
logger.debug("String_Node_Str");
squeezeBoxServerHandler.powerOff(mac);
}
}
Program: 62506
Project: 62506
Buggy source:
/** 
 * Download and cache the image data from an URL.
 * @param url The URL of the image to be downloaded.
 * @return A RawType object containing the image, null if the content type could not be found or the content type isnot an image.
 */
private RawType downloadImage(String url){
  if (StringUtils.isNotEmpty(url)) {
    if (!IMAGE_CACHE.containsKey(url)) {
      IMAGE_CACHE.put(url,() -> {
        logger.debug("String_Node_Str",url);
        return HttpUtil.downloadImage(url);
      }
);
    }
    RawType image=IMAGE_CACHE.get(url);
    if (image == null) {
      logger.debug("String_Node_Str",url);
      return null;
    }
 else {
      return image;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Download and cache the image data from an URL.
 * @param url The URL of the image to be downloaded.
 * @return A RawType object containing the image, null if the content type could not be found or the content type isnot an image.
 */
private RawType downloadImage(String mac,String url){
  if (isMe(mac)) {
    if (StringUtils.isNotEmpty(url)) {
      RawType image=IMAGE_CACHE.putIfAbsentAndGet(url,() -> {
        logger.debug("String_Node_Str",url);
        try {
          return HttpUtil.downloadImage(url);
        }
 catch (        IllegalArgumentException e) {
          logger.debug("String_Node_Str",url,e);
          return null;
        }
      }
);
      if (image == null) {
        logger.debug("String_Node_Str",url);
        return null;
      }
 else {
        return image;
      }
    }
  }
  return null;
}