Program: 171912
Project: 171912
Buggy source:
@Override public ReactionToIncomingMessage processIncomingMessage(Object message){
  if (isIncomingMessageValid(message,CertificateInstallationReqType.class,certificateInstallationRes)) {
    V2GMessage v2gMessageReq=(V2GMessage)message;
    CertificateInstallationReqType certificateInstallationReq=(CertificateInstallationReqType)v2gMessageReq.getBody().getBodyElement().getValue();
    CertificateChainType saContractCertificateChain=getCommSessionContext().getBackendInterface().getContractCertificateChain();
    if (isResponseCodeOK(certificateInstallationReq,saContractCertificateChain,v2gMessageReq.getHeader().getSignature())) {
      KeyPair ecKeyPair=SecurityUtils.getECKeyPair();
      if (ecKeyPair == null) {
        getLogger().error("String_Node_Str");
        return null;
      }
      ContractSignatureEncryptedPrivateKeyType encryptedContractCertPrivateKey=SecurityUtils.encryptContractCertPrivateKey((ECPublicKey)SecurityUtils.getCertificate(certificateInstallationReq.getOEMProvisioningCert()).getPublicKey(),ecKeyPair,getCommSessionContext().getBackendInterface().getContractCertificatePrivateKey());
      certificateInstallationRes.setContractSignatureCertChain(saContractCertificateChain);
      certificateInstallationRes.getContractSignatureCertChain().setId("String_Node_Str");
      certificateInstallationRes.setContractSignatureEncryptedPrivateKey(encryptedContractCertPrivateKey);
      certificateInstallationRes.getContractSignatureEncryptedPrivateKey().setId("String_Node_Str");
      certificateInstallationRes.setDHpublickey(SecurityUtils.getDHPublicKey(ecKeyPair));
      certificateInstallationRes.getDHpublickey().setId("String_Node_Str");
      certificateInstallationRes.setEMAID(SecurityUtils.getEMAID(saContractCertificateChain));
      certificateInstallationRes.getEMAID().setId("String_Node_Str");
      certificateInstallationRes.setSAProvisioningCertificateChain(getCommSessionContext().getBackendInterface().getCPSCertificateChain());
      getXMLSignatureRefElements().put(certificateInstallationRes.getContractSignatureCertChain().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getContractSignatureCertChain())));
      getXMLSignatureRefElements().put(certificateInstallationRes.getContractSignatureEncryptedPrivateKey().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getContractSignatureEncryptedPrivateKey())));
      getXMLSignatureRefElements().put(certificateInstallationRes.getDHpublickey().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getDHpublickey())));
      getXMLSignatureRefElements().put(certificateInstallationRes.getEMAID().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getEMAID())));
      setSignaturePrivateKey(getCommSessionContext().getBackendInterface().getCPSLeafPrivateKey());
    }
 else {
      setMandatoryFieldsForFailedRes(certificateInstallationRes,certificateInstallationRes.getResponseCode());
    }
  }
 else {
    if (certificateInstallationRes.getResponseCode().equals(ResponseCodeType.FAILED_SEQUENCE_ERROR)) {
      BodyBaseType responseMessage=getSequenceErrorResMessage(new CertificateInstallationResType(),message);
      return getSendMessage(responseMessage,V2GMessages.NONE,certificateInstallationRes.getResponseCode());
    }
 else {
      setMandatoryFieldsForFailedRes(certificateInstallationRes,certificateInstallationRes.getResponseCode());
    }
  }
  return getSendMessage(certificateInstallationRes,V2GMessages.PAYMENT_DETAILS_REQ,certificateInstallationRes.getResponseCode());
}

Fixed version (ground truth):
@Override public ReactionToIncomingMessage processIncomingMessage(Object message){
  if (isIncomingMessageValid(message,CertificateInstallationReqType.class,certificateInstallationRes)) {
    V2GMessage v2gMessageReq=(V2GMessage)message;
    CertificateInstallationReqType certificateInstallationReq=(CertificateInstallationReqType)v2gMessageReq.getBody().getBodyElement().getValue();
    CertificateChainType saContractCertificateChain=getCommSessionContext().getBackendInterface().getContractCertificateChain(SecurityUtils.getCertificate(certificateInstallationReq.getOEMProvisioningCert()));
    if (isResponseCodeOK(certificateInstallationReq,saContractCertificateChain,v2gMessageReq.getHeader().getSignature())) {
      KeyPair ecKeyPair=SecurityUtils.getECKeyPair();
      if (ecKeyPair == null) {
        getLogger().error("String_Node_Str");
        return null;
      }
      ContractSignatureEncryptedPrivateKeyType encryptedContractCertPrivateKey=SecurityUtils.encryptContractCertPrivateKey((ECPublicKey)SecurityUtils.getCertificate(certificateInstallationReq.getOEMProvisioningCert()).getPublicKey(),ecKeyPair,getCommSessionContext().getBackendInterface().getContractCertificatePrivateKey());
      certificateInstallationRes.setContractSignatureCertChain(saContractCertificateChain);
      certificateInstallationRes.getContractSignatureCertChain().setId("String_Node_Str");
      certificateInstallationRes.setContractSignatureEncryptedPrivateKey(encryptedContractCertPrivateKey);
      certificateInstallationRes.getContractSignatureEncryptedPrivateKey().setId("String_Node_Str");
      certificateInstallationRes.setDHpublickey(SecurityUtils.getDHPublicKey(ecKeyPair));
      certificateInstallationRes.getDHpublickey().setId("String_Node_Str");
      certificateInstallationRes.setEMAID(SecurityUtils.getEMAID(saContractCertificateChain));
      certificateInstallationRes.getEMAID().setId("String_Node_Str");
      certificateInstallationRes.setSAProvisioningCertificateChain(getCommSessionContext().getBackendInterface().getCPSCertificateChain());
      getXMLSignatureRefElements().put(certificateInstallationRes.getContractSignatureCertChain().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getContractSignatureCertChain())));
      getXMLSignatureRefElements().put(certificateInstallationRes.getContractSignatureEncryptedPrivateKey().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getContractSignatureEncryptedPrivateKey())));
      getXMLSignatureRefElements().put(certificateInstallationRes.getDHpublickey().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getDHpublickey())));
      getXMLSignatureRefElements().put(certificateInstallationRes.getEMAID().getId(),SecurityUtils.generateDigest(getMessageHandler().getJaxbElement(certificateInstallationRes.getEMAID())));
      setSignaturePrivateKey(getCommSessionContext().getBackendInterface().getCPSLeafPrivateKey());
    }
 else {
      setMandatoryFieldsForFailedRes(certificateInstallationRes,certificateInstallationRes.getResponseCode());
    }
  }
 else {
    if (certificateInstallationRes.getResponseCode().equals(ResponseCodeType.FAILED_SEQUENCE_ERROR)) {
      BodyBaseType responseMessage=getSequenceErrorResMessage(new CertificateInstallationResType(),message);
      return getSendMessage(responseMessage,V2GMessages.NONE,certificateInstallationRes.getResponseCode());
    }
 else {
      setMandatoryFieldsForFailedRes(certificateInstallationRes,certificateInstallationRes.getResponseCode());
    }
  }
  return getSendMessage(certificateInstallationRes,V2GMessages.PAYMENT_DETAILS_REQ,certificateInstallationRes.getResponseCode());
}