nus-yam/ex-repair huggingface dataset:
Program: 63939
Project: 63939
Buggy source:
protected String getStringForQName(QName qName){
  if (null == qName) {
    return null;
  }
  String namespaceURI=qName.getNamespaceURI();
  if (null == namespaceURI || 0 == namespaceURI.length()) {
    if (getNamespaceResolver() != null && getNamespaceResolver().getDefaultNamespaceURI() != null) {
      defaultNamespaceDeclaration(namespaceURI);
    }
    return qName.getLocalPart();
  }
 else {
    NamespaceResolver namespaceResolver=getNamespaceResolver();
    if (namespaceResolver == null) {
      throw XMLMarshalException.namespaceResolverNotSpecified(namespaceURI);
    }
    if (namespaceURI.equals(namespaceResolver.getDefaultNamespaceURI())) {
      return qName.getLocalPart();
    }
    String prefix=namespaceResolver.resolveNamespaceURI(namespaceURI);
    if (null == prefix) {
      prefix=namespaceResolver.generatePrefix();
      namespaceDeclaration(prefix,namespaceURI);
    }
    if (Constants.EMPTY_STRING.equals(prefix)) {
      return qName.getLocalPart();
    }
    return prefix + Constants.COLON + qName.getLocalPart();
  }
}

Fixed version (ground truth):
protected String getStringForQName(QName qName){
  if (null == qName) {
    return null;
  }
  String namespaceURI=qName.getNamespaceURI();
  if (null == namespaceURI || 0 == namespaceURI.length()) {
    if (getNamespaceResolver() != null && getNamespaceResolver().getDefaultNamespaceURI() != null) {
      defaultNamespaceDeclaration(namespaceURI);
    }
    return qName.getLocalPart();
  }
 else {
    NamespaceResolver namespaceResolver=getNamespaceResolver();
    if (namespaceResolver == null) {
      throw XMLMarshalException.namespaceResolverNotSpecified(namespaceURI);
    }
    if (namespaceURI.equals(namespaceResolver.getDefaultNamespaceURI())) {
      return qName.getLocalPart();
    }
    String prefix=namespaceResolver.resolveNamespaceURI(namespaceURI);
    if (null == prefix) {
      if (namespaceURI.equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
        prefix=namespaceResolver.generatePrefix(Constants.SCHEMA_PREFIX);
      }
 else {
        prefix=namespaceResolver.generatePrefix();
      }
      namespaceDeclaration(prefix,namespaceURI);
    }
    if (Constants.EMPTY_STRING.equals(prefix)) {
      return qName.getLocalPart();
    }
    return prefix + Constants.COLON + qName.getLocalPart();
  }
}
Program: 63941
Project: 63941
Buggy source:
public Object getObjectValueFromDataHandler(DataHandler handler,Class cls){
  return XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(handler,cls,record.getSession());
}

Fixed version (ground truth):
public Object getObjectValueFromDataHandler(DataHandler handler,Class cls){
  CoreContainerPolicy cp=null;
  if (isCollection) {
    cp=mapping.getContainerPolicy();
  }
  return XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(handler,cls,record.getSession(),cp);
}
Program: 63943
Project: 63943
Buggy source:
public EncodedData getBytesForBinaryValue(Object attributeValue,Marshaller marshaller,String mimeType){
  if (attributeValue instanceof DataHandler) {
    return getBytesFromDataHandler((DataHandler)attributeValue);
  }
 else   if (attributeValue instanceof Image) {
    return getBytesFromImage((Image)attributeValue,mimeType);
  }
 else   if (attributeValue instanceof Source) {
    return getBytesFromSource((Source)attributeValue,marshaller,mimeType);
  }
 else   if (attributeValue instanceof MimeMultipart) {
    return getBytesFromMultipart((MimeMultipart)attributeValue,marshaller);
  }
 else   if (attributeValue.getClass() == CoreClassConstants.APBYTE) {
    return new EncodedData((byte[])attributeValue,mimeType);
  }
 else   if (attributeValue.getClass() == CoreClassConstants.ABYTE) {
    return getBytesFromByteObjectArray((Byte[])attributeValue,mimeType);
  }
  return new EncodedData(new byte[0],null);
}

Fixed version (ground truth):
public EncodedData getBytesForBinaryValue(Object attributeValue,Marshaller marshaller,String mimeType){
  return getBytesForSingleBinaryValue(attributeValue,marshaller,mimeType);
}
Program: 63944
Project: 63944
Buggy source:
public Object convertObject(Object obj,Class classification,CoreAbstractSession session){
  if (classification == DATA_HANDLER) {
    return convertObjectToDataHandler(obj,session);
  }
 else   if (classification == IMAGE) {
    return convertObjectToImage(obj);
  }
 else   if (classification == SOURCE) {
    return convertObjectToSource(obj);
  }
 else   if (classification == MULTIPART) {
    return convertObjectToMultipart(obj);
  }
 else {
    return session.getDatasourcePlatform().getConversionManager().convertObject(obj,classification);
  }
}

Fixed version (ground truth):
public Object convertObject(Object obj,Class classification,CoreAbstractSession session,CoreContainerPolicy cp){
  if (obj instanceof List && cp != null) {
    List theList=(List)obj;
    Object container=cp.containerInstance(theList.size());
    for (int i=0; i < theList.size(); i++) {
      Object next=theList.get(i);
      cp.addInto(convertSingleObject(next,classification,session),container,session);
    }
    return container;
  }
  return convertSingleObject(obj,classification,session);
}
Program: 63945
Project: 63945
Buggy source:
/** 
 * Handle swaRef and inline attribute cases.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String URI,String localName,String value){
  unmarshalRecord.removeNullCapableValue(this);
  Field xmlField=(Field)xmlBinaryDataMapping.getField();
  XPathFragment lastFragment=xmlField.getLastXPathFragment();
  Object fieldValue=null;
  if (xmlBinaryDataMapping.isSwaRef()) {
    if (unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller() != null) {
      if (xmlBinaryDataMapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler(value);
      }
 else {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray(value);
      }
      xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession()));
    }
  }
 else {
    fieldValue=((ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value);
    xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession()));
  }
}

Fixed version (ground truth):
/** 
 * Handle swaRef and inline attribute cases.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String URI,String localName,String value){
  unmarshalRecord.removeNullCapableValue(this);
  Field xmlField=(Field)xmlBinaryDataMapping.getField();
  XPathFragment lastFragment=xmlField.getLastXPathFragment();
  Object fieldValue=null;
  if (xmlBinaryDataMapping.isSwaRef()) {
    if (unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller() != null) {
      if (xmlBinaryDataMapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler(value);
      }
 else {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray(value);
      }
      xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession(),null));
    }
  }
 else {
    fieldValue=((ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value);
    xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession(),null));
  }
}
Program: 63947
Project: 63947
Buggy source:
public String convertListToString(Object sourceObject) throws ConversionException {
  StringBuilder returnStringBuilder=new StringBuilder();
  if (sourceObject instanceof List) {
    List list=(List)sourceObject;
    for (int i=0, listSize=list.size(); i < listSize; i++) {
      Object next=list.get(i);
      if (i > 0) {
        returnStringBuilder.append(' ');
      }
      returnStringBuilder.append(convertObjectToString(next));
    }
  }
  return returnStringBuilder.toString();
}

Fixed version (ground truth):
public String convertListToString(Object sourceObject,QName schemaType) throws ConversionException {
  StringBuilder returnStringBuilder=new StringBuilder();
  if (sourceObject instanceof List) {
    List list=(List)sourceObject;
    for (int i=0, listSize=list.size(); i < listSize; i++) {
      Object next=list.get(i);
      if (i > 0) {
        returnStringBuilder.append(' ');
      }
      returnStringBuilder.append((String)convertObject(next,String.class,schemaType));
    }
  }
  return returnStringBuilder.toString();
}
Program: 63948
Project: 63948
Buggy source:
/** 
 * Convert the given sourceObject (String) to the appropriate collection type specified by the containerPolicy, using the elementType to properly convert each element of the list.
 * @param sourceObject - will always be a string if read from XML
 * @param elementType - the type of the elements contained in the list
 * @return - the newly converted object
 */
public Object convertStringToList(Object sourceObject,Class elementType,ContainerPolicy containerPolicy) throws ConversionException {
  Collection collection=(Collection)containerPolicy.containerInstance();
  if (sourceObject instanceof String) {
    StringTokenizer tokenizer=new StringTokenizer((String)sourceObject,"String_Node_Str");
    while (tokenizer.hasMoreElements()) {
      String token=tokenizer.nextToken();
      collection.add(convertObject(token,elementType));
    }
  }
  return collection;
}

Fixed version (ground truth):
/** 
 * Convert the given sourceObject (String) to the appropriate collection type specified by the containerPolicy, using the elementType to properly convert each element of the list.
 * @param sourceObject - will always be a string if read from XML
 * @param elementType - the type of the elements contained in the list
 * @return - the newly converted object
 */
public Object convertStringToList(Object sourceObject,Class elementType,ContainerPolicy containerPolicy,QName schemaType) throws ConversionException {
  Collection collection=(Collection)containerPolicy.containerInstance();
  if (sourceObject instanceof String) {
    StringTokenizer tokenizer=new StringTokenizer((String)sourceObject,"String_Node_Str");
    while (tokenizer.hasMoreElements()) {
      String token=tokenizer.nextToken();
      collection.add(convertObject(token,elementType,schemaType));
    }
  }
  return collection;
}
Program: 63951
Project: 63951
Buggy source:
public Object convertObjectValueToDataValue(Object objectValue,Session session){
  return this.conversionManager.convertListToString(objectValue);
}

Fixed version (ground truth):
public Object convertObjectValueToDataValue(Object objectValue,Session session){
  return this.conversionManager.convertListToString(objectValue,((Field)mapping.getField()).getSchemaType());
}
Program: 63952
Project: 63952
Buggy source:
public Object convertDataValueToObjectValue(Object dataValue,Session session){
  return this.conversionManager.convertStringToList(dataValue,getObjectClass(),mapping.getContainerPolicy());
}

Fixed version (ground truth):
public Object convertDataValueToObjectValue(Object dataValue,Session session){
  return this.conversionManager.convertStringToList(dataValue,getObjectClass(),mapping.getContainerPolicy(),((Field)mapping.getField()).getSchemaType());
}
Program: 63953
Project: 63953
Buggy source:
/** 
 * Convert the value if necessary and write out the converted value.
 * @since EclipseLink 2.4 
 */
public void characters(QName schemaType,Object value,String mimeType,boolean isCDATA){
  if (mimeType != null) {
    value=XMLBinaryDataHelper.getXMLBinaryDataHelper().getBytesForBinaryValue(value,marshaller,mimeType).getData();
  }
  if (schemaType != null && Constants.QNAME_QNAME.equals(schemaType)) {
    String convertedValue=getStringForQName((QName)value);
    characters(convertedValue);
  }
 else {
    String convertedValue=((String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,ClassConstants.STRING,schemaType));
    if (isCDATA) {
      cdata(convertedValue);
    }
 else {
      characters(convertedValue);
    }
  }
}

Fixed version (ground truth):
/** 
 * Convert the value if necessary and write out the converted value.
 * @since EclipseLink 2.4 
 */
public void characters(QName schemaType,Object value,String mimeType,boolean isCDATA){
  if (mimeType != null) {
    if (value instanceof List) {
      value=XMLBinaryDataHelper.getXMLBinaryDataHelper().getBytesListForBinaryValues((List)value,marshaller,mimeType);
    }
 else {
      value=XMLBinaryDataHelper.getXMLBinaryDataHelper().getBytesForBinaryValue(value,marshaller,mimeType).getData();
    }
  }
  if (schemaType != null && Constants.QNAME_QNAME.equals(schemaType)) {
    String convertedValue=getStringForQName((QName)value);
    characters(convertedValue);
  }
 else {
    String convertedValue=((String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,ClassConstants.STRING,schemaType));
    if (isCDATA) {
      cdata(convertedValue);
    }
 else {
      characters(convertedValue);
    }
  }
}
Program: 63954
Project: 63954
Buggy source:
public Document createDocumentWithSystemIdentifier(String name,String systemIdentifier) throws XMLPlatformException {
  try {
    Document document=null;
    if (null == systemIdentifier) {
      document=createDocument();
      Element rootElement=document.createElement(name);
      document.appendChild(rootElement);
      return document;
    }
    DocumentBuilder documentBuilder=DocumentBuilderFactoryHelper.getDocumentBuilderFactory().newDocumentBuilder();
    DOMImplementation domImpl=documentBuilder.getDOMImplementation();
    DocumentType docType=domImpl.createDocumentType(name,null,systemIdentifier);
    document=domImpl.createDocument(null,name,docType);
    return document;
  }
 catch (  Exception e) {
    throw XMLPlatformException.xmlPlatformCouldNotCreateDocument(e);
  }
}

Fixed version (ground truth):
public Document createDocumentWithSystemIdentifier(String name,String systemIdentifier) throws XMLPlatformException {
  try {
    Document document=null;
    if (null == systemIdentifier) {
      document=createDocument();
      Element rootElement=document.createElement(name);
      document.appendChild(rootElement);
      return document;
    }
    DocumentBuilder documentBuilder=getDocumentBuilderFactory().newDocumentBuilder();
    DOMImplementation domImpl=documentBuilder.getDOMImplementation();
    DocumentType docType=domImpl.createDocumentType(name,null,systemIdentifier);
    document=domImpl.createDocument(null,name,docType);
    return document;
  }
 catch (  Exception e) {
    throw XMLPlatformException.xmlPlatformCouldNotCreateDocument(e);
  }
}
Program: 63955
Project: 63955
Buggy source:
public Document createDocument() throws XMLPlatformException {
  try {
    DocumentBuilder documentBuilder=DocumentBuilderFactoryHelper.getDocumentBuilderFactory().newDocumentBuilder();
    return documentBuilder.newDocument();
  }
 catch (  Exception e) {
    throw XMLPlatformException.xmlPlatformCouldNotCreateDocument(e);
  }
}

Fixed version (ground truth):
public Document createDocument() throws XMLPlatformException {
  try {
    DocumentBuilder documentBuilder=getDocumentBuilderFactory().newDocumentBuilder();
    return documentBuilder.newDocument();
  }
 catch (  Exception e) {
    throw XMLPlatformException.xmlPlatformCouldNotCreateDocument(e);
  }
}
Program: 63956
Project: 63956
Buggy source:
static DocumentBuilderFactory getDocumentBuilderFactory(){
  return documentBuilderFactory;
}

Fixed version (ground truth):
private DocumentBuilderFactory getDocumentBuilderFactory(){
  if (null == documentBuilderFactory) {
    documentBuilderFactory=DocumentBuilderFactory.newInstance();
    documentBuilderFactory.setNamespaceAware(true);
  }
  return documentBuilderFactory;
}
Program: 63957
Project: 63957
Buggy source:
public Document createDocumentWithPublicIdentifier(String name,String publicIdentifier,String systemIdentifier) throws XMLPlatformException {
  try {
    if (null == publicIdentifier) {
      return createDocumentWithSystemIdentifier(name,systemIdentifier);
    }
    DocumentBuilder documentBuilder=DocumentBuilderFactoryHelper.getDocumentBuilderFactory().newDocumentBuilder();
    DOMImplementation domImpl=documentBuilder.getDOMImplementation();
    DocumentType docType=domImpl.createDocumentType(name,publicIdentifier,systemIdentifier);
    Document document=domImpl.createDocument(null,name,docType);
    return document;
  }
 catch (  Exception e) {
    throw XMLPlatformException.xmlPlatformCouldNotCreateDocument(e);
  }
}

Fixed version (ground truth):
public Document createDocumentWithPublicIdentifier(String name,String publicIdentifier,String systemIdentifier) throws XMLPlatformException {
  try {
    if (null == publicIdentifier) {
      return createDocumentWithSystemIdentifier(name,systemIdentifier);
    }
    DocumentBuilder documentBuilder=getDocumentBuilderFactory().newDocumentBuilder();
    DOMImplementation domImpl=documentBuilder.getDOMImplementation();
    DocumentType docType=domImpl.createDocumentType(name,publicIdentifier,systemIdentifier);
    Document document=domImpl.createDocument(null,name,docType);
    return document;
  }
 catch (  Exception e) {
    throw XMLPlatformException.xmlPlatformCouldNotCreateDocument(e);
  }
}
Program: 63959
Project: 63959
Buggy source:
static TransformerFactory getTransformerFactory(){
  return transformerFactory;
}

Fixed version (ground truth):
static TransformerFactory getTransformerFactory(){
  return TransformerFactory.newInstance();
}
Program: 63960
Project: 63960
Buggy source:
@SuppressWarnings("String_Node_Str") public Object buildCollectionAttributeResponse(PersistenceContext context,Map<String,Object> queryParams,String attribute,Object item,UriInfo uriInfo){
  if (item instanceof Collection) {
    return responseWithSelfLinks(context,(List<Object>)item,uriInfo);
  }
  return item;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object buildCollectionAttributeResponse(PersistenceContext context,Map<String,Object> queryParams,String attribute,Object item,UriInfo uriInfo){
  if (item instanceof Collection) {
    return response(context,(List<Object>)item,uriInfo);
  }
  return item;
}
Program: 63961
Project: 63961
Buggy source:
@Override public Object buildReportQueryResponse(PersistenceContext context,Map<String,Object> queryParams,List<Object[]> results,List<ReportItem> items,UriInfo uriInfo){
  return populateReportQueryResultListWithSelfLinks(results,items,uriInfo);
}

Fixed version (ground truth):
@Override public Object buildReportQueryResponse(PersistenceContext context,Map<String,Object> queryParams,List<Object[]> results,List<ReportItem> items,UriInfo uriInfo){
  return populateReportQueryResultList(results,items,uriInfo);
}
Program: 63962
Project: 63962
Buggy source:
@Override public Object buildReadAllQueryResponse(PersistenceContext context,Map<String,Object> queryParams,List<Object> items,UriInfo uriInfo){
  return responseWithSelfLinks(context,items,uriInfo);
}

Fixed version (ground truth):
@Override public Object buildReadAllQueryResponse(PersistenceContext context,Map<String,Object> queryParams,List<Object> items,UriInfo uriInfo){
  return response(context,items,uriInfo);
}
Program: 63963
Project: 63963
Buggy source:
@Override public Object buildSingleEntityResponse(PersistenceContext context,Map<String,Object> queryParams,Object result,UriInfo uriInfo){
  if (result instanceof PersistenceWeavedRest) {
    PersistenceWeavedRest entity=(PersistenceWeavedRest)result;
    List<Link> links=new ArrayList<Link>();
    links.add(new Link(ReservedWords.JPARS_REL_SELF,null,uriInfo.getRequestUri().toString()));
    entity._persistence_setLinks(links);
  }
  return result;
}

Fixed version (ground truth):
@Override public Object buildSingleEntityResponse(PersistenceContext context,Map<String,Object> queryParams,Object result,UriInfo uriInfo){
  if (result instanceof PersistenceWeavedRest) {
    ClassDescriptor descriptor=context.getJAXBDescriptorForClass(result.getClass());
    PersistenceWeavedRest entity=(PersistenceWeavedRest)result;
    entity._persistence_setLinks(new ArrayList<Link>());
    String href=context.getBaseURI() + context.getVersion() + "String_Node_Str"+ context.getName()+ "String_Node_Str"+ descriptor.getAlias()+ "String_Node_Str"+ IdHelper.stringifyId(result,descriptor.getAlias(),context);
    entity._persistence_getLinks().add(new Link(ReservedWords.JPARS_REL_SELF,null,href));
  }
  return result;
}
Program: 63968
Project: 63968
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object value=unmarshalRecord.getCharacters().toString();
  boolean isCDATA=unmarshalRecord.isBufferCDATA();
  unmarshalRecord.resetStringBuffer();
  Field toWrite=xmlField;
  if (xmlField.isCDATA() != isCDATA) {
    toWrite=new XMLField(xmlField.getName());
    toWrite.setNamespaceResolver(xmlField.getNamespaceResolver());
    toWrite.setIsCDATA(isCDATA);
  }
  XMLConversionManager xmlConversionManager=(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=xmlConversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,xmlConversionManager,unmarshalRecord);
  }
  if (null == unmarshalRecord.getTransformationRecord()) {
    unmarshalRecord.setTransformationRecord(new XMLTransformationRecord("String_Node_Str",unmarshalRecord));
  }
  unmarshalRecord.getTransformationRecord().put(toWrite,value);
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object value=unmarshalRecord.getCharacters().toString();
  boolean isCDATA=unmarshalRecord.isBufferCDATA();
  unmarshalRecord.resetStringBuffer();
  Field toWrite=xmlField;
  if (xmlField.isCDATA() != isCDATA) {
    toWrite=new XMLField(xmlField.getName());
    toWrite.setNamespaceResolver(xmlField.getNamespaceResolver());
    toWrite.setIsCDATA(isCDATA);
  }
  ConversionManager conversionManager=(ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=conversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  if (null == unmarshalRecord.getTransformationRecord()) {
    unmarshalRecord.setTransformationRecord(new XMLTransformationRecord("String_Node_Str",unmarshalRecord));
  }
  unmarshalRecord.getTransformationRecord().put(toWrite,value);
}
Program: 63969
Project: 63969
Buggy source:
public void attribute(UnmarshalRecord unmarshalRecord,String namespaceURI,String localName,String value){
  XMLConversionManager xmlConversionManager=(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  Object objectValue=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,xmlConversionManager,unmarshalRecord);
  if (null == unmarshalRecord.getTransformationRecord()) {
    unmarshalRecord.setTransformationRecord(new XMLTransformationRecord("String_Node_Str",unmarshalRecord));
  }
  unmarshalRecord.getTransformationRecord().put(xmlField,objectValue);
}

Fixed version (ground truth):
public void attribute(UnmarshalRecord unmarshalRecord,String namespaceURI,String localName,String value){
  ConversionManager conversionManager=(ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  Object objectValue=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  if (null == unmarshalRecord.getTransformationRecord()) {
    unmarshalRecord.setTransformationRecord(new XMLTransformationRecord("String_Node_Str",unmarshalRecord));
  }
  unmarshalRecord.getTransformationRecord().put(xmlField,objectValue);
}
Program: 63970
Project: 63970
Buggy source:
private QName getSchemaTypeForUnion(UnionField xmlField,Object value,CoreAbstractSession session){
  List schemaTypes=xmlField.getSchemaTypes();
  QName schemaType=null;
  QName nextQName;
  Class javaClass;
  for (int i=0; i < schemaTypes.size(); i++) {
    nextQName=(QName)xmlField.getSchemaTypes().get(i);
    try {
      if (nextQName != null) {
        javaClass=xmlField.getJavaClass(nextQName);
        value=((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,javaClass,nextQName);
        schemaType=nextQName;
        break;
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        schemaType=nextQName;
      }
    }
  }
  return schemaType;
}

Fixed version (ground truth):
private QName getSchemaTypeForUnion(UnionField xmlField,Object value,CoreAbstractSession session){
  List schemaTypes=xmlField.getSchemaTypes();
  QName schemaType=null;
  QName nextQName;
  Class javaClass;
  for (int i=0; i < schemaTypes.size(); i++) {
    nextQName=(QName)xmlField.getSchemaTypes().get(i);
    try {
      if (nextQName != null) {
        javaClass=xmlField.getJavaClass(nextQName);
        value=((ConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,javaClass,nextQName);
        schemaType=nextQName;
        break;
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        schemaType=nextQName;
      }
    }
  }
  return schemaType;
}
Program: 63971
Project: 63971
Buggy source:
protected String getValueToWrite(QName schemaType,Object value,CoreAbstractSession session){
  return (String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,CoreClassConstants.STRING,schemaType);
}

Fixed version (ground truth):
protected String getValueToWrite(QName schemaType,Object value,CoreAbstractSession session){
  return (String)((ConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,CoreClassConstants.STRING,schemaType);
}
Program: 63973
Project: 63973
Buggy source:
protected String getValueToWrite(QName schemaType,Object value,CoreAbstractSession session){
  return (String)((XMLConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,CoreClassConstants.STRING,schemaType);
}

Fixed version (ground truth):
protected String getValueToWrite(QName schemaType,Object value,CoreAbstractSession session){
  return (String)((ConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,CoreClassConstants.STRING,schemaType);
}
Program: 63974
Project: 63974
Buggy source:
/** 
 * Handle swaRef and inline attribute cases.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String URI,String localName,String value){
  unmarshalRecord.removeNullCapableValue(this);
  Field xmlField=(Field)xmlBinaryDataMapping.getField();
  XPathFragment lastFragment=xmlField.getLastXPathFragment();
  Object fieldValue=null;
  if (xmlBinaryDataMapping.isSwaRef()) {
    if (unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller() != null) {
      if (xmlBinaryDataMapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler(value);
      }
 else {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray(value);
      }
      xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession()));
    }
  }
 else {
    fieldValue=((XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value);
    xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession()));
  }
}

Fixed version (ground truth):
/** 
 * Handle swaRef and inline attribute cases.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String URI,String localName,String value){
  unmarshalRecord.removeNullCapableValue(this);
  Field xmlField=(Field)xmlBinaryDataMapping.getField();
  XPathFragment lastFragment=xmlField.getLastXPathFragment();
  Object fieldValue=null;
  if (xmlBinaryDataMapping.isSwaRef()) {
    if (unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller() != null) {
      if (xmlBinaryDataMapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler(value);
      }
 else {
        fieldValue=unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray(value);
      }
      xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession()));
    }
  }
 else {
    fieldValue=((ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value);
    xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(),XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue,xmlBinaryDataMapping.getAttributeClassification(),unmarshalRecord.getSession()));
  }
}
Program: 63976
Project: 63976
Buggy source:
/** 
 * Handle attribute operation.  Here we will create and populate an  org.eclipse.persistence.internal.oxm.Reference instance to be used during  the mapping resolution stage.  In particular, the primary key value for this element will be added to the Reference object's map of target primary key values - based on the target key field name.  Note  that if a reference already exists for the xmlCollectionReferenceMapping's  source object instance, we will simply add to the target pk value list.   The Reference object is stored on the ReferenceResolver associated with  the UnmarshalRecord's session.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String namespaceURI,String localName,String value){
  if (value != null) {
    Object realValue=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager(),unmarshalRecord);
    Object container=unmarshalRecord.getContainerInstance(this);
    xmlCollectionReferenceMapping.buildReference(unmarshalRecord,xmlField,realValue,unmarshalRecord.getSession(),container);
  }
}

Fixed version (ground truth):
/** 
 * Handle attribute operation.  Here we will create and populate an  org.eclipse.persistence.internal.oxm.Reference instance to be used during  the mapping resolution stage.  In particular, the primary key value for this element will be added to the Reference object's map of target primary key values - based on the target key field name.  Note  that if a reference already exists for the xmlCollectionReferenceMapping's  source object instance, we will simply add to the target pk value list.   The Reference object is stored on the ReferenceResolver associated with  the UnmarshalRecord's session.
 */
public void attribute(UnmarshalRecord unmarshalRecord,String namespaceURI,String localName,String value){
  if (value != null) {
    Object realValue=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,(ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager(),unmarshalRecord);
    Object container=unmarshalRecord.getContainerInstance(this);
    xmlCollectionReferenceMapping.buildReference(unmarshalRecord,xmlField,realValue,unmarshalRecord.getSession(),container);
  }
}
Program: 63979
Project: 63979
Buggy source:
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord,Object value,Object collection){
  if (unmarshalRecord.isNil() && unmarshalRecord.getXMLReader().isNullRepresentedByXsiNil(xmlCompositeDirectCollectionMapping.getNullPolicy())) {
    value=null;
  }
 else   if (!isWhitespaceAware() && Constants.EMPTY_STRING.equals(value)) {
    value=null;
  }
  Field xmlField=(Field)xmlCompositeDirectCollectionMapping.getField();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=xmlConversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,xmlConversionManager,unmarshalRecord);
  }
  value=xmlCompositeDirectCollectionMapping.convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
  if (value != null && value.getClass() == CoreClassConstants.STRING) {
    if (xmlCompositeDirectCollectionMapping.isCollapsingStringValues()) {
      value=XMLConversionManager.getDefaultXMLManager().collapseStringValue((String)value);
    }
 else     if (xmlCompositeDirectCollectionMapping.isNormalizingStringValues()) {
      value=XMLConversionManager.getDefaultXMLManager().normalizeStringValue((String)value);
    }
  }
  unmarshalRecord.addAttributeValue(this,value,collection);
}

Fixed version (ground truth):
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord,Object value,Object collection){
  if (unmarshalRecord.isNil() && unmarshalRecord.getXMLReader().isNullRepresentedByXsiNil(xmlCompositeDirectCollectionMapping.getNullPolicy())) {
    value=null;
  }
 else   if (!isWhitespaceAware() && Constants.EMPTY_STRING.equals(value)) {
    value=null;
  }
  Field xmlField=(Field)xmlCompositeDirectCollectionMapping.getField();
  ConversionManager conversionManager=(ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=conversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  value=xmlCompositeDirectCollectionMapping.convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
  if (value != null && value.getClass() == CoreClassConstants.STRING) {
    if (xmlCompositeDirectCollectionMapping.isCollapsingStringValues()) {
      value=XMLConversionManager.getDefaultXMLManager().collapseStringValue((String)value);
    }
 else     if (xmlCompositeDirectCollectionMapping.isNormalizingStringValues()) {
      value=XMLConversionManager.getDefaultXMLManager().normalizeStringValue((String)value);
    }
  }
  unmarshalRecord.addAttributeValue(this,value,collection);
}
Program: 63981
Project: 63981
Buggy source:
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,CoreAbstractSession session,NamespaceResolver namespaceResolver){
  QName qname=null;
  if (xmlRootFragment != null) {
    qname=((Root)originalValue).getSchemaType();
    Namespace generatedNamespace=setupFragment((Root)originalValue,xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    if (generatedNamespace != null) {
      marshalRecord.namespaceDeclaration(generatedNamespace.getPrefix(),generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname,marshalRecord,null);
  }
  marshalRecord.characters(qname,value,null,false);
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}

Fixed version (ground truth):
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,CoreAbstractSession session,NamespaceResolver namespaceResolver){
  QName qname=null;
  if (xmlRootFragment != null) {
    qname=((Root)originalValue).getSchemaType();
    setupFragment(((Root)originalValue),xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    updateNamespaces(qname,marshalRecord,null);
  }
  marshalRecord.characters(qname,value,null,false);
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}
Program: 63983
Project: 63983
Buggy source:
private Namespace setupFragment(Root originalValue,XPathFragment xmlRootFragment,MarshalRecord marshalRecord){
  Namespace generatedNamespace=null;
  String xpath=originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix=marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix=marshalRecord.getNamespaceResolver().generatePrefix();
      generatedNamespace=new Namespace(prefix,xmlRootFragment.getNamespaceURI());
    }
    xpath=prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

Fixed version (ground truth):
private Namespace setupFragment(Root originalValue,XPathFragment xmlRootFragment,MarshalRecord marshalRecord){
  Namespace generatedNamespace=null;
  String xpath=originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix=marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix=marshalRecord.getNamespaceResolver().generatePrefix();
      generatedNamespace=new Namespace(prefix,xmlRootFragment.getNamespaceURI());
      xmlRootFragment.setGeneratedPrefix(true);
    }
    xpath=prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}
Program: 63984
Project: 63984
Buggy source:
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,CoreAbstractSession session,NamespaceResolver namespaceResolver){
  QName qname=null;
  if (xmlRootFragment != null) {
    qname=((Root)originalValue).getSchemaType();
    Namespace generatedNamespace=setupFragment(((Root)originalValue),xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    if (generatedNamespace != null) {
      marshalRecord.namespaceDeclaration(generatedNamespace.getPrefix(),generatedNamespace.getNamespaceURI());
    }
    updateNamespaces(qname,marshalRecord,null);
  }
  if (value instanceof org.w3c.dom.Node) {
    marshalRecord.node((org.w3c.dom.Node)value,marshalRecord.getNamespaceResolver());
  }
 else {
    marshalRecord.characters(qname,value,null,false);
  }
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}

Fixed version (ground truth):
private void marshalSimpleValue(XPathFragment xmlRootFragment,MarshalRecord marshalRecord,Object originalValue,Object object,Object value,CoreAbstractSession session,NamespaceResolver namespaceResolver){
  QName qname=null;
  if (xmlRootFragment != null) {
    qname=((Root)originalValue).getSchemaType();
    setupFragment(((Root)originalValue),xmlRootFragment,marshalRecord);
    getXPathNode().startElement(marshalRecord,xmlRootFragment,object,session,namespaceResolver,null,null);
    updateNamespaces(qname,marshalRecord,null);
  }
  if (value instanceof org.w3c.dom.Node) {
    marshalRecord.node((org.w3c.dom.Node)value,marshalRecord.getNamespaceResolver());
  }
 else {
    marshalRecord.characters(qname,value,null,false);
  }
  if (xmlRootFragment != null) {
    marshalRecord.endElement(xmlRootFragment,namespaceResolver);
  }
}
Program: 63986
Project: 63986
Buggy source:
private Namespace setupFragment(Root originalValue,XPathFragment xmlRootFragment,MarshalRecord marshalRecord){
  Namespace generatedNamespace=null;
  String xpath=originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix=marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix=marshalRecord.getNamespaceResolver().generatePrefix("String_Node_Str");
      generatedNamespace=new Namespace(prefix,xmlRootFragment.getNamespaceURI());
    }
    xpath=prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}

Fixed version (ground truth):
private Namespace setupFragment(Root originalValue,XPathFragment xmlRootFragment,MarshalRecord marshalRecord){
  Namespace generatedNamespace=null;
  String xpath=originalValue.getLocalName();
  if (originalValue.getNamespaceURI() != null) {
    xmlRootFragment.setNamespaceURI((originalValue).getNamespaceURI());
    String prefix=marshalRecord.getNamespaceResolver().resolveNamespaceURI((originalValue).getNamespaceURI());
    if (prefix == null || prefix.length() == 0) {
      prefix=marshalRecord.getNamespaceResolver().generatePrefix("String_Node_Str");
      generatedNamespace=new Namespace(prefix,xmlRootFragment.getNamespaceURI());
      xmlRootFragment.setGeneratedPrefix(true);
    }
    xpath=prefix + Constants.COLON + xpath;
  }
  xmlRootFragment.setXPath(xpath);
  return generatedNamespace;
}
Program: 63988
Project: 63988
Buggy source:
/** 
 * INTERNAL: Create a start element tag - this call results in a complete start element,  i.e. closeStartElement() does not need to be called after a call to this  method.
 */
private void openAndCloseStartElement(){
  try {
    String namespaceUri=xPathFragment.getNamespaceURI();
    if (namespaceUri == null) {
      namespaceUri=Constants.EMPTY_STRING;
    }
    contentHandler.startElement(namespaceUri,xPathFragment.getLocalName(),getNameForFragment(xPathFragment),attributes);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Create a start element tag - this call results in a complete start element,  i.e. closeStartElement() does not need to be called after a call to this  method.
 */
private void openAndCloseStartElement(){
  try {
    String namespaceUri=xPathFragment.getNamespaceURI();
    if (namespaceUri == null) {
      namespaceUri=Constants.EMPTY_STRING;
    }
    if (xPathFragment.isGeneratedPrefix()) {
      this.namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
    }
    contentHandler.startElement(namespaceUri,xPathFragment.getLocalName(),getNameForFragment(xPathFragment),attributes);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63989
Project: 63989
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(CR);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(getNameForFragmentBytes(xPathFragment));
  numberOfTabs++;
  isLastEventText=false;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
  }
  if (!isLastEventText) {
    if (numberOfTabs > 0) {
      outputStreamWrite(CR);
    }
    outputStreamWriteTab();
  }
  isStartElementOpen=true;
  outputStreamWrite(OPEN_START_ELEMENT);
  outputStreamWrite(getNameForFragmentBytes(xPathFragment));
  if (xPathFragment.isGeneratedPrefix()) {
    namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
  }
  numberOfTabs++;
  isLastEventText=false;
}
Program: 63990
Project: 63990
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        writer.write(Helper.cr());
      }
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(tab());
      }
    }
    isStartElementOpen=true;
    writer.write('<');
    writer.write(getNameForFragment(xPathFragment));
    numberOfTabs++;
    isLastEventText=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        writer.write(Helper.cr());
      }
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(tab());
      }
    }
    isStartElementOpen=true;
    writer.write('<');
    writer.write(getNameForFragment(xPathFragment));
    if (xPathFragment.isGeneratedPrefix()) {
      namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
    }
    numberOfTabs++;
    isLastEventText=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63991
Project: 63991
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  try {
    super.openStartElement(xPathFragment,namespaceResolver);
    Element element=document.createElementNS(xPathFragment.getNamespaceURI(),getNameForFragment(xPathFragment));
    node=node.appendChild(element);
  }
 catch (  DOMException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  try {
    super.openStartElement(xPathFragment,namespaceResolver);
    Element element=document.createElementNS(xPathFragment.getNamespaceURI(),getNameForFragment(xPathFragment));
    node=node.appendChild(element);
    if (xPathFragment.isGeneratedPrefix()) {
      namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
    }
  }
 catch (  DOMException e) {
    throw XMLMarshalException.marshalException(e);
  }
}