nus-yam/ex-repair huggingface dataset:
Program: 63746
Project: 63746
Buggy source:
@Override protected void setupSession(DatabaseSession session){
  session.login();
  setupDocumentPreservationPolicy(session);
}

Fixed version (ground truth):
@Override protected void setupSession(DatabaseSession session){
  session.setLogLevel(SessionLog.OFF);
  session.login();
  setupDocumentPreservationPolicy(session);
}
Program: 63747
Project: 63747
Buggy source:
/** 
 * INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.
 * @param record
 * @param object
 * @param field
 * @return true if this method caused any objects to be marshaled, else false.
 */
public boolean compositeObjectMarshal(AbstractMarshalRecord record,Object object,Field field,CoreAbstractSession session){
  if (marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL) {
    record.put(field,XMLRecord.NIL);
    return true;
  }
 else {
    if (marshalNullRepresentation == XMLNullRepresentationType.EMPTY_NODE) {
      Node element=XPathEngine.getInstance().createUnownedElement(record.getDOM(),field);
      DOMRecord nestedRow=new DOMRecord(element);
      record.put(field,nestedRow);
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: When using the DOM Platform, this method is responsible for marshalling null values for the XML Composite Object Mapping.
 * @param record
 * @param object
 * @param field
 * @return true if this method caused any objects to be marshaled, else false.
 */
public boolean compositeObjectMarshal(AbstractMarshalRecord record,Object object,Field field,CoreAbstractSession session){
  if (marshalNullRepresentation == XMLNullRepresentationType.XSI_NIL) {
    record.put(field,XMLRecord.NIL);
    return true;
  }
 else {
    if (marshalNullRepresentation == XMLNullRepresentationType.EMPTY_NODE) {
      Node element=XPathEngine.getInstance().createUnownedElement(record.getDOM(),field);
      record.put(field,element);
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 63748
Project: 63748
Buggy source:
/** 
 * INTERNAL
 */
public void writeHeader(){
  outputStreamWrite(getMarshaller().getXmlHeader().getBytes());
  outputStreamWrite(CR);
}

Fixed version (ground truth):
/** 
 * INTERNAL
 */
public void writeHeader(){
  outputStreamWrite(getMarshaller().getXmlHeader().getBytes());
  outputStreamWrite(cr);
}
Program: 63749
Project: 63749
Buggy source:
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  try {
    if (isStartElementOpen) {
      outputStreamWrite(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      outputStreamWrite(CR);
      outputStreamWriteTab();
    }
    outputStreamWrite(OPEN_START_ELEMENT);
    outputStreamWrite(qName.getBytes(Constants.DEFAULT_XML_ENCODING));
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  UnsupportedEncodingException 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) {
      outputStreamWrite(CLOSE_ELEMENT);
    }
    if (!isLastEventText) {
      outputStreamWrite(cr);
      outputStreamWriteTab();
    }
    outputStreamWrite(OPEN_START_ELEMENT);
    outputStreamWrite(qName.getBytes(Constants.DEFAULT_XML_ENCODING));
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  UnsupportedEncodingException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63750
Project: 63750
Buggy source:
/** 
 * INTERNAL:
 */
public void endDocument(){
  outputStreamWrite(CR);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endDocument(){
  outputStreamWrite(cr);
}
Program: 63751
Project: 63751
Buggy source:
/** 
 * INTERNAL:
 */
public void startDocument(String encoding,String version){
  super.startDocument(encoding,version);
  outputStreamWrite(CR);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void startDocument(String encoding,String version){
  super.startDocument(encoding,version);
  outputStreamWrite(cr);
}
Program: 63752
Project: 63752
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);
  byte[] prefixBytes=getPrefixBytes(xPathFragment);
  if (null != prefixBytes) {
    outputStreamWrite(prefixBytes);
    outputStreamWrite((byte)':');
  }
  outputStreamWrite(xPathFragment.getLocalNameBytes());
  if (xPathFragment.isGeneratedPrefix()) {
    namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
  }
  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);
  byte[] prefixBytes=getPrefixBytes(xPathFragment);
  if (null != prefixBytes) {
    outputStreamWrite(prefixBytes);
    outputStreamWrite((byte)':');
  }
  outputStreamWrite(xPathFragment.getLocalNameBytes());
  if (xPathFragment.isGeneratedPrefix()) {
    namespaceDeclaration(xPathFragment.getPrefix(),xPathFragment.getNamespaceURI());
  }
  numberOfTabs++;
  isLastEventText=false;
}
Program: 63753
Project: 63753
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  isLastEventText=false;
  numberOfTabs--;
  if (isStartElementOpen) {
    outputStreamWrite((byte)'/');
    outputStreamWrite((byte)'>');
    isStartElementOpen=false;
    complexType=true;
    return;
  }
  if (complexType) {
    outputStreamWrite(CR);
    outputStreamWriteTab();
  }
 else {
    complexType=true;
  }
  super.endElement(namespaceURI,localName,qName);
}

Fixed version (ground truth):
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  isLastEventText=false;
  numberOfTabs--;
  if (isStartElementOpen) {
    outputStreamWrite((byte)'/');
    outputStreamWrite((byte)'>');
    isStartElementOpen=false;
    complexType=true;
    return;
  }
  if (complexType) {
    outputStreamWrite(cr);
    outputStreamWriteTab();
  }
 else {
    complexType=true;
  }
  super.endElement(namespaceURI,localName,qName);
}
Program: 63754
Project: 63754
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    outputStreamWrite(CR);
    isStartElementOpen=false;
  }
  writeComment(ch,start,length);
  complexType=false;
}

Fixed version (ground truth):
public void comment(char[] ch,int start,int length) throws SAXException {
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    outputStreamWrite(cr);
    isStartElementOpen=false;
  }
  writeComment(ch,start,length);
  complexType=false;
}
Program: 63755
Project: 63755
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  isLastEventText=false;
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    isStartElementOpen=false;
  }
  outputStreamWrite(CR);
  outputStreamWriteTab();
  super.element(frag);
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  isLastEventText=false;
  if (isStartElementOpen) {
    outputStreamWrite(CLOSE_ELEMENT);
    isStartElementOpen=false;
  }
  outputStreamWrite(cr);
  outputStreamWriteTab();
  super.element(frag);
}
Program: 63756
Project: 63756
Buggy source:
/** 
 * INTERNAL
 */
public void writeHeader(){
  try {
    writer.write(getMarshaller().getXmlHeader());
    writer.write(CR);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL
 */
public void writeHeader(){
  try {
    writer.write(getMarshaller().getXmlHeader());
    writer.write(cr);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63757
Project: 63757
Buggy source:
public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException {
  try {
    if (isStartElementOpen) {
      writer.write('>');
    }
    if (!isLastEventText) {
      writer.write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(tab());
      }
    }
    writer.write('<');
    writer.write(qName);
    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) {
      writer.write('>');
    }
    if (!isLastEventText) {
      writer.write(cr);
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(tab());
      }
    }
    writer.write('<');
    writer.write(qName);
    numberOfTabs++;
    isStartElementOpen=true;
    isLastEventText=false;
    handleAttributes(atts);
    writePrefixMappings();
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63758
Project: 63758
Buggy source:
public void startDocument(String encoding,String version){
  super.startDocument(encoding,version);
  try {
    writer.write(CR);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
public void startDocument(String encoding,String version){
  super.startDocument(encoding,version);
  try {
    writer.write(cr);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63759
Project: 63759
Buggy source:
/** 
 * INTERNAL:
 */
public void endDocument(){
  try {
    writer.write(CR);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void endDocument(){
  try {
    writer.write(cr);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63760
Project: 63760
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(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);
  }
}

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(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: 63761
Project: 63761
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  try {
    isLastEventText=false;
    numberOfTabs--;
    if (isStartElementOpen) {
      writer.write('/');
      writer.write('>');
      isStartElementOpen=false;
      complexType=true;
      return;
    }
    if (complexType) {
      writer.write(CR);
      for (int x=0; x < numberOfTabs; x++) {
        writer.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) {
      writer.write('/');
      writer.write('>');
      isStartElementOpen=false;
      complexType=true;
      return;
    }
    if (complexType) {
      writer.write(cr);
      for (int x=0; x < numberOfTabs; x++) {
        writer.write(tab());
      }
    }
 else {
      complexType=true;
    }
    super.endElement(namespaceURI,localName,qName);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63762
Project: 63762
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      writer.write('>');
      writer.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) {
      writer.write('>');
      writer.write(cr);
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
    complexType=false;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63763
Project: 63763
Buggy source:
/** 
 * INTERNAL:
 */
public void element(XPathFragment frag){
  try {
    isLastEventText=false;
    if (isStartElementOpen) {
      writer.write('>');
      isStartElementOpen=false;
    }
    writer.write(CR);
    for (int x=0; x < numberOfTabs; x++) {
      writer.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) {
      writer.write('>');
      isStartElementOpen=false;
    }
    writer.write(Constants.cr());
    for (int x=0; x < numberOfTabs; x++) {
      writer.write(tab());
    }
    super.element(frag);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63764
Project: 63764
Buggy source:
public void writeCR() throws IOException {
  writer.write(FormattedWriterRecord.CR);
}

Fixed version (ground truth):
public void writeCR() throws IOException {
  writer.write(cr);
}
Program: 63765
Project: 63765
Buggy source:
public JsonObjectBuilderWriterRecord(JsonArrayBuilder jsonArrayBuilder){
  this();
  rootJsonArrayBuilder=jsonArrayBuilder;
}

Fixed version (ground truth):
public JsonObjectBuilderWriterRecord(JsonArrayBuilder jsonArrayBuilder){
  this();
  rootJsonArrayBuilder=jsonArrayBuilder;
  isRootArray=true;
}
Program: 63766
Project: 63766
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(WithoutXmlRootElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementSetTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementSetTestCases.class);
  suite.addTestSuite(WithXmlRootElementJAXBElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementJAXBElementNoRootTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementJAXBElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementJAXBElementSetTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementJAXBElementSetTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementArrayTestCases.class);
  suite.addTestSuite(WithXmlRootElementArrayTestCases.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(WithoutXmlRootElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementSetTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementSetTestCases.class);
  suite.addTestSuite(WithXmlRootElementJAXBElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementJAXBElementNoRootTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementJAXBElementTestCases.class);
  suite.addTestSuite(WithXmlRootElementJAXBElementSetTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementJAXBElementSetTestCases.class);
  suite.addTestSuite(WithoutXmlRootElementArrayTestCases.class);
  suite.addTestSuite(WithXmlRootElementArrayTestCases.class);
  suite.addTestSuite(JsonObjectInArrayBuilderTestCases.class);
  return suite;
}
Program: 63767
Project: 63767
Buggy source:
/** 
 * Return the <i>JAXBContext</i> that corresponds to the domain class.  This method does the following: <ol> <li>If an EclipseLink JAXB (MOXy) <i>JAXBContext</i> is available from a <i>ContextResolver</i> then use it.</li> <li>If an existing <i>JAXBContext</i> was not found in step one, then  create a new one on the domain class.</li> </ol>
 * @param domainClass - The domain class we need a <i>JAXBContext</i> for.
 * @param annotations - The annotations corresponding to domain object.
 * @param mediaType - The media type for the HTTP entity.
 * @param httpHeaders - HTTP headers associated with HTTP entity.
 * @return
 * @throws JAXBException
 */
protected JAXBContext getJAXBContext(Class<?> domainClass,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,?> httpHeaders) throws JAXBException {
  JAXBContext jaxbContext=contextCache.get(domainClass);
  if (null != jaxbContext) {
    return jaxbContext;
  }
  ContextResolver<JAXBContext> resolver=null;
  if (null != providers) {
    resolver=providers.getContextResolver(JAXBContext.class,mediaType);
  }
  if (null == resolver || null == (jaxbContext=resolver.getContext(domainClass))) {
    jaxbContext=JAXBContextFactory.createContext(new Class[]{domainClass},null);
    contextCache.put(domainClass,jaxbContext);
    return jaxbContext;
  }
 else   if (jaxbContext instanceof org.eclipse.persistence.jaxb.JAXBContext) {
    return jaxbContext;
  }
 else {
    jaxbContext=JAXBContextFactory.createContext(new Class[]{domainClass},null);
    contextCache.put(domainClass,jaxbContext);
    return jaxbContext;
  }
}

Fixed version (ground truth):
private JAXBContext getJAXBContext(Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType){
  if (null == genericType) {
    genericType=type;
  }
  try {
    Class<?> domainClass=getDomainClass(genericType);
    return getJAXBContext(domainClass,annotations,mediaType,null);
  }
 catch (  JAXBException e) {
    return null;
  }
}
Program: 63769
Project: 63769
Buggy source:
/** 
 * @return true indicating that <i>MOXyJsonProvider</i> willbe used for the JSON binding if the media type is of the following  patterns *&#47;json or *&#47;*+json, and the type is not assignable from  any of (or a Collection or JAXBElement of) the following: <ul> <li>byte[]</li> <li>java.io.File</li> <li>java.io.InputStream</li> <li>java.io.Reader</li> <li>java.lang.Object</li> <li>java.lang.String</li> <li>javax.activation.DataSource</li> </ul>
 */
public boolean isReadable(Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType){
  if (!supportsMediaType(mediaType)) {
    return false;
  }
 else   if (CoreClassConstants.APBYTE == type || CoreClassConstants.STRING == type) {
    return false;
  }
 else   if (File.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (DataSource.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (InputStream.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (Reader.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (Object.class == type) {
    return false;
  }
 else   if (JAXBElement.class.isAssignableFrom(type)) {
    Class domainClass=getDomainClass(genericType);
    return isReadable(domainClass,null,annotations,mediaType) || String.class == domainClass;
  }
 else   if (Collection.class.isAssignableFrom(type)) {
    Class domainClass=getDomainClass(genericType);
    return isReadable(domainClass,null,annotations,mediaType) || String.class == domainClass;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * @return true indicating that <i>MOXyJsonProvider</i> willbe used for the JSON binding if the media type is of the following  patterns *&#47;json or *&#47;*+json, and the type is not assignable from  any of (or a Collection or JAXBElement of) the following: <ul> <li>byte[]</li> <li>java.io.File</li> <li>java.io.InputStream</li> <li>java.io.Reader</li> <li>java.lang.Object</li> <li>java.lang.String</li> <li>javax.activation.DataSource</li> </ul>
 */
public boolean isReadable(Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType){
  if (!supportsMediaType(mediaType)) {
    return false;
  }
 else   if (CoreClassConstants.APBYTE == type || CoreClassConstants.STRING == type) {
    return false;
  }
 else   if (File.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (DataSource.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (InputStream.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (Reader.class.isAssignableFrom(type)) {
    return false;
  }
 else   if (Object.class == type) {
    return false;
  }
 else   if (JAXBElement.class.isAssignableFrom(type)) {
    Class domainClass=getDomainClass(genericType);
    return isReadable(domainClass,null,annotations,mediaType) || String.class == domainClass;
  }
 else   if (Collection.class.isAssignableFrom(type)) {
    Class domainClass=getDomainClass(genericType);
    return isReadable(domainClass,null,annotations,mediaType) || String.class == domainClass;
  }
 else {
    return null != getJAXBContext(type,genericType,annotations,mediaType);
  }
}
Program: 63770
Project: 63770
Buggy source:
public void setComplex(boolean isComplex){
  this.isComplex=isComplex;
  if (isComplex && jsonObjectBuilder == null) {
    jsonObjectBuilder=Json.createObjectBuilder();
  }
}

Fixed version (ground truth):
private void setComplex(Level level,boolean complex){
  boolean isAlreadyComplex=level.isComplex;
  level.setComplex(complex);
  if (complex && !isAlreadyComplex) {
    if (complex && level.jsonObjectBuilder == null) {
      level.jsonObjectBuilder=Json.createObjectBuilder();
    }
  }
}
Program: 63771
Project: 63771
Buggy source:
@Override public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (position != null) {
    Level newLevel=new Level(false,position);
    if (isLastEventStart) {
      position.setComplex(true);
    }
    String keyName=getKeyName(xPathFragment);
    if (position.isCollection && position.isEmptyCollection()) {
      position.setKeyName(keyName);
    }
 else {
      newLevel.setKeyName(keyName);
    }
    position=newLevel;
    isLastEventStart=true;
  }
}

Fixed version (ground truth):
@Override public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  super.openStartElement(xPathFragment,namespaceResolver);
  if (position != null) {
    Level newLevel=new Level(false,position);
    if (isLastEventStart) {
      setComplex(position,true);
    }
    String keyName=getKeyName(xPathFragment);
    if (position.isCollection && position.isEmptyCollection()) {
      position.setKeyName(keyName);
    }
 else {
      newLevel.setKeyName(keyName);
    }
    position=newLevel;
    isLastEventStart=true;
  }
}
Program: 63772
Project: 63772
Buggy source:
public void endDocument() throws SAXException {
}

Fixed version (ground truth):
@Override public void endDocument(){
  if (position != null) {
    if (position.parentLevel != null && position.parentLevel.isCollection) {
      popAndSetInParentBuilder();
    }
 else {
      position=(Level)position.parentLevel;
    }
  }
}
Program: 63773
Project: 63773
Buggy source:
/** 
 * Handle marshal of an empty collection.  
 * @param xPathFragment
 * @param namespaceResolver
 * @param openGrouping if grouping elements should be marshalled for empty collections
 * @return
 */
public boolean emptyCollection(XPathFragment xPathFragment,NamespaceResolver namespaceResolver,boolean openGrouping){
  if (marshaller.isMarshalEmptyCollections()) {
    super.emptyCollection(xPathFragment,namespaceResolver,true);
    if (null != xPathFragment) {
      if (xPathFragment.isSelfFragment() || xPathFragment.nameIsText()) {
        String keyName=position.getKeyName();
        position.setComplex(false);
        position.parentLevel.getJsonObjectBuilder().add(keyName,Json.createArrayBuilder());
      }
 else {
        if (isLastEventStart) {
          position.setComplex(true);
        }
        String keyName=getKeyName(xPathFragment);
        if (keyName != null) {
          position.getJsonObjectBuilder().add(keyName,Json.createArrayBuilder());
        }
      }
      isLastEventStart=false;
    }
    return true;
  }
 else {
    return super.emptyCollection(xPathFragment,namespaceResolver,openGrouping);
  }
}

Fixed version (ground truth):
/** 
 * Handle marshal of an empty collection.  
 * @param xPathFragment
 * @param namespaceResolver
 * @param openGrouping if grouping elements should be marshalled for empty collections
 * @return
 */
public boolean emptyCollection(XPathFragment xPathFragment,NamespaceResolver namespaceResolver,boolean openGrouping){
  if (marshaller.isMarshalEmptyCollections()) {
    super.emptyCollection(xPathFragment,namespaceResolver,true);
    if (null != xPathFragment) {
      if (xPathFragment.isSelfFragment() || xPathFragment.nameIsText()) {
        String keyName=position.getKeyName();
        setComplex(position,false);
        ((Level)position.parentLevel).getJsonObjectBuilder().add(keyName,Json.createArrayBuilder());
      }
 else {
        if (isLastEventStart) {
          setComplex(position,true);
        }
        String keyName=getKeyName(xPathFragment);
        if (keyName != null) {
          position.getJsonObjectBuilder().add(keyName,Json.createArrayBuilder());
        }
      }
      isLastEventStart=false;
    }
    return true;
  }
 else {
    return super.emptyCollection(xPathFragment,namespaceResolver,openGrouping);
  }
}
Program: 63774
Project: 63774
Buggy source:
public Level(boolean isCollection,Level parentLevel){
  setCollection(isCollection);
  emptyCollection=true;
  this.parentLevel=parentLevel;
}

Fixed version (ground truth):
public Level(boolean isCollection,Level parentLevel){
  super(isCollection,parentLevel);
}
Program: 63775
Project: 63775
Buggy source:
public void setCollection(boolean isCollection){
  this.isCollection=isCollection;
  if (isCollection && jsonArrayBuilder == null) {
    jsonArrayBuilder=Json.createArrayBuilder();
  }
}

Fixed version (ground truth):
public void setCollection(boolean isCollection){
  super.setCollection(isCollection);
  if (isCollection && jsonArrayBuilder == null) {
    jsonArrayBuilder=Json.createArrayBuilder();
  }
}
Program: 63776
Project: 63776
Buggy source:
public void endElement(String namespaceURI,String localName,String qName) throws SAXException {
  XPathFragment xPathFragment=new XPathFragment(localName);
  xPathFragment.setNamespaceURI(namespaceURI);
  JsonBuilderRecord.this.endElement(xPathFragment,namespaceResolver);
}

Fixed version (ground truth):
@Override public void endElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  if (position != null) {
    if (isLastEventStart) {
      setComplex(position,true);
    }
    if (position.isComplex) {
      popAndSetInParentBuilder();
    }
 else {
      position=(Level)position.parentLevel;
    }
    isLastEventStart=false;
  }
}
Program: 63777
Project: 63777
Buggy source:
public void startCollection(){
  if (position == null) {
    isRootArray=true;
    Level rootLevel=new Level(true,null);
    if (rootJsonArrayBuilder == null) {
      rootJsonArrayBuilder=Json.createArrayBuilder();
    }
    rootLevel.setJsonArrayBuilder(rootJsonArrayBuilder);
    position=rootLevel;
  }
 else {
    if (isLastEventStart) {
      position.setComplex(true);
    }
    Level level=new Level(true,position);
    position=level;
  }
  isLastEventStart=false;
}

Fixed version (ground truth):
public void startCollection(){
  if (position == null) {
    isRootArray=true;
    Level rootLevel=new Level(true,null);
    if (rootJsonArrayBuilder == null) {
      rootJsonArrayBuilder=Json.createArrayBuilder();
    }
    rootLevel.setJsonArrayBuilder(rootJsonArrayBuilder);
    position=rootLevel;
  }
 else {
    if (isLastEventStart) {
      setComplex(position,true);
    }
    Level level=new Level(true,position);
    position=level;
  }
  isLastEventStart=false;
}
Program: 63778
Project: 63778
Buggy source:
public void writeValue(Object value,QName schemaType,boolean isAttribute){
  if (characterEscapeHandler != null && value instanceof String) {
    try {
      StringWriter stringWriter=new StringWriter();
      characterEscapeHandler.escape(((String)value).toCharArray(),0,((String)value).length(),isAttribute,stringWriter);
      value=stringWriter.toString();
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
  }
  boolean textWrapperOpened=false;
  if (!isLastEventStart) {
    openStartElement(textWrapperFragment,namespaceResolver);
    textWrapperOpened=true;
  }
  Level currentLevel=position;
  String keyName=position.getKeyName();
  if (!position.isComplex) {
    currentLevel=position.parentLevel;
    currentLevel.setComplex(true);
  }
  if (currentLevel.isCollection()) {
    currentLevel.setEmptyCollection(false);
    addValueToArrayBuilder(currentLevel.getJsonArrayBuilder(),value,schemaType);
  }
 else {
    JsonObjectBuilder builder=currentLevel.getJsonObjectBuilder();
    addValueToObjectBuilder(builder,keyName,value,schemaType);
  }
  isLastEventStart=false;
  if (textWrapperOpened) {
    endElement(textWrapperFragment,namespaceResolver);
  }
}

Fixed version (ground truth):
public void writeValue(Object value,QName schemaType,boolean isAttribute){
  if (characterEscapeHandler != null && value instanceof String) {
    try {
      StringWriter stringWriter=new StringWriter();
      characterEscapeHandler.escape(((String)value).toCharArray(),0,((String)value).length(),isAttribute,stringWriter);
      value=stringWriter.toString();
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
  }
  boolean textWrapperOpened=false;
  if (!isLastEventStart) {
    openStartElement(textWrapperFragment,namespaceResolver);
    textWrapperOpened=true;
  }
  Level currentLevel=position;
  String keyName=position.getKeyName();
  if (!position.isComplex) {
    currentLevel=(Level)position.parentLevel;
  }
  addValue(currentLevel,keyName,value,schemaType);
  isLastEventStart=false;
  if (textWrapperOpened) {
    endElement(textWrapperFragment,namespaceResolver);
  }
}
Program: 63779
Project: 63779
Buggy source:
public void startDocument() throws SAXException {
}

Fixed version (ground truth):
@Override public void startDocument(String encoding,String version){
  if (isRootArray) {
    if (position == null) {
      startCollection();
    }
    position.setEmptyCollection(false);
    Level newLevel=new Level(false,position);
    position=newLevel;
    isLastEventStart=true;
  }
 else {
    Level rootLevel=new Level(false,null);
    position=rootLevel;
    if (rootJsonObjectBuilder == null) {
      rootJsonObjectBuilder=Json.createObjectBuilder();
    }
    rootLevel.setJsonObjectBuilder(rootJsonObjectBuilder);
  }
}
Program: 63780
Project: 63780
Buggy source:
private void popAndSetInParentBuilder(){
  Level removedLevel=position;
  Level parentLevel=position.parentLevel;
  position=position.parentLevel;
  if (removedLevel.isCollection && removedLevel.isEmptyCollection() && removedLevel.keyName == null) {
    return;
  }
  if (parentLevel != null) {
    if (parentLevel.isCollection) {
      if (removedLevel.isCollection) {
        parentLevel.getJsonArrayBuilder().add(removedLevel.getJsonArrayBuilder());
      }
 else {
        parentLevel.getJsonArrayBuilder().add(removedLevel.getJsonObjectBuilder());
      }
    }
 else {
      if (removedLevel.isCollection) {
        parentLevel.getJsonObjectBuilder().add(removedLevel.getKeyName(),removedLevel.getJsonArrayBuilder());
      }
 else {
        parentLevel.getJsonObjectBuilder().add(removedLevel.getKeyName(),removedLevel.getJsonObjectBuilder());
      }
    }
  }
}

Fixed version (ground truth):
private void popAndSetInParentBuilder(){
  Level removedLevel=position;
  Level parentLevel=(Level)position.parentLevel;
  position=(Level)position.parentLevel;
  if (removedLevel.isCollection && removedLevel.isEmptyCollection() && removedLevel.keyName == null) {
    return;
  }
  if (parentLevel != null) {
    if (parentLevel.isCollection) {
      if (removedLevel.isCollection) {
        parentLevel.getJsonArrayBuilder().add(removedLevel.getJsonArrayBuilder());
      }
 else {
        parentLevel.getJsonArrayBuilder().add(removedLevel.getJsonObjectBuilder());
      }
    }
 else {
      if (removedLevel.isCollection) {
        parentLevel.getJsonObjectBuilder().add(removedLevel.getKeyName(),removedLevel.getJsonArrayBuilder());
      }
 else {
        parentLevel.getJsonObjectBuilder().add(removedLevel.getKeyName(),removedLevel.getJsonObjectBuilder());
      }
    }
  }
}
Program: 63782
Project: 63782
Buggy source:
private void resetShortName(){
  shortName=null;
  shortNameBytes=null;
}

Fixed version (ground truth):
private void resetShortName(){
  shortName=null;
  prefixBytes=null;
  localNameBytes=null;
}
Program: 63783
Project: 63783
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  try {
    Level newLevel=null;
    Level position=null;
    if (null == level) {
      level=new Level(true,true,level);
      newLevel=level;
    }
 else {
      position=level;
      level=new Level(true,true,level);
      newLevel=level;
      if (position.isFirst()) {
        position.setFirst(false);
      }
 else {
        writer.write(',');
      }
    }
    if (xPathFragment.nameIsText()) {
      if (position != null && position.isCollection() && position.isEmptyCollection()) {
        writer.write('[');
        position.setEmptyCollection(false);
        position.setNeedToOpenComplex(false);
        charactersAllowed=true;
        return;
      }
    }
    if (position != null && position.needToOpenComplex) {
      writer.write('{');
      position.needToOpenComplex=false;
      position.needToCloseComplex=true;
    }
    if (!(position.isCollection() && !position.isEmptyCollection())) {
      writeKey(xPathFragment);
      if (position.isCollection() && position.isEmptyCollection()) {
        writer.write('[');
        position.setEmptyCollection(false);
      }
    }
    charactersAllowed=true;
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  try {
    if (level.isFirst()) {
      level.setFirst(false);
    }
 else {
      writer.write(',');
    }
    if (xPathFragment.nameIsText()) {
      if (level != null && level.isCollection() && level.isEmptyCollection()) {
        writer.write('[');
        level.setEmptyCollection(false);
        level.setNeedToOpenComplex(false);
        charactersAllowed=true;
        level=new Level(true,true,level);
        return;
      }
    }
    if (level.needToOpenComplex) {
      writer.write('{');
      level.needToOpenComplex=false;
      level.needToCloseComplex=true;
    }
    if (!(level.isCollection() && !level.isEmptyCollection())) {
      writeKey(xPathFragment);
      if (level.isCollection() && level.isEmptyCollection()) {
        writer.write('[');
        level.setEmptyCollection(false);
      }
    }
    charactersAllowed=true;
    level=new Level(true,true,level);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63784
Project: 63784
Buggy source:
protected void writeKey(XPathFragment xPathFragment) throws IOException {
  super.openStartElement(xPathFragment,namespaceResolver);
  isStartElementOpen=true;
  writer.write('"');
  if (xPathFragment.isAttribute() && attributePrefix != null) {
    writer.writeAttributePrefix();
  }
  if (isNamespaceAware()) {
    if (xPathFragment.getNamespaceURI() != null) {
      String prefix=null;
      if (getNamespaceResolver() != null) {
        prefix=getNamespaceResolver().resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
 else       if (namespaceResolver != null) {
        prefix=namespaceResolver.resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
      if (prefix != null && !prefix.equals(Constants.EMPTY_STRING)) {
        writer.write(prefix);
        writer.writeNamespaceSeparator();
      }
    }
  }
  writer.writeLocalName(xPathFragment);
  writer.write('"');
  writer.write(space);
  writer.write(Constants.COLON);
  writer.write(space);
}

Fixed version (ground truth):
protected void writeKey(XPathFragment xPathFragment) throws IOException {
  super.openStartElement(xPathFragment,namespaceResolver);
  isStartElementOpen=true;
  writer.write('"');
  if (xPathFragment.isAttribute() && attributePrefix != null) {
    writer.writeAttributePrefix();
  }
  if (isNamespaceAware()) {
    if (xPathFragment.getNamespaceURI() != null) {
      String prefix=null;
      if (getNamespaceResolver() != null) {
        prefix=getNamespaceResolver().resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
 else       if (namespaceResolver != null) {
        prefix=namespaceResolver.resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
      if (prefix != null && !prefix.equals(Constants.EMPTY_STRING)) {
        writer.write(prefix);
        writer.writeNamespaceSeparator();
      }
    }
  }
  writer.writeLocalName(xPathFragment);
  writer.write('"');
  writeSpace();
  writer.write(Constants.COLON);
  writeSpace();
}
Program: 63786
Project: 63786
Buggy source:
/** 
 * INTERNAL:
 */
public void characters(String value){
  super.characters(value);
  isLastEventText=true;
  complexType=false;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void characters(String value){
  super.characters(value);
  isLastEventText=true;
}
Program: 63787
Project: 63787
Buggy source:
public void comment(char[] ch,int start,int length) throws SAXException {
  try {
    if (isStartElementOpen) {
      writer.write('>');
      writer.writeCR();
      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) {
      writer.write('>');
      writer.writeCR();
      isStartElementOpen=false;
    }
    writeComment(ch,start,length);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63788
Project: 63788
Buggy source:
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  try {
    if (level.isFirst()) {
      level.setFirst(false);
    }
 else {
      writer.write(',');
    }
    if (xPathFragment.nameIsText()) {
      if (level != null && level.isCollection() && level.isEmptyCollection()) {
        writer.write('[');
        level.setEmptyCollection(false);
        level.setNeedToOpenComplex(false);
        charactersAllowed=true;
        level=new Level(true,true,level);
        return;
      }
    }
    if (level.needToOpenComplex) {
      writer.write('{');
      level.needToOpenComplex=false;
      level.needToCloseComplex=true;
    }
    if (!(level.isCollection() && !level.isEmptyCollection())) {
      writeKey(xPathFragment);
      if (level.isCollection() && level.isEmptyCollection()) {
        writer.write('[');
        level.setEmptyCollection(false);
      }
    }
    charactersAllowed=true;
    level=new Level(true,true,level);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public void openStartElement(XPathFragment xPathFragment,NamespaceResolver namespaceResolver){
  try {
    if (level.isFirst()) {
      level.setFirst(false);
    }
 else {
      writer.write(',');
    }
    if (xPathFragment.nameIsText()) {
      if (level.isCollection() && level.isEmptyCollection()) {
        writer.write('[');
        level.setEmptyCollection(false);
        level.setNeedToOpenComplex(false);
        charactersAllowed=true;
        level=new Level(true,true,level);
        return;
      }
    }
    if (level.needToOpenComplex) {
      writer.write('{');
      level.needToOpenComplex=false;
      level.needToCloseComplex=true;
    }
    if (!(level.isCollection() && !level.isEmptyCollection())) {
      writeKey(xPathFragment);
      if (level.isCollection() && level.isEmptyCollection()) {
        writer.write('[');
        level.setEmptyCollection(false);
      }
    }
    charactersAllowed=true;
    level=new Level(true,true,level);
  }
 catch (  IOException e) {
    throw XMLMarshalException.marshalException(e);
  }
}
Program: 63789
Project: 63789
Buggy source:
protected void writeKey(XPathFragment xPathFragment) throws IOException {
  super.openStartElement(xPathFragment,namespaceResolver);
  isStartElementOpen=true;
  writer.write('"');
  if (xPathFragment.isAttribute() && attributePrefix != null) {
    writer.writeAttributePrefix();
  }
  if (isNamespaceAware()) {
    if (xPathFragment.getNamespaceURI() != null) {
      String prefix=null;
      if (getNamespaceResolver() != null) {
        prefix=getNamespaceResolver().resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
 else       if (namespaceResolver != null) {
        prefix=namespaceResolver.resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
      if (prefix != null && !prefix.equals(Constants.EMPTY_STRING)) {
        writer.write(prefix);
        writer.writeNamespaceSeparator();
      }
    }
  }
  writer.writeLocalName(xPathFragment);
  writer.write('"');
  writeSpace();
  writer.write(Constants.COLON);
  writeSpace();
}

Fixed version (ground truth):
protected void writeKey(XPathFragment xPathFragment) throws IOException {
  super.openStartElement(xPathFragment,namespaceResolver);
  isStartElementOpen=true;
  writer.write('"');
  if (xPathFragment.isAttribute() && attributePrefix != null) {
    writer.writeAttributePrefix();
  }
  if (isNamespaceAware()) {
    if (xPathFragment.getNamespaceURI() != null) {
      String prefix=null;
      if (getNamespaceResolver() != null) {
        prefix=getNamespaceResolver().resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
 else       if (namespaceResolver != null) {
        prefix=namespaceResolver.resolveNamespaceURI(xPathFragment.getNamespaceURI());
      }
      if (prefix != null && !prefix.equals(Constants.EMPTY_STRING)) {
        writer.write(prefix);
        writer.writeNamespaceSeparator();
      }
    }
  }
  writer.writeLocalName(xPathFragment);
  writer.write('"');
  writeSeparator();
}
Program: 63791
Project: 63791
Buggy source:
public UnmarshalRecord getChildUnmarshalRecord(ObjectBuilder treeObjectBuilder){
  if (childRecord != null && !childRecord.isSelfRecord()) {
    childRecord.initialize(treeObjectBuilder);
    childRecord.setParentRecord(this);
    return childRecord;
  }
 else {
    childRecord=new UnmarshalRecordImpl(treeObjectBuilder);
    childRecord.setSession(session);
    childRecord.setUnmarshaller(unmarshaller);
    childRecord.setTextWrapperFragment(textWrapperFragment);
    childRecord.setXMLReader(this.xmlReader);
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(unmarshalNamespaceResolver);
    childRecord.setReferenceResolver(referenceResolver);
    childRecord.setParentRecord(this);
  }
  return childRecord;
}

Fixed version (ground truth):
public UnmarshalRecord getChildUnmarshalRecord(ObjectBuilder treeObjectBuilder){
  if (childRecord != null && !childRecord.isSelfRecord()) {
    childRecord.initialize(treeObjectBuilder);
    childRecord.setParentRecord(this);
    return childRecord;
  }
 else {
    childRecord=new UnmarshalRecordImpl(treeObjectBuilder,referenceResolver);
    childRecord.setSession(session);
    childRecord.setUnmarshaller(unmarshaller);
    childRecord.setTextWrapperFragment(textWrapperFragment);
    childRecord.setXMLReader(this.xmlReader);
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(unmarshalNamespaceResolver);
    childRecord.setParentRecord(this);
  }
  return childRecord;
}
Program: 63792
Project: 63792
Buggy source:
public UnmarshalRecordImpl(ObjectBuilder objectBuilder){
  super();
  this.xPathFragment=new XPathFragment();
  xPathFragment.setNamespaceAware(isNamespaceAware());
  this.setUnmarshalAttributeGroup(DEFAULT_ATTRIBUTE_GROUP);
  initialize(objectBuilder);
}

Fixed version (ground truth):
private UnmarshalRecordImpl(ObjectBuilder objectBuilder,ReferenceResolver referenceResolver){
  super();
  this.referenceResolver=referenceResolver;
  this.xPathFragment=new XPathFragment();
  xPathFragment.setNamespaceAware(isNamespaceAware());
  this.setUnmarshalAttributeGroup(DEFAULT_ATTRIBUTE_GROUP);
  initialize(objectBuilder);
}
Program: 63793
Project: 63793
Buggy source:
public void parse(XMLStreamReader xmlStreamReader) throws SAXException {
  this.xmlStreamReader=xmlStreamReader;
  unmarshalNamespaceContext.setXmlStreamReader(xmlStreamReader);
  indexedAttributeList.setXmlStreamReader(xmlStreamReader);
  try {
    contentHandler.startDocument();
    parseEvent(xmlStreamReader,xmlStreamReader.getEventType());
    while (depth > 0) {
      int eventType=xmlStreamReader.next();
      parseEvent(xmlStreamReader,eventType);
    }
    contentHandler.endDocument();
  }
 catch (  SAXException e) {
    throw e;
  }
catch (  Exception e) {
    throw new SAXException(e);
  }
}

Fixed version (ground truth):
public void parse(XMLStreamReader xmlStreamReader) throws SAXException {
  this.xmlStreamReader=xmlStreamReader;
  unmarshalNamespaceContext.setXmlStreamReader(xmlStreamReader);
  indexedAttributeList.setXmlStreamReader(xmlStreamReader);
  try {
    contentHandler.startDocument();
    parseEvent(xmlStreamReader,xmlStreamReader.getEventType());
    while (depth > 0) {
      int eventType=xmlStreamReader.next();
      parseEvent(xmlStreamReader,eventType);
    }
    if (xmlStreamReader.hasNext()) {
      xmlStreamReader.next();
    }
    contentHandler.endDocument();
  }
 catch (  SAXException e) {
    throw e;
  }
catch (  Exception e) {
    throw new SAXException(e);
  }
}