Program: 62623
Project: 62623
Buggy source:
public static Device update(byte[] raw,List<DeviceConfiguration> configurations,Device device){
  String rfAddress=device.getRFAddress();
  boolean[] bits1=Utils.getBits(Utils.fromByte(raw[4]));
  boolean[] bits2=Utils.getBits(Utils.fromByte(raw[5]));
  device.setInitialized(bits1[1]);
  device.setAnswer(bits1[2]);
  device.setError(bits1[3]);
  device.setValid(bits1[4]);
  device.setDstSettingActive(bits2[3]);
  device.setGatewayKnown(bits2[4]);
  device.setPanelLocked(bits2[5]);
  device.setLinkStatusError(bits2[6]);
  device.setBatteryLow(bits2[7]);
  logger.trace("String_Node_Str",rfAddress,device.getType().toString(),raw.length,Utils.getHex(raw));
switch (device.getType()) {
case WallMountedThermostat:
case HeatingThermostat:
case HeatingThermostatPlus:
    HeatingThermostat heatingThermostat=(HeatingThermostat)device;
  if (bits2[1] == false && bits2[0] == false) {
    heatingThermostat.setMode(ThermostatModeType.AUTOMATIC);
  }
 else   if (bits2[1] == false && bits2[0] == true) {
    heatingThermostat.setMode(ThermostatModeType.MANUAL);
  }
 else   if (bits2[1] == true && bits2[0] == false) {
    heatingThermostat.setMode(ThermostatModeType.VACATION);
  }
 else   if (bits2[1] == true && bits2[0] == true) {
    heatingThermostat.setMode(ThermostatModeType.BOOST);
  }
 else {
    logger.debug("String_Node_Str",rfAddress);
  }
heatingThermostat.setValvePosition(raw[6] & 0xFF);
heatingThermostat.setTemperatureSetpoint(raw[7] & 0x7F);
String hexDate=Utils.toHex(raw[8] & 0xFF,raw[9] & 0xFF);
int dateValue=Utils.fromHex(hexDate);
int timeValue=raw[10] & 0xFF;
Date date=Utils.resolveDateTime(dateValue,timeValue);
heatingThermostat.setDateSetpoint(date);
int actualTemp=0;
if (device.getType() == DeviceType.WallMountedThermostat) {
actualTemp=(raw[11] & 0xFF) + (raw[7] & 0x80) * 2;
}
 else {
if (heatingThermostat.getMode() != ThermostatModeType.VACATION && heatingThermostat.getMode() != ThermostatModeType.BOOST) {
actualTemp=(raw[8] & 0xFF) * 256 + (raw[9] & 0xFF);
}
 else {
logger.debug("String_Node_Str",rfAddress,heatingThermostat.getMode());
}
}
logger.trace("String_Node_Str",rfAddress,(double)actualTemp / 10);
heatingThermostat.setTemperatureActual((double)actualTemp / 10);
break;
case EcoSwitch:
String eCoSwitchData=Utils.toHex(raw[3] & 0xFF,raw[4] & 0xFF,raw[5] & 0xFF);
logger.trace("String_Node_Str",rfAddress,eCoSwitchData);
EcoSwitch ecoswitch=(EcoSwitch)device;
if (bits2[1] == true && bits2[0] == false) {
ecoswitch.setEcoMode(OnOffType.ON);
logger.trace("String_Node_Str",rfAddress);
}
 else if (bits2[1] == false && bits2[0] == false) {
ecoswitch.setEcoMode(OnOffType.OFF);
logger.trace("String_Node_Str",rfAddress);
}
 else {
logger.trace("String_Node_Str",rfAddress);
}
break;
case ShutterContact:
ShutterContact shutterContact=(ShutterContact)device;
if (bits2[1] == true && bits2[0] == false) {
shutterContact.setShutterState(OpenClosedType.OPEN);
logger.trace("String_Node_Str",rfAddress);
}
 else if (bits2[1] == false && bits2[0] == false) {
shutterContact.setShutterState(OpenClosedType.CLOSED);
logger.trace("String_Node_Str",rfAddress);
}
 else {
logger.trace("String_Node_Str",rfAddress);
}
break;
default :
logger.debug("String_Node_Str" + Utils.getHex(raw));
break;
}
return device;
}

Fixed version (ground truth):
public static Device update(byte[] raw,List<DeviceConfiguration> configurations,Device device){
  String rfAddress=device.getRFAddress();
  boolean[] bits1=Utils.getBits(Utils.fromByte(raw[4]));
  boolean[] bits2=Utils.getBits(Utils.fromByte(raw[5]));
  device.setInitialized(bits1[1]);
  device.setAnswer(bits1[2]);
  device.setError(bits1[3]);
  device.setValid(bits1[4]);
  device.setDstSettingActive(bits2[3]);
  device.setGatewayKnown(bits2[4]);
  device.setPanelLocked(bits2[5]);
  device.setLinkStatusError(bits2[6]);
  device.setBatteryLow(bits2[7]);
  logger.trace("String_Node_Str",rfAddress,device.getType().toString(),raw.length,Utils.getHex(raw));
switch (device.getType()) {
case WallMountedThermostat:
case HeatingThermostat:
case HeatingThermostatPlus:
    HeatingThermostat heatingThermostat=(HeatingThermostat)device;
  if (bits2[1] == false && bits2[0] == false) {
    heatingThermostat.setMode(ThermostatModeType.AUTOMATIC);
  }
 else   if (bits2[1] == false && bits2[0] == true) {
    heatingThermostat.setMode(ThermostatModeType.MANUAL);
  }
 else   if (bits2[1] == true && bits2[0] == false) {
    heatingThermostat.setMode(ThermostatModeType.VACATION);
  }
 else   if (bits2[1] == true && bits2[0] == true) {
    heatingThermostat.setMode(ThermostatModeType.BOOST);
  }
 else {
    logger.debug("String_Node_Str",rfAddress,device.getType().toString());
  }
heatingThermostat.setValvePosition(raw[6] & 0xFF);
heatingThermostat.setTemperatureSetpoint(raw[7] & 0x7F);
String hexDate=Utils.toHex(raw[8] & 0xFF,raw[9] & 0xFF);
int dateValue=Utils.fromHex(hexDate);
int timeValue=raw[10] & 0xFF;
Date date=Utils.resolveDateTime(dateValue,timeValue);
heatingThermostat.setDateSetpoint(date);
int actualTemp=0;
if (device.getType() == DeviceType.WallMountedThermostat) {
actualTemp=(raw[11] & 0xFF) + (raw[7] & 0x80) * 2;
}
 else {
if (heatingThermostat.getMode() != ThermostatModeType.VACATION && heatingThermostat.getMode() != ThermostatModeType.BOOST) {
actualTemp=(raw[8] & 0xFF) * 256 + (raw[9] & 0xFF);
}
 else {
logger.debug("String_Node_Str",rfAddress,device.getType().toString(),heatingThermostat.getMode());
}
}
logger.debug("String_Node_Str",rfAddress,device.getType().toString(),(double)actualTemp / 10);
heatingThermostat.setTemperatureActual((double)actualTemp / 10);
break;
case EcoSwitch:
String eCoSwitchData=Utils.toHex(raw[3] & 0xFF,raw[4] & 0xFF,raw[5] & 0xFF);
logger.trace("String_Node_Str",rfAddress,device.getType().toString(),eCoSwitchData);
EcoSwitch ecoswitch=(EcoSwitch)device;
if (bits2[1] == true && bits2[0] == false) {
ecoswitch.setEcoMode(OnOffType.ON);
logger.trace("String_Node_Str",rfAddress,device.getType().toString());
}
 else if (bits2[1] == false && bits2[0] == false) {
ecoswitch.setEcoMode(OnOffType.OFF);
logger.trace("String_Node_Str",rfAddress,device.getType().toString());
}
 else {
logger.trace("String_Node_Str",rfAddress,device.getType().toString());
}
break;
case ShutterContact:
ShutterContact shutterContact=(ShutterContact)device;
if (bits2[1] == true && bits2[0] == false) {
shutterContact.setShutterState(OpenClosedType.OPEN);
logger.debug("String_Node_Str",rfAddress,device.getType().toString());
}
 else if (bits2[1] == false && bits2[0] == false) {
shutterContact.setShutterState(OpenClosedType.CLOSED);
logger.debug("String_Node_Str",rfAddress,device.getType().toString());
}
 else {
logger.trace("String_Node_Str",rfAddress,device.getType().toString());
}
break;
default :
logger.debug("String_Node_Str" + Utils.getHex(raw));
break;
}
return device;
}