nus-yam/ex-repair huggingface dataset:
Program: 66795
Project: 66795
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  suite.addTest(new CacheImplJUnitTest("String_Node_Str"));
  return suite;
}
Program: 66796
Project: 66796
Buggy source:
public boolean contains(Class cls,Object primaryKey){
  this.emf.verifyOpen();
  return this.accessor.containsObjectInIdentityMap(createPKVector(cls,primaryKey),cls);
}

Fixed version (ground truth):
public boolean contains(Class cls,Object primaryKey){
  this.emf.verifyOpen();
  Vector pk=createPKVector(cls,primaryKey);
  ClassDescriptor descriptor=this.serversession.getDescriptor(cls);
  CacheKey key=((org.eclipse.persistence.internal.sessions.IdentityMapAccessor)this.accessor).getCacheKeyForObject(pk,cls,descriptor);
  return key != null && !descriptor.getCacheInvalidationPolicy().isInvalidated(key);
}
Program: 66797
Project: 66797
Buggy source:
public CompositePKTableCreator(){
  setName("String_Node_Str");
  addTableDefinition(buildADMIN_CONTRACTTable());
  addTableDefinition(buildADMINTable());
  addTableDefinition(buildSCIENTISTTable());
  addTableDefinition(buildDEPARTMENTTable());
  addTableDefinition(buildDEPT_ADMINTable());
  addTableDefinition(buildCUBICLETable());
  addTableDefinition(buildSARGEANTTable());
  addTableDefinition(buildMASTERCORPORALTable());
  addTableDefinition(buildMAJORTable());
  addTableDefinition(buildMAJORGENERALTable());
  addTableDefinition(buildCAPTAINTable());
  addTableDefinition(buildBRIGADIERGENERALTable());
  addTableDefinition(buildCORPORALTable());
  addTableDefinition(buildPRIVATETable());
  addTableDefinition(buildGENERALTable());
  addTableDefinition(buildLIEUTENANTGENERALTable());
  addTableDefinition(buildLIEUTENANTTable());
  addTableDefinition(buildSECONDLIEUTENANTTable());
  addTableDefinition(buildOFFICERCADETTable());
  addTableDefinition(buildLACKEYTable());
  addTableDefinition(buildLACKEYCREWTable());
  addTableDefinition(buildOFFICETable());
  addTableDefinition(buildADMINPOOLTable());
}

Fixed version (ground truth):
public CompositePKTableCreator(){
  setName("String_Node_Str");
  addTableDefinition(buildADMIN_CONTRACTTable());
  addTableDefinition(buildADMINTable());
  addTableDefinition(buildSCIENTISTTable());
  addTableDefinition(buildDEPARTMENTTable());
  addTableDefinition(buildDEPT_ADMINTable());
  addTableDefinition(buildCUBICLETable());
  addTableDefinition(buildSARGEANTTable());
  addTableDefinition(buildMASTERCORPORALTable());
  addTableDefinition(buildMAJORTable());
  addTableDefinition(buildMAJORGENERALTable());
  addTableDefinition(buildCAPTAINTable());
  addTableDefinition(buildBRIGADIERGENERALTable());
  addTableDefinition(buildCORPORALTable());
  addTableDefinition(buildPRIVATETable());
  addTableDefinition(buildGENERALTable());
  addTableDefinition(buildLIEUTENANTGENERALTable());
  addTableDefinition(buildLIEUTENANTTable());
  addTableDefinition(buildSECONDLIEUTENANTTable());
  addTableDefinition(buildOFFICERCADETTable());
  addTableDefinition(buildLACKEYTable());
  addTableDefinition(buildLACKEYCREWTable());
  addTableDefinition(buildOFFICETable());
  addTableDefinition(buildBOOKIETable());
  addTableDefinition(buildCELLNUMBERTable());
  addTableDefinition(buildADMINPOOLTable());
}
Program: 66798
Project: 66798
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedCompositePKJunitTest("String_Node_Str"));
  return suite;
}
Program: 66799
Project: 66799
Buggy source:
/** 
 * INTERNAL:
 */
private static XMLDescriptor buildPUInfoDescriptor(NamespaceResolver resolver){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setNamespaceResolver(resolver);
  descriptor.setJavaClass(SEPersistenceUnitInfo.class);
  descriptor.addDirectMapping("String_Node_Str","String_Node_Str");
  descriptor.addDirectMapping("String_Node_Str","String_Node_Str");
  XMLCompositeDirectCollectionMapping classesMapping=new XMLCompositeDirectCollectionMapping();
  classesMapping.setAttributeName("String_Node_Str");
  classesMapping.setXPath("String_Node_Str");
  descriptor.addMapping(classesMapping);
  XMLCompositeDirectCollectionMapping mappingFilesMapping=new XMLCompositeDirectCollectionMapping();
  mappingFilesMapping.setAttributeName("String_Node_Str");
  mappingFilesMapping.setXPath("String_Node_Str");
  descriptor.addMapping(mappingFilesMapping);
  XMLCompositeCollectionMapping persistenceUnitPropertiesMapping=new XMLCompositeCollectionMapping();
  persistenceUnitPropertiesMapping.setAttributeName("String_Node_Str");
  persistenceUnitPropertiesMapping.setGetMethodName("String_Node_Str");
  persistenceUnitPropertiesMapping.setSetMethodName("String_Node_Str");
  persistenceUnitPropertiesMapping.setReferenceClass(SEPersistenceUnitProperty.class);
  persistenceUnitPropertiesMapping.setXPath("String_Node_Str");
  descriptor.addMapping(persistenceUnitPropertiesMapping);
  return descriptor;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
private static XMLDescriptor buildPUInfoDescriptor(NamespaceResolver resolver){
  XMLDescriptor descriptor=new XMLDescriptor();
  descriptor.setNamespaceResolver(resolver);
  descriptor.setJavaClass(SEPersistenceUnitInfo.class);
  descriptor.addDirectMapping("String_Node_Str","String_Node_Str");
  XMLDirectMapping mapping=new XMLDirectMapping();
  mapping.setAttributeName("String_Node_Str");
  mapping.setXPath("String_Node_Str");
  mapping.setNullValue(false);
  descriptor.addMapping(mapping);
  XMLCompositeDirectCollectionMapping classesMapping=new XMLCompositeDirectCollectionMapping();
  classesMapping.setAttributeName("String_Node_Str");
  classesMapping.setXPath("String_Node_Str");
  descriptor.addMapping(classesMapping);
  XMLCompositeDirectCollectionMapping mappingFilesMapping=new XMLCompositeDirectCollectionMapping();
  mappingFilesMapping.setAttributeName("String_Node_Str");
  mappingFilesMapping.setXPath("String_Node_Str");
  descriptor.addMapping(mappingFilesMapping);
  XMLCompositeCollectionMapping persistenceUnitPropertiesMapping=new XMLCompositeCollectionMapping();
  persistenceUnitPropertiesMapping.setAttributeName("String_Node_Str");
  persistenceUnitPropertiesMapping.setGetMethodName("String_Node_Str");
  persistenceUnitPropertiesMapping.setSetMethodName("String_Node_Str");
  persistenceUnitPropertiesMapping.setReferenceClass(SEPersistenceUnitProperty.class);
  persistenceUnitPropertiesMapping.setXPath("String_Node_Str");
  descriptor.addMapping(persistenceUnitPropertiesMapping);
  return descriptor;
}
Program: 66800
Project: 66800
Buggy source:
public void close(){
  try {
    jarFile.close();
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void close(){
}
Program: 66801
Project: 66801
Buggy source:
/** 
 * INTERNAL:
 */
protected void addXMLEntityMappings(String mappingFile){
  try {
    FileObject fileObject=null;
    try {
      fileObject=persistenceUnitReader.getFileObject(mappingFile,processingEnv);
      addXMLEntityMappings(fileObject,mappingFile,XMLEntityMappingsReader.getEclipseLinkOrmProject());
    }
 catch (    XMLMarshalException e) {
      try {
        addXMLEntityMappings(fileObject,mappingFile,XMLEntityMappingsReader.getOrm2Project());
      }
 catch (      XMLMarshalException ee) {
        addXMLEntityMappings(fileObject,mappingFile,XMLEntityMappingsReader.getOrm1Project());
      }
    }
  }
 catch (  IOException exception) {
    processingEnv.getMessager().printMessage(Kind.NOTE,"String_Node_Str" + mappingFile);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected void addXMLEntityMappings(String mappingFile){
  try {
    addXMLEntityMappings(mappingFile,XMLEntityMappingsReader.getEclipseLinkOrmProject());
  }
 catch (  XMLMarshalException e) {
    try {
      addXMLEntityMappings(mappingFile,XMLEntityMappingsReader.getOrm2Project());
    }
 catch (    XMLMarshalException ee) {
      addXMLEntityMappings(mappingFile,XMLEntityMappingsReader.getOrm1Project());
    }
  }
}
Program: 66802
Project: 66802
Buggy source:
/** 
 * INTERNAL: If the accessor is no longer valid it we should probably look into removing the accessor from the project. For now I don't think its a big deal.
 */
public boolean containsElement(Element element){
  MetadataClass cls=factory.getMetadataClass(element);
  if (project.hasEntity(cls)) {
    return isValidAccessor(project.getEntityAccessor(cls),element.getAnnotation(javax.persistence.Entity.class));
  }
  if (project.hasEmbeddable(cls)) {
    return isValidAccessor(project.getEmbeddableAccessor(cls),element.getAnnotation(javax.persistence.Embeddable.class));
  }
  if (project.hasMappedSuperclass(cls)) {
    return isValidAccessor(project.getMappedSuperclassAccessor(cls),element.getAnnotation(javax.persistence.MappedSuperclass.class));
  }
  return false;
}

Fixed version (ground truth):
/** 
 * INTERNAL: If the accessor is no longer valid it we should probably look into removing the accessor from the project. For now I don't think it's  a big deal.
 */
public boolean containsElement(Element element){
  MetadataClass cls=factory.getMetadataClass(element);
  if (project.hasEntity(cls)) {
    return isValidAccessor(project.getEntityAccessor(cls),element.getAnnotation(javax.persistence.Entity.class));
  }
  if (project.hasEmbeddable(cls)) {
    return isValidAccessor(project.getEmbeddableAccessor(cls),element.getAnnotation(javax.persistence.Embeddable.class));
  }
  if (project.hasMappedSuperclass(cls)) {
    return isValidAccessor(project.getMappedSuperclassAccessor(cls),element.getAnnotation(javax.persistence.MappedSuperclass.class));
  }
  return false;
}
Program: 66803
Project: 66803
Buggy source:
public Project(){
  this.teamMembers=new Vector<Employee>();
}

Fixed version (ground truth):
public Project(){
  fieldOnlySetThroughConstructor=1;
  this.teamMembers=new Vector<Employee>();
}
Program: 66804
Project: 66804
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.setName("String_Node_Str");
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  suite.addTest(new AdvancedJPAJunitTest("String_Node_Str"));
  return suite;
}
Program: 66808
Project: 66808
Buggy source:
/** 
 * Set the Node that the object will be marshalled to.
 * @param writer The marshal target.
 */
public void setDOM(Node dom){
  nodes=new ArrayList();
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    document=(Document)dom;
  }
 else   if ((dom.getNodeType() == Node.ELEMENT_NODE) || (dom.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
    document=dom.getOwnerDocument();
    nodes.add(dom);
    getNamespaceResolver().setDOM(dom);
  }
 else {
    throw XMLMarshalException.marshalException(null);
  }
}

Fixed version (ground truth):
/** 
 * Set the Node that the object will be marshalled to.
 * @param writer The marshal target.
 */
public void setDOM(Node dom){
  int nodeType=dom.getNodeType();
  if (Node.DOCUMENT_NODE == nodeType) {
    document=(Document)dom;
    node=dom;
  }
 else   if (Node.ELEMENT_NODE == nodeType || Node.DOCUMENT_FRAGMENT_NODE == nodeType) {
    document=dom.getOwnerDocument();
    node=dom;
    getNamespaceResolver().setDOM(dom);
  }
 else {
    throw XMLMarshalException.marshalException(null);
  }
}
Program: 66809
Project: 66809
Buggy source:
/** 
 * Return the Node that the object will be marshalled to.
 * @return The marshal target.
 */
public Element getDOM(){
  return (Element)nodes.get(nodes.size() - 1);
}

Fixed version (ground truth):
/** 
 * Return the Node that the object will be marshalled to.
 * @return The marshal target.
 */
public Element getDOM(){
  return (Element)node;
}
Program: 66810
Project: 66810
Buggy source:
/** 
 * INTERNAL: Create a record with the element.
 */
public NodeRecord(Document document){
  this();
  setDOM(document.getDocumentElement());
}

Fixed version (ground truth):
/** 
 * INTERNAL: Create a record with the element.
 */
public NodeRecord(Node node){
  setDOM(node);
}
Program: 66811
Project: 66811
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  Element element=document.createElementNS(xPathFragment.getNamespaceURI(),xPathFragment.getShortName());
  try {
    getNode().appendChild(element);
    nodes.add(element);
  }
 catch (  Exception e) {
    document.appendChild(element);
    setDOM(element);
    nodes.add(element);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  Element element=document.createElementNS(xPathFragment.getNamespaceURI(),xPathFragment.getShortName());
  node=node.appendChild(element);
}
Program: 66812
Project: 66812
Buggy source:
/** 
 * INTERNAL:
 */
public void characters(String value){
  if (value.length() > 0) {
    getNode().appendChild(document.createTextNode(value));
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void characters(String value){
  if (value.length() > 0) {
    node.appendChild(document.createTextNode(value));
  }
}
Program: 66813
Project: 66813
Buggy source:
/** 
 * INTERNAL:
 */
public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  nodes.remove(nodes.size() - 1);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  node=node.getParentNode();
}
Program: 66814
Project: 66814
Buggy source:
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  if (getNode().getNodeType() == Node.ELEMENT_NODE) {
    getDOM().setAttributeNS(namespaceURI,qName,value);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void attribute(String namespaceURI,String localName,String qName,String value){
  if (node.getNodeType() == Node.ELEMENT_NODE) {
    getDOM().setAttributeNS(namespaceURI,qName,value);
  }
}
Program: 66815
Project: 66815
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  Element element=document.createElementNS(frag.getNamespaceURI(),frag.getShortName());
  getNode().appendChild(element);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  Element element=document.createElementNS(frag.getNamespaceURI(),frag.getShortName());
  node.appendChild(element);
}
Program: 66816
Project: 66816
Buggy source:
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  Element element;
  if (namespaceURI == null) {
    element=document.createElement(qName);
  }
 else {
    element=document.createElementNS(namespaceURI,qName);
  }
  try {
    getNode().appendChild(element);
    nodes.add(element);
  }
 catch (  Exception e) {
    document.appendChild(element);
    setDOM(element);
    nodes.add(element);
  }
  for (int i=0; i < atts.getLength(); i++) {
    marshalRecord.attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
  if (!prefixMappings.isEmpty()) {
    for (Iterator<Map.Entry<String,String>> entries=prefixMappings.entrySet().iterator(); entries.hasNext(); ) {
      Map.Entry<String,String> entry=entries.next();
      element.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + entry.getKey(),entry.getValue());
    }
    prefixMappings.clear();
  }
  marshalRecord.closeStartElement();
}

Fixed version (ground truth):
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  Element element;
  if (namespaceURI == null) {
    element=document.createElement(qName);
  }
 else {
    element=document.createElementNS(namespaceURI,qName);
  }
  node=node.appendChild(element);
  for (int i=0; i < atts.getLength(); i++) {
    marshalRecord.attribute(atts.getURI(i),atts.getLocalName(i),atts.getQName(i),atts.getValue(i));
  }
  if (!prefixMappings.isEmpty()) {
    for (Iterator<Map.Entry<String,String>> entries=prefixMappings.entrySet().iterator(); entries.hasNext(); ) {
      Map.Entry<String,String> entry=entries.next();
      element.setAttributeNS(XMLConstants.XMLNS_URL,XMLConstants.XMLNS + XMLConstants.COLON + entry.getKey(),entry.getValue());
    }
    prefixMappings.clear();
  }
  marshalRecord.closeStartElement();
}
Program: 66817
Project: 66817
Buggy source:
public void cdata(String value){
  CDATASection cdata=document.createCDATASection(value);
  getNode().appendChild(cdata);
}

Fixed version (ground truth):
public void cdata(String value){
  CDATASection cdata=document.createCDATASection(value);
  node.appendChild(cdata);
}
Program: 66818
Project: 66818
Buggy source:
public String getLocalName(){
  return getNode().getLocalName();
}

Fixed version (ground truth):
public String getLocalName(){
  return node.getLocalName();
}
Program: 66819
Project: 66819
Buggy source:
public String getNamespaceURI(){
  return getNode().getNamespaceURI();
}

Fixed version (ground truth):
public String getNamespaceURI(){
  return node.getNamespaceURI();
}
Program: 66820
Project: 66820
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 {
    contentHandler.startElement(namespaceURI,xPathFragment.getLocalName(),xPathFragment.getShortName(),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 {
    contentHandler.startElement(xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),xPathFragment.getShortName(),attributes);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66821
Project: 66821
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  isStartElementOpen=true;
  this.namespaceURI=xPathFragment.getNamespaceURI();
  this.xPathFragment=xPathFragment;
  this.attributes=new AttributesImpl();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (isStartElementOpen) {
    openAndCloseStartElement();
  }
  this.isStartElementOpen=true;
  this.xPathFragment=xPathFragment;
  this.attributes.clear();
}
Program: 66822
Project: 66822
Buggy source:
/** 
 * INTERNAL:
 */
public void characters(String value){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    contentHandler.characters(value.toCharArray(),0,value.length());
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void characters(String value){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    char[] characters=value.toCharArray();
    contentHandler.characters(characters,0,characters.length);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66823
Project: 66823
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    this.attributes=new AttributesImpl();
    contentHandler.startElement(frag.getNamespaceURI(),frag.getLocalName(),frag.getShortName(),attributes);
    contentHandler.endElement(frag.getNamespaceURI(),frag.getLocalName(),frag.getShortName());
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    this.attributes.clear();
    String namespaceURI=frag.getNamespaceURI();
    String localName=frag.getLocalName();
    String shortName=frag.getShortName();
    contentHandler.startElement(namespaceURI,localName,shortName,attributes);
    contentHandler.endElement(namespaceURI,localName,shortName);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66824
Project: 66824
Buggy source:
private void initialize(){
  XMLPlatform xmlPlatform=XMLPlatformFactory.getInstance().getXMLPlatform();
  transformer=xmlPlatform.newXMLTransformer();
  setEncoding(DEFAULT_XML_ENCODING);
  setFormattedOutput(true);
  marshalProperties=new Properties();
}

Fixed version (ground truth):
private void initialize(){
  XMLPlatform xmlPlatform=XMLPlatformFactory.getInstance().getXMLPlatform();
  transformer=xmlPlatform.newXMLTransformer();
  setEncoding(XMLConstants.DEFAULT_XML_ENCODING);
  setFormattedOutput(true);
  marshalProperties=new Properties();
}
Program: 66825
Project: 66825
Buggy source:
/** 
 * INTERNAL:
 */
public void element(String namespaceURI,String localName,String qName){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    this.attributes=new AttributesImpl();
    contentHandler.startElement(namespaceURI,localName,qName,attributes);
    contentHandler.endElement(namespaceURI,localName,qName);
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  if (isStartElementOpen) {
    openAndCloseStartElement();
    isStartElementOpen=false;
  }
  try {
    this.attributes=new AttributesImpl();
    contentHandler.startElement(frag.getNamespaceURI(),frag.getLocalName(),frag.getShortName(),attributes);
    contentHandler.endElement(frag.getNamespaceURI(),frag.getLocalName(),frag.getShortName());
  }
 catch (  SAXException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66829
Project: 66829
Buggy source:
public Object readFromRowIntoObject(AbstractRecord databaseRow,JoinedAttributeManager joinManager,Object targetObject,ObjectBuildingQuery sourceQuery,AbstractSession executionSession) throws DatabaseException {
  Object fieldValue=databaseRow.getIndicatingNoEntry(getField());
  if ((null == fieldValue) || fieldValue instanceof String) {
    if (getNullPolicy().getIsSetPerformedForAbsentNode()) {
      setAttributeValueInObject(targetObject,null);
    }
 else {
      return null;
    }
    return null;
  }
  XMLRecord nestedRow=(XMLRecord)this.getDescriptor().buildNestedRowFromFieldValue(fieldValue);
  if (getNullPolicy().valueIsNull((Element)nestedRow.getDOM())) {
    setAttributeValueInObject(targetObject,null);
    return null;
  }
  Object attributeValue=valueFromRow(fieldValue,nestedRow,joinManager,sourceQuery,executionSession);
  setAttributeValueInObject(targetObject,attributeValue);
  if (null != getContainerAccessor()) {
    getContainerAccessor().setAttributeValueInObject(attributeValue,targetObject);
  }
  return attributeValue;
}

Fixed version (ground truth):
public Object readFromRowIntoObject(AbstractRecord databaseRow,JoinedAttributeManager joinManager,Object targetObject,ObjectBuildingQuery sourceQuery,AbstractSession executionSession) throws DatabaseException {
  Object fieldValue=databaseRow.getIndicatingNoEntry(getField());
  if ((null == fieldValue) || fieldValue instanceof String) {
    if (getNullPolicy().getIsSetPerformedForAbsentNode()) {
      setAttributeValueInObject(targetObject,null);
    }
 else {
      return null;
    }
    return null;
  }
  XMLRecord nestedRow=(XMLRecord)this.getDescriptor().buildNestedRowFromFieldValue(fieldValue);
  if (getNullPolicy().valueIsNull((Element)nestedRow.getDOM())) {
    setAttributeValueInObject(targetObject,null);
    return null;
  }
  Object attributeValue=valueFromRow(fieldValue,nestedRow,joinManager,sourceQuery,executionSession);
  setAttributeValueInObject(targetObject,attributeValue);
  if (null != getContainerAccessor()) {
    if (this.bidirectionalPolicy.getBidirectionalTargetContainerPolicy() == null) {
      getContainerAccessor().setAttributeValueInObject(attributeValue,targetObject);
    }
 else {
      Object backpointerContainer=getContainerAccessor().getAttributeValueFromObject(attributeValue);
      if (backpointerContainer == null) {
        backpointerContainer=bidirectionalPolicy.getBidirectionalTargetContainerPolicy().containerInstance();
        getContainerAccessor().setAttributeValueInObject(attributeValue,backpointerContainer);
      }
      bidirectionalPolicy.getBidirectionalTargetContainerPolicy().addInto(targetObject,backpointerContainer,executionSession);
    }
  }
  return attributeValue;
}
Program: 66835
Project: 66835
Buggy source:
/** 
 * This exception should be used when an attempt is made to set an ID property when one has already been set.
 * @param propertyName attempting to set this property as ID
 * @param idPropertyName existing ID property
 * @param descriptorAlias descriptor in question
 * @return
 */
public static JAXBException idAlreadySet(String propertyName,String idPropertyName,String descriptorAlias){
  Object[] args={propertyName,descriptorAlias,idPropertyName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,ID_ALREADY_SET,args));
  exception.setErrorCode(ID_ALREADY_SET);
  return exception;
}

Fixed version (ground truth):
/** 
 * This exception should be used when an attempt is made to set an ID property when one has already been set.
 * @param propertyName attempting to set this property as ID
 * @param idPropertyName existing ID property
 * @param className class in question
 * @return
 */
public static JAXBException idAlreadySet(String propertyName,String idPropertyName,String className){
  Object[] args={propertyName,className,idPropertyName};
  JAXBException exception=new JAXBException(ExceptionMessageGenerator.buildMessage(JAXBException.class,ID_ALREADY_SET,args));
  exception.setErrorCode(ID_ALREADY_SET);
  return exception;
}
Program: 66836
Project: 66836
Buggy source:
public boolean marshalAttributes(MarshalRecord marshalRecord,Object object,AbstractSession session){
  boolean hasValue=false;
  NamespaceResolver namespaceResolver=((XMLDescriptor)this.getDescriptor()).getNamespaceResolver();
  List attributeChildren=rootXPathNode.getAttributeChildren();
  if (null != attributeChildren) {
    for (int x=0, attributeChildrenSize=attributeChildren.size(); x < attributeChildrenSize; x++) {
      XPathNode attributeNode=(XPathNode)rootXPathNode.getAttributeChildren().get(x);
      hasValue=attributeNode.marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance()) || hasValue;
    }
  }
  if (rootXPathNode.getAnyAttributeNode() != null) {
    hasValue=rootXPathNode.getAnyAttributeNode().marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance()) || hasValue;
  }
  List selfChildren=rootXPathNode.getSelfChildren();
  if (null != selfChildren) {
    for (int x=0, selfChildrenSize=selfChildren.size(); x < selfChildrenSize; x++) {
      XPathNode childNode=(XPathNode)selfChildren.get(x);
      childNode.marshalSelfAttributes(marshalRecord,object,session,namespaceResolver,marshalRecord.getMarshaller());
    }
  }
  return hasValue;
}

Fixed version (ground truth):
public boolean marshalAttributes(MarshalRecord marshalRecord,Object object,AbstractSession session){
  boolean hasValue=false;
  NamespaceResolver namespaceResolver=((XMLDescriptor)this.getDescriptor()).getNamespaceResolver();
  List<XPathNode> attributeChildren=rootXPathNode.getAttributeChildren();
  if (null != attributeChildren) {
    for (int x=0, attributeChildrenSize=attributeChildren.size(); x < attributeChildrenSize; x++) {
      hasValue=attributeChildren.get(x).marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance()) || hasValue;
    }
  }
  if (rootXPathNode.getAnyAttributeNode() != null) {
    hasValue=rootXPathNode.getAnyAttributeNode().marshal(marshalRecord,object,session,namespaceResolver,null,ObjectMarshalContext.getInstance()) || hasValue;
  }
  List<XPathNode> selfChildren=rootXPathNode.getSelfChildren();
  if (null != selfChildren) {
    for (int x=0, selfChildrenSize=selfChildren.size(); x < selfChildrenSize; x++) {
      selfChildren.get(x).marshalSelfAttributes(marshalRecord,object,session,namespaceResolver,marshalRecord.getMarshaller());
    }
  }
  return hasValue;
}
Program: 66837
Project: 66837
Buggy source:
public void addNullCapableValue(NullCapableValue nullCapableValue){
  if (null == getNullCapableValues()) {
    this.nullCapableValues=new ArrayList();
  }
  this.nullCapableValues.add(nullCapableValue);
}

Fixed version (ground truth):
public void addNullCapableValue(NullCapableValue nullCapableValue){
  if (null == this.nullCapableValues) {
    this.nullCapableValues=new ArrayList();
  }
  this.nullCapableValues.add(nullCapableValue);
}
Program: 66838
Project: 66838
Buggy source:
public void addTransformationMapping(AbstractTransformationMapping transformationMapping){
  if (null == getTransformationMappings()) {
    this.transformationMappings=new ArrayList();
  }
  transformationMappings.add(transformationMapping);
}

Fixed version (ground truth):
public void addTransformationMapping(AbstractTransformationMapping transformationMapping){
  if (null == this.transformationMappings) {
    this.transformationMappings=new ArrayList();
  }
  transformationMappings.add(transformationMapping);
}
Program: 66840
Project: 66840
Buggy source:
public void addContainerValue(ContainerValue containerValue){
  if (null == getContainerValues()) {
    this.containerValues=new ArrayList();
  }
  this.containerValues.add(containerValue);
}

Fixed version (ground truth):
public void addContainerValue(ContainerValue containerValue){
  if (null == this.containerValues) {
    this.containerValues=new ArrayList();
  }
  this.containerValues.add(containerValue);
}
Program: 66841
Project: 66841
Buggy source:
public void addChild(XPathFragment xPathFragment,NodeValue nodeValue,NamespaceResolver namespaceResolver){
  getRootXPathNode().addChild(xPathFragment,nodeValue,namespaceResolver);
}

Fixed version (ground truth):
public XPathNode addChild(XPathFragment xPathFragment,NodeValue nodeValue,NamespaceResolver namespaceResolver){
  return getRootXPathNode().addChild(xPathFragment,nodeValue,namespaceResolver);
}
Program: 66842
Project: 66842
Buggy source:
private Node selectSingleAttribute(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver){
  if (xPathFragment.hasNamespace()) {
    String attributeNamespaceURI=xmlNamespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
    return contextNode.getAttributes().getNamedItemNS(attributeNamespaceURI,xPathFragment.getLocalName());
  }
 else {
    return contextNode.getAttributes().getNamedItem(xPathFragment.getShortName());
  }
}

Fixed version (ground truth):
private Node selectSingleAttribute(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver){
  if (xPathFragment.hasNamespace()) {
    if (Node.ELEMENT_NODE == contextNode.getNodeType()) {
      String attributeNamespaceURI=xmlNamespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
      return contextNode.getAttributes().getNamedItemNS(attributeNamespaceURI,xPathFragment.getLocalName());
    }
 else {
      return null;
    }
  }
 else {
    if (Node.ELEMENT_NODE == contextNode.getNodeType()) {
      return contextNode.getAttributes().getNamedItem(xPathFragment.getShortName());
    }
 else {
      return null;
    }
  }
}
Program: 66843
Project: 66843
Buggy source:
/** 
 * Indicate if the next XPathFragment is an attribute or text() node.
 */
public boolean isOwningNode(XPathFragment xPathFragment){
  if (xmlCollectionReferenceMapping.usesSingleNode()) {
    return xPathFragment.nameIsText() || xPathFragment.isAttribute();
  }
  XPathFragment nextFragment=xPathFragment.getNextFragment();
  return (nextFragment != null) && (nextFragment.nameIsText() || nextFragment.isAttribute());
}

Fixed version (ground truth):
/** 
 * Indicate if the next XPathFragment is an attribute or text() node.
 */
public boolean isOwningNode(XPathFragment xPathFragment){
  if (isMarshalNodeValue()) {
    if (xmlCollectionReferenceMapping.usesSingleNode()) {
      return xPathFragment.nameIsText() || xPathFragment.isAttribute();
    }
    XPathFragment nextFragment=xPathFragment.getNextFragment();
    return (nextFragment != null) && (nextFragment.nameIsText() || nextFragment.isAttribute());
  }
  return super.isOwningNode(xPathFragment);
}
Program: 66845
Project: 66845
Buggy source:
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object targetObject,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=xmlObjectReferenceMapping.buildFieldValue(targetObject,xmlField,session);
  if (fieldValue == null) {
    return false;
  }
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
  XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
  if (xPathFragment.isAttribute()) {
    marshalRecord.attribute(xPathFragment,namespaceResolver,stringValue);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    marshalRecord.closeStartGroupingElements(groupingFragment);
    marshalRecord.characters(stringValue);
  }
  return true;
}

Fixed version (ground truth):
public boolean marshalSingleValue(XPathFragment xPathFragment,MarshalRecord marshalRecord,Object object,Object targetObject,AbstractSession session,NamespaceResolver namespaceResolver,MarshalContext marshalContext){
  Object fieldValue=xmlObjectReferenceMapping.buildFieldValue(targetObject,xmlField,session);
  if (fieldValue == null) {
    if (null != targetObject) {
      XMLField fkField=(XMLField)xmlObjectReferenceMapping.getSourceToTargetKeyFieldAssociations().get(xmlField);
      fieldValue=marshalRecord.getMarshaller().getXMLContext().getValueByXPath(targetObject,fkField.getXPath(),fkField.getNamespaceResolver(),Object.class);
    }
    if (null == fieldValue) {
      return false;
    }
  }
  QName schemaType=getSchemaType(xmlField,fieldValue,session);
  String stringValue=getValueToWrite(schemaType,fieldValue,(XMLConversionManager)session.getDatasourcePlatform().getConversionManager(),namespaceResolver);
  XPathFragment groupingFragment=marshalRecord.openStartGroupingElements(namespaceResolver);
  if (xPathFragment.isAttribute()) {
    marshalRecord.attribute(xPathFragment,namespaceResolver,stringValue);
    marshalRecord.closeStartGroupingElements(groupingFragment);
  }
 else {
    marshalRecord.closeStartGroupingElements(groupingFragment);
    marshalRecord.characters(stringValue);
  }
  return true;
}
Program: 66847
Project: 66847
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  this.addPositionalNodes(xPathFragment,namespaceResolver);
  try {
    if (isStartElementOpen) {
      getOutputStream().write(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        getOutputStream().write(CR);
      }
      for (int x=0; x < numberOfTabs; x++) {
        getOutputStream().write(TAB);
      }
    }
    isStartElementOpen=true;
    getOutputStream().write(OPEN_START_ELEMENT);
    getOutputStream().write(xPathFragment.getShortNameBytes());
    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) {
      outputStream.write(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      if (numberOfTabs > 0) {
        outputStream.write(CR);
      }
      for (int x=0; x < numberOfTabs; x++) {
        outputStream.write(TAB);
      }
    }
    isStartElementOpen=true;
    outputStream.write(OPEN_START_ELEMENT);
    outputStream.write(xPathFragment.getShortNameBytes());
    numberOfTabs++;
    isLastEventText=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66848
Project: 66848
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    isLastEventText=false;
    numberOfTabs--;
    if (isStartElementOpen) {
      getOutputStream().write(CLOSE_EMPTY_ELEMENT);
      isStartElementOpen=false;
      complexType=true;
      return;
    }
    if (complexType) {
      getOutputStream().write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        getOutputStream().write(TAB);
      }
    }
 else {
      complexType=true;
    }
    super.endElement(namespaceURI,localName,qName);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    isLastEventText=false;
    numberOfTabs--;
    if (isStartElementOpen) {
      outputStream.write(CLOSE_EMPTY_ELEMENT);
      isStartElementOpen=false;
      complexType=true;
      return;
    }
    if (complexType) {
      outputStream.write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        outputStream.write(TAB);
      }
    }
 else {
      complexType=true;
    }
    super.endElement(namespaceURI,localName,qName);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66849
Project: 66849
Buggy source:
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  try {
    if (isStartElementOpen) {
      getOutputStream().write(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      getOutputStream().write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        getOutputStream().write(TAB);
      }
    }
    getOutputStream().write(OPEN_START_ELEMENT);
    getOutputStream().write(qName.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      outputStream.write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        outputStream.write(TAB);
      }
    }
    outputStream.write(OPEN_START_ELEMENT);
    outputStream.write(qName.getBytes(XMLConstants.DEFAULT_XML_ENCODING));
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66850
Project: 66850
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      getOutputStream().write(CLOSE_ELEMENT);
      getOutputStream().write(CR);
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
    complexType=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      outputStream.write(CR);
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
    complexType=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66851
Project: 66851
Buggy source:
/** 
 * INTERNAL:
 */
public void endDocument(){
  try {
    getOutputStream().write(CR);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endDocument(){
  try {
    outputStream.write(CR);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66852
Project: 66852
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  try {
    isLastEventText=false;
    if (isStartElementOpen) {
      getOutputStream().write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    getOutputStream().write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      getOutputStream().write(TAB);
    }
    super.element(frag);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  try {
    isLastEventText=false;
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    outputStream.write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      outputStream.write(TAB);
    }
    super.element(frag);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 66853
Project: 66853
Buggy source:
/** 
 * INTERNAL:
 */
public void cdata(String value){
  try {
    if (isStartElementOpen) {
      getOutputStream().write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    getOutputStream().write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      getOutputStream().write(TAB);
    }
    super.cdata(value);
    complexType=true;
  }
 catch (  IOException ex) {
    throw XMLMarshalException.marshalException(ex);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void cdata(String value){
  try {
    if (isStartElementOpen) {
      outputStream.write(CLOSE_ELEMENT);
      isStartElementOpen=false;
    }
    outputStream.write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      outputStream.write(TAB);
    }
    super.cdata(value);
    complexType=true;
  }
 catch (  IOException ex) {
    throw XMLMarshalException.marshalException(ex);
  }
}