Program: 12533
Project: 12533
Buggy source:
/** 
 * Creates XAdES TimeStamp object representation. The time stamp token is obtained from TSP source
 * @param timestampC14nMethod
 * @param digestValue
 * @return
 * @throws eu.europa.ec.markt.dss.exception.DSSException
 */
protected void createXAdESTimeStampType(final TimestampType timestampType,final String timestampC14nMethod,final byte[] digestValue) throws DSSException {
  try {
    final DigestAlgorithm timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
    if (LOG.isInfoEnabled()) {
      final String encodedDigestValue=DSSUtils.base64Encode(digestValue);
      LOG.info("String_Node_Str" + timestampDigestAlgorithm.getName() + "String_Node_Str"+ timestampC14nMethod+ "String_Node_Str"+ encodedDigestValue);
    }
    final TimeStampToken timeStampToken=tspSource.getTimeStampResponse(timestampDigestAlgorithm,digestValue);
    final byte[] timeStampTokenBytes=timeStampToken.getEncoded();
    final String signatureTimestampId="String_Node_Str" + UUID.randomUUID().toString();
    final String base64EncodedTimeStampToken=DSSUtils.base64Encode(timeStampTokenBytes);
    Element timeStampDom=null;
switch (timestampType) {
case SIGNATURE_TIMESTAMP:
      timeStampDom=DSSXMLUtils.addElement(documentDom,unsignedSignaturePropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
    break;
case VALIDATION_DATA_REFSONLY_TIMESTAMP:
  break;
case VALIDATION_DATA_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,unsignedSignaturePropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
break;
case ARCHIVE_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,unsignedSignaturePropertiesDom,XAdESNamespaces.XAdES141,"String_Node_Str");
break;
case CONTENT_TIMESTAMP:
break;
case ALL_DATA_OBJECTS_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,signedPropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
break;
case INDIVIDUAL_DATA_OBJECTS_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,signedPropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
break;
}
timeStampDom.setAttribute("String_Node_Str",signatureTimestampId);
incorporateC14nMethod(timeStampDom,timestampC14nMethod);
final Element encapsulatedTimeStampDom=DSSXMLUtils.addElement(documentDom,timeStampDom,XAdESNamespaces.XAdES,"String_Node_Str");
encapsulatedTimeStampDom.setAttribute("String_Node_Str",signatureTimestampId);
DSSXMLUtils.setTextNode(documentDom,encapsulatedTimeStampDom,base64EncodedTimeStampToken);
}
 catch (IOException e) {
throw new DSSException("String_Node_Str",e);
}
}

Fixed version (ground truth):
/** 
 * Creates XAdES TimeStamp object representation. The time stamp token is obtained from TSP source
 * @param timestampC14nMethod
 * @param digestValue
 * @return
 * @throws eu.europa.ec.markt.dss.exception.DSSException
 */
protected void createXAdESTimeStampType(final TimestampType timestampType,final String timestampC14nMethod,final byte[] digestValue) throws DSSException {
  try {
    Element timeStampDom=null;
    DigestAlgorithm timestampDigestAlgorithm=null;
switch (timestampType) {
case SIGNATURE_TIMESTAMP:
      timeStampDom=DSSXMLUtils.addElement(documentDom,unsignedSignaturePropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
    timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
  break;
case VALIDATION_DATA_REFSONLY_TIMESTAMP:
timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
break;
case VALIDATION_DATA_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,unsignedSignaturePropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
break;
case ARCHIVE_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,unsignedSignaturePropertiesDom,XAdESNamespaces.XAdES141,"String_Node_Str");
timestampDigestAlgorithm=params.getArchiveTimestampParameters().getDigestAlgorithm();
break;
case CONTENT_TIMESTAMP:
timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
break;
case ALL_DATA_OBJECTS_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,signedPropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
break;
case INDIVIDUAL_DATA_OBJECTS_TIMESTAMP:
timeStampDom=DSSXMLUtils.addElement(documentDom,signedPropertiesDom,XAdESNamespaces.XAdES,"String_Node_Str");
timestampDigestAlgorithm=params.getSignatureTimestampParameters().getDigestAlgorithm();
break;
}
if (LOG.isInfoEnabled()) {
final String encodedDigestValue=DSSUtils.base64Encode(digestValue);
LOG.info("String_Node_Str" + timestampDigestAlgorithm.getName() + "String_Node_Str"+ timestampC14nMethod+ "String_Node_Str"+ encodedDigestValue);
}
final TimeStampToken timeStampToken=tspSource.getTimeStampResponse(timestampDigestAlgorithm,digestValue);
final byte[] timeStampTokenBytes=timeStampToken.getEncoded();
final String signatureTimestampId="String_Node_Str" + UUID.randomUUID().toString();
final String base64EncodedTimeStampToken=DSSUtils.base64Encode(timeStampTokenBytes);
timeStampDom.setAttribute("String_Node_Str",signatureTimestampId);
incorporateC14nMethod(timeStampDom,timestampC14nMethod);
final Element encapsulatedTimeStampDom=DSSXMLUtils.addElement(documentDom,timeStampDom,XAdESNamespaces.XAdES,"String_Node_Str");
encapsulatedTimeStampDom.setAttribute("String_Node_Str",signatureTimestampId);
DSSXMLUtils.setTextNode(documentDom,encapsulatedTimeStampDom,base64EncodedTimeStampToken);
}
 catch (IOException e) {
throw new DSSException("String_Node_Str",e);
}
}