Program: 171910
Project: 171910
Buggy source:
/** 
 * In case a FAILED response code is sent, the mandatory fields still need to be set with minimum required values, otherwise the EVCC's EXI decoder will raise an error.
 * @param response The respective response message whose mandatory fields are to be set
 */
protected void setMandatoryFieldsForFailedRes(BodyBaseType responseMessage,ResponseCodeType responseCode){
switch (responseMessage.getClass().getSimpleName()) {
case "String_Node_Str":
    SessionSetupResType sessionSetupRes=(SessionSetupResType)responseMessage;
  sessionSetupRes.setEVSEID(getCommSessionContext().getEvseController().getEvseID());
sessionSetupRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ServiceDiscoveryResType serviceDiscoveryRes=(ServiceDiscoveryResType)responseMessage;
serviceDiscoveryRes.setChargeService((new WaitForServiceDiscoveryReq(getCommSessionContext())).getChargeService());
serviceDiscoveryRes.setPaymentOptionList(getCommSessionContext().getPaymentOptions());
serviceDiscoveryRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ServiceDetailResType serviceDetailRes=(ServiceDetailResType)responseMessage;
serviceDetailRes.setServiceID(1);
serviceDetailRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PaymentServiceSelectionResType paymentServiceSelectionRes=(PaymentServiceSelectionResType)responseMessage;
paymentServiceSelectionRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PaymentDetailsResType paymentDetailsRes=(PaymentDetailsResType)responseMessage;
paymentDetailsRes.setEVSETimeStamp(0L);
paymentDetailsRes.setGenChallenge(new byte[1]);
paymentDetailsRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CertificateInstallationResType certificateInstallationRes=(CertificateInstallationResType)responseMessage;
CertificateChainType saProvisioningCertificateChain=new CertificateChainType();
saProvisioningCertificateChain.setCertificate(new byte[1]);
certificateInstallationRes.setSAProvisioningCertificateChain(saProvisioningCertificateChain);
CertificateChainType contractSignatureCertChain=new CertificateChainType();
contractSignatureCertChain.setCertificate(new byte[1]);
contractSignatureCertChain.setId("String_Node_Str");
certificateInstallationRes.setContractSignatureCertChain(contractSignatureCertChain);
ContractSignatureEncryptedPrivateKeyType contractSignatureEncryptedPrivateKey=new ContractSignatureEncryptedPrivateKeyType();
contractSignatureEncryptedPrivateKey.setValue(new byte[1]);
contractSignatureEncryptedPrivateKey.setId("String_Node_Str");
certificateInstallationRes.setContractSignatureEncryptedPrivateKey(contractSignatureEncryptedPrivateKey);
DiffieHellmanPublickeyType dhPublicKeyType=new DiffieHellmanPublickeyType();
dhPublicKeyType.setValue(new byte[1]);
dhPublicKeyType.setId("String_Node_Str");
certificateInstallationRes.setDHpublickey(dhPublicKeyType);
EMAIDType emaid=new EMAIDType();
emaid.setValue("String_Node_Str");
emaid.setId("String_Node_Str");
certificateInstallationRes.setEMAID(emaid);
certificateInstallationRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CertificateUpdateResType certificateUpdateRes=(CertificateUpdateResType)responseMessage;
CertificateChainType saProvisioningCertificateChain2=new CertificateChainType();
saProvisioningCertificateChain2.setCertificate(new byte[1]);
certificateUpdateRes.setSAProvisioningCertificateChain(saProvisioningCertificateChain2);
CertificateChainType contractSignatureCertChain2=new CertificateChainType();
contractSignatureCertChain2.setCertificate(new byte[1]);
contractSignatureCertChain2.setId("String_Node_Str");
certificateUpdateRes.setContractSignatureCertChain(contractSignatureCertChain2);
ContractSignatureEncryptedPrivateKeyType contractSignatureEncryptedPrivateKey2=new ContractSignatureEncryptedPrivateKeyType();
contractSignatureEncryptedPrivateKey2.setValue(new byte[1]);
contractSignatureEncryptedPrivateKey2.setId("String_Node_Str");
certificateUpdateRes.setContractSignatureEncryptedPrivateKey(contractSignatureEncryptedPrivateKey2);
DiffieHellmanPublickeyType dhPublicKeyType2=new DiffieHellmanPublickeyType();
dhPublicKeyType2.setValue(new byte[1]);
dhPublicKeyType2.setId("String_Node_Str");
certificateUpdateRes.setDHpublickey(dhPublicKeyType2);
EMAIDType emaid2=new EMAIDType();
emaid2.setValue("String_Node_Str");
emaid2.setId("String_Node_Str");
certificateUpdateRes.setEMAID(emaid2);
certificateUpdateRes.setRetryCounter((short)0);
certificateUpdateRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
AuthorizationResType authorizationRes=(AuthorizationResType)responseMessage;
authorizationRes.setEVSEProcessing(EVSEProcessingType.FINISHED);
authorizationRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ChargeParameterDiscoveryResType chargeParameterDiscoveryRes=(ChargeParameterDiscoveryResType)responseMessage;
chargeParameterDiscoveryRes.setEVSEProcessing(EVSEProcessingType.FINISHED);
chargeParameterDiscoveryRes.setEVSEChargeParameter(((IACEVSEController)getCommSessionContext().getACEvseController()).getACEVSEChargeParameter());
chargeParameterDiscoveryRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CableCheckResType cableCheckRes=(CableCheckResType)responseMessage;
cableCheckRes.setEVSEProcessing(EVSEProcessingType.FINISHED);
cableCheckRes.setDCEVSEStatus(((IDCEVSEController)getCommSessionContext().getDCEvseController()).getDCEVSEStatus(EVSENotificationType.NONE));
cableCheckRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PreChargeResType preChargeRes=(PreChargeResType)responseMessage;
IDCEVSEController evseController=(IDCEVSEController)getCommSessionContext().getDCEvseController();
preChargeRes.setDCEVSEStatus(evseController.getDCEVSEStatus(EVSENotificationType.NONE));
preChargeRes.setEVSEPresentVoltage(evseController.getPresentVoltage());
preChargeRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PowerDeliveryResType powerDeliveryRes=(PowerDeliveryResType)responseMessage;
(new WaitForPowerDeliveryReq(getCommSessionContext())).setEVSEStatus(powerDeliveryRes);
powerDeliveryRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ChargingStatusResType chargingStatusRes=(ChargingStatusResType)responseMessage;
chargingStatusRes.setEVSEID(getCommSessionContext().getACEvseController().getEvseID());
chargingStatusRes.setSAScheduleTupleID((short)1);
chargingStatusRes.setACEVSEStatus(((IACEVSEController)getCommSessionContext().getACEvseController()).getACEVSEStatus(EVSENotificationType.NONE));
chargingStatusRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CurrentDemandResType currentDemandRes=(CurrentDemandResType)responseMessage;
IDCEVSEController evseController2=(IDCEVSEController)getCommSessionContext().getDCEvseController();
PhysicalValueType physicalValueType=new PhysicalValueType();
physicalValueType.setMultiplier(new Byte("String_Node_Str"));
physicalValueType.setUnit(UnitSymbolType.V);
physicalValueType.setValue((short)1);
currentDemandRes.setDCEVSEStatus(evseController2.getDCEVSEStatus(EVSENotificationType.NONE));
currentDemandRes.setEVSEPresentVoltage(physicalValueType);
currentDemandRes.setEVSEPresentCurrent(physicalValueType);
currentDemandRes.setEVSECurrentLimitAchieved(false);
currentDemandRes.setEVSEVoltageLimitAchieved(false);
currentDemandRes.setEVSEPowerLimitAchieved(false);
currentDemandRes.setEVSEID(evseController2.getEvseID());
currentDemandRes.setSAScheduleTupleID((short)1);
currentDemandRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
MeteringReceiptResType meteringReceiptRes=(MeteringReceiptResType)responseMessage;
(new WaitForMeteringReceiptReq(getCommSessionContext())).setEVSEStatus(meteringReceiptRes);
meteringReceiptRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
WeldingDetectionResType weldingDetectionRes=(WeldingDetectionResType)responseMessage;
IDCEVSEController evseController3=(IDCEVSEController)getCommSessionContext().getDCEvseController();
weldingDetectionRes.setDCEVSEStatus(evseController3.getDCEVSEStatus(EVSENotificationType.NONE));
weldingDetectionRes.setEVSEPresentVoltage(evseController3.getPresentVoltage());
weldingDetectionRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
SessionStopResType sessionStopRes=(SessionStopResType)responseMessage;
sessionStopRes.setResponseCode(responseCode);
break;
default :
getLogger().error("String_Node_Str");
}
}

Fixed version (ground truth):
/** 
 * In case a FAILED response code is sent, the mandatory fields still need to be set with minimum required values, otherwise the EVCC's EXI decoder will raise an error.
 * @param response The respective response message whose mandatory fields are to be set
 */
protected void setMandatoryFieldsForFailedRes(BodyBaseType responseMessage,ResponseCodeType responseCode){
switch (responseMessage.getClass().getSimpleName()) {
case "String_Node_Str":
    SessionSetupResType sessionSetupRes=(SessionSetupResType)responseMessage;
  sessionSetupRes.setEVSEID(getCommSessionContext().getEvseController().getEvseID());
sessionSetupRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ServiceDiscoveryResType serviceDiscoveryRes=(ServiceDiscoveryResType)responseMessage;
serviceDiscoveryRes.setChargeService((new WaitForServiceDiscoveryReq(getCommSessionContext())).getChargeService());
serviceDiscoveryRes.setPaymentOptionList(getCommSessionContext().getPaymentOptions());
serviceDiscoveryRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ServiceDetailResType serviceDetailRes=(ServiceDetailResType)responseMessage;
serviceDetailRes.setServiceID(1);
serviceDetailRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PaymentServiceSelectionResType paymentServiceSelectionRes=(PaymentServiceSelectionResType)responseMessage;
paymentServiceSelectionRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PaymentDetailsResType paymentDetailsRes=(PaymentDetailsResType)responseMessage;
paymentDetailsRes.setEVSETimeStamp(0L);
paymentDetailsRes.setGenChallenge(new byte[1]);
paymentDetailsRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CertificateInstallationResType certificateInstallationRes=(CertificateInstallationResType)responseMessage;
CertificateChainType saProvisioningCertificateChain=new CertificateChainType();
saProvisioningCertificateChain.setCertificate(new byte[1]);
certificateInstallationRes.setSAProvisioningCertificateChain(saProvisioningCertificateChain);
CertificateChainType contractSignatureCertChain=new CertificateChainType();
contractSignatureCertChain.setCertificate(new byte[1]);
contractSignatureCertChain.setId("String_Node_Str");
certificateInstallationRes.setContractSignatureCertChain(contractSignatureCertChain);
ContractSignatureEncryptedPrivateKeyType contractSignatureEncryptedPrivateKey=new ContractSignatureEncryptedPrivateKeyType();
contractSignatureEncryptedPrivateKey.setValue(new byte[1]);
contractSignatureEncryptedPrivateKey.setId("String_Node_Str");
certificateInstallationRes.setContractSignatureEncryptedPrivateKey(contractSignatureEncryptedPrivateKey);
DiffieHellmanPublickeyType dhPublicKeyType=new DiffieHellmanPublickeyType();
dhPublicKeyType.setValue(new byte[1]);
dhPublicKeyType.setId("String_Node_Str");
certificateInstallationRes.setDHpublickey(dhPublicKeyType);
EMAIDType emaid=new EMAIDType();
emaid.setValue("String_Node_Str");
emaid.setId("String_Node_Str");
certificateInstallationRes.setEMAID(emaid);
certificateInstallationRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CertificateUpdateResType certificateUpdateRes=(CertificateUpdateResType)responseMessage;
CertificateChainType saProvisioningCertificateChain2=new CertificateChainType();
saProvisioningCertificateChain2.setCertificate(new byte[1]);
certificateUpdateRes.setSAProvisioningCertificateChain(saProvisioningCertificateChain2);
CertificateChainType contractSignatureCertChain2=new CertificateChainType();
contractSignatureCertChain2.setCertificate(new byte[1]);
contractSignatureCertChain2.setId("String_Node_Str");
certificateUpdateRes.setContractSignatureCertChain(contractSignatureCertChain2);
ContractSignatureEncryptedPrivateKeyType contractSignatureEncryptedPrivateKey2=new ContractSignatureEncryptedPrivateKeyType();
contractSignatureEncryptedPrivateKey2.setValue(new byte[1]);
contractSignatureEncryptedPrivateKey2.setId("String_Node_Str");
certificateUpdateRes.setContractSignatureEncryptedPrivateKey(contractSignatureEncryptedPrivateKey2);
DiffieHellmanPublickeyType dhPublicKeyType2=new DiffieHellmanPublickeyType();
dhPublicKeyType2.setValue(new byte[1]);
dhPublicKeyType2.setId("String_Node_Str");
certificateUpdateRes.setDHpublickey(dhPublicKeyType2);
EMAIDType emaid2=new EMAIDType();
emaid2.setValue("String_Node_Str");
emaid2.setId("String_Node_Str");
certificateUpdateRes.setEMAID(emaid2);
certificateUpdateRes.setRetryCounter((short)0);
certificateUpdateRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
AuthorizationResType authorizationRes=(AuthorizationResType)responseMessage;
authorizationRes.setEVSEProcessing(EVSEProcessingType.FINISHED);
authorizationRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ChargeParameterDiscoveryResType chargeParameterDiscoveryRes=(ChargeParameterDiscoveryResType)responseMessage;
chargeParameterDiscoveryRes.setEVSEProcessing(EVSEProcessingType.FINISHED);
chargeParameterDiscoveryRes.setEVSEChargeParameter(((IACEVSEController)getCommSessionContext().getACEvseController()).getACEVSEChargeParameter());
chargeParameterDiscoveryRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CableCheckResType cableCheckRes=(CableCheckResType)responseMessage;
cableCheckRes.setEVSEProcessing(EVSEProcessingType.FINISHED);
cableCheckRes.setDCEVSEStatus(((IDCEVSEController)getCommSessionContext().getDCEvseController()).getDCEVSEStatus(EVSENotificationType.NONE));
cableCheckRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PreChargeResType preChargeRes=(PreChargeResType)responseMessage;
IDCEVSEController evseController=getCommSessionContext().getDCEvseController();
preChargeRes.setDCEVSEStatus(evseController.getDCEVSEStatus(EVSENotificationType.NONE));
PhysicalValueType evsePresentVoltage=new PhysicalValueType();
evsePresentVoltage.setMultiplier(new Byte("String_Node_Str"));
evsePresentVoltage.setUnit(UnitSymbolType.V);
evsePresentVoltage.setValue((short)0);
preChargeRes.setEVSEPresentVoltage(evsePresentVoltage);
preChargeRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
PowerDeliveryResType powerDeliveryRes=(PowerDeliveryResType)responseMessage;
(new WaitForPowerDeliveryReq(getCommSessionContext())).setEVSEStatus(powerDeliveryRes);
powerDeliveryRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
ChargingStatusResType chargingStatusRes=(ChargingStatusResType)responseMessage;
chargingStatusRes.setEVSEID(getCommSessionContext().getACEvseController().getEvseID());
chargingStatusRes.setSAScheduleTupleID((short)1);
chargingStatusRes.setACEVSEStatus(((IACEVSEController)getCommSessionContext().getACEvseController()).getACEVSEStatus(EVSENotificationType.NONE));
chargingStatusRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
CurrentDemandResType currentDemandRes=(CurrentDemandResType)responseMessage;
IDCEVSEController evseController2=(IDCEVSEController)getCommSessionContext().getDCEvseController();
PhysicalValueType physicalValueType=new PhysicalValueType();
physicalValueType.setMultiplier(new Byte("String_Node_Str"));
physicalValueType.setUnit(UnitSymbolType.V);
physicalValueType.setValue((short)1);
currentDemandRes.setDCEVSEStatus(evseController2.getDCEVSEStatus(EVSENotificationType.NONE));
currentDemandRes.setEVSEPresentVoltage(physicalValueType);
currentDemandRes.setEVSEPresentCurrent(physicalValueType);
currentDemandRes.setEVSECurrentLimitAchieved(false);
currentDemandRes.setEVSEVoltageLimitAchieved(false);
currentDemandRes.setEVSEPowerLimitAchieved(false);
currentDemandRes.setEVSEID(evseController2.getEvseID());
currentDemandRes.setSAScheduleTupleID((short)1);
currentDemandRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
MeteringReceiptResType meteringReceiptRes=(MeteringReceiptResType)responseMessage;
(new WaitForMeteringReceiptReq(getCommSessionContext())).setEVSEStatus(meteringReceiptRes);
meteringReceiptRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
WeldingDetectionResType weldingDetectionRes=(WeldingDetectionResType)responseMessage;
IDCEVSEController evseController3=(IDCEVSEController)getCommSessionContext().getDCEvseController();
weldingDetectionRes.setDCEVSEStatus(evseController3.getDCEVSEStatus(EVSENotificationType.NONE));
PhysicalValueType evsePresentVoltage2=new PhysicalValueType();
evsePresentVoltage2.setMultiplier(new Byte("String_Node_Str"));
evsePresentVoltage2.setUnit(UnitSymbolType.V);
evsePresentVoltage2.setValue((short)0);
weldingDetectionRes.setEVSEPresentVoltage(evsePresentVoltage2);
weldingDetectionRes.setResponseCode(responseCode);
break;
case "String_Node_Str":
SessionStopResType sessionStopRes=(SessionStopResType)responseMessage;
sessionStopRes.setResponseCode(responseCode);
break;
default :
getLogger().error("String_Node_Str");
}
}