nus-yam/ex-repair huggingface dataset:
Program: 63703
Project: 63703
Buggy source:
public void testJSONMarshalToStringWriter_FORMATTED() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  getJSONMarshaller().setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
  StringWriter sw=new StringWriter();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),sw);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString(),getWriteControlJSONFormatted(),shouldRemoveWhitespaceFromControlDocJSON());
}

Fixed version (ground truth):
public void testJSONMarshalToStringWriter_FORMATTED() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  getJSONMarshaller().setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
  StringWriter sw=new StringWriter();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),sw);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString(),getWriteControlJSONFormatted(),shouldRemoveWhitespaceFromControlDocJSON());
}
Program: 63704
Project: 63704
Buggy source:
public void testJSONMarshalToGeneratorResult() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  StringWriter sw=new StringWriter();
  JsonGenerator generator=Json.createGenerator(sw);
  JsonGeneratorResult result=new JsonGeneratorResult(generator);
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),result);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  generator.flush();
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString());
}

Fixed version (ground truth):
public void testJSONMarshalToGeneratorResult() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  StringWriter sw=new StringWriter();
  JsonGenerator generator=Json.createGenerator(sw);
  JsonGeneratorResult result=new JsonGeneratorResult(generator);
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),result);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  generator.flush();
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString());
}
Program: 63705
Project: 63705
Buggy source:
public void testJSONMarshalToStringWriter() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  StringWriter sw=new StringWriter();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),sw);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString());
}

Fixed version (ground truth):
public void testJSONMarshalToStringWriter() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  StringWriter sw=new StringWriter();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),sw);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  log(sw.toString());
  compareStringToControlFile("String_Node_Str",sw.toString());
}
Program: 63706
Project: 63706
Buggy source:
public void testJSONMarshalToOutputStream_FORMATTED() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  getJSONMarshaller().setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
  ByteArrayOutputStream os=new ByteArrayOutputStream();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),os);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  compareStringToControlFile("String_Node_Str",new String(os.toByteArray()),getWriteControlJSONFormatted(),shouldRemoveWhitespaceFromControlDocJSON());
  os.close();
}

Fixed version (ground truth):
public void testJSONMarshalToOutputStream_FORMATTED() throws Exception {
  getJSONMarshaller().setProperty(MarshallerProperties.MEDIA_TYPE,"String_Node_Str");
  getJSONMarshaller().setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
  ByteArrayOutputStream os=new ByteArrayOutputStream();
  try {
    getJSONMarshaller().marshal(getWriteControlObject(),os);
  }
 catch (  Exception e) {
    assertMarshalException(e);
    return;
  }
  if (expectsMarshalException) {
    fail("String_Node_Str");
    return;
  }
  compareStringToControlFile("String_Node_Str",new String(os.toByteArray()),getWriteControlJSONFormatted(),shouldRemoveWhitespaceFromControlDocJSON());
  os.close();
}
Program: 63707
Project: 63707
Buggy source:
public ObjectWithTransientListTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{ObjectWithTransient.class});
}

Fixed version (ground truth):
public ObjectWithTransientListTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{ObjectWithTransient.class});
  expectsMarshalException=true;
}
Program: 63708
Project: 63708
Buggy source:
public ObjectWithTransientTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{ObjectWithTransient.class});
}

Fixed version (ground truth):
public ObjectWithTransientTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{ObjectWithTransient.class});
  expectsMarshalException=true;
}
Program: 63709
Project: 63709
Buggy source:
public JSONWithNullObjectTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{Simple.class});
  setControlJSON(JSON_RESOURCE);
  setControlDocument(XML_RESOURCE);
}

Fixed version (ground truth):
public JSONWithNullObjectTestCases(String name) throws Exception {
  super(name);
  setClasses(new Class[]{Simple.class});
  setControlJSON(JSON_RESOURCE);
  setControlDocument(XML_RESOURCE);
  expectsMarshalException=true;
}
Program: 63711
Project: 63711
Buggy source:
/** 
 * Test update relationship.
 * @throws RestCallFailedException the rest call failed exception
 * @throws URISyntaxException the uRI syntax exception
 */
@Test public void testUpdateRelationship() throws RestCallFailedException, URISyntaxException {
  StaticBid bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  StaticUser user=bid.getUser();
  StaticUser newUser=new StaticUser();
  newUser.setName("String_Node_Str");
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",newUser,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  assertTrue("String_Node_Str",bid.getUser().getName().equals("String_Node_Str"));
  newUser=bid.getUser();
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",user,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  assertTrue("String_Node_Str",bid.getUser().getName().equals(bid.getUser().getName()));
  dbDelete(newUser);
}

Fixed version (ground truth):
/** 
 * Test update relationship.
 * @throws RestCallFailedException the rest call failed exception
 * @throws URISyntaxException the uRI syntax exception
 */
@Test public void testUpdateRelationship() throws RestCallFailedException, URISyntaxException {
  StaticBid bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  StaticUser user=bid.getUser();
  StaticUser newUser=new StaticUser();
  newUser.setName("String_Node_Str");
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",newUser,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  assertTrue("String_Node_Str",bid.getUser().getName().equals("String_Node_Str"));
  newUser=bid.getUser();
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",user,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  StaticBid dbBid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  assertTrue("String_Node_Str",dbBid.getUser().getName().equals(bid.getUser().getName()));
  dbDelete(newUser);
}
Program: 63712
Project: 63712
Buggy source:
/** 
 * Test remove relationship non collection.
 * @throws RestCallFailedException the rest call failed exception
 * @throws URISyntaxException the uRI syntax exception
 * @throws JAXBException the jAXB exception
 */
@Test public void testRemoveRelationshipNonCollection() throws RestCallFailedException, URISyntaxException, JAXBException {
  StaticBid bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  StaticUser newUser=new StaticUser();
  newUser.setName("String_Node_Str");
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",newUser,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  assertTrue("String_Node_Str",bid.getUser().getName().equals("String_Node_Str"));
  String removedUser=RestUtils.restRemoveBidirectionalRelationship(context,String.valueOf(bid.getId()),StaticBid.class.getSimpleName(),"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,null,null);
  if (removedUser != null) {
    System.out.println(removedUser);
  }
  dbDelete(newUser);
}

Fixed version (ground truth):
/** 
 * Test remove relationship non collection.
 * @throws RestCallFailedException the rest call failed exception
 * @throws URISyntaxException the uRI syntax exception
 * @throws JAXBException the jAXB exception
 */
@Test public void testRemoveRelationshipNonCollection() throws RestCallFailedException, URISyntaxException, JAXBException {
  StaticBid bid=dbRead(StaticModelDatabasePopulator.BID1_ID,StaticBid.class);
  StaticUser origUser=bid.getUser();
  StaticUser newUser=new StaticUser();
  newUser.setName("String_Node_Str");
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",newUser,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  assertTrue("String_Node_Str",bid.getUser().getName().equals("String_Node_Str"));
  String userRemoved=RestUtils.restRemoveBidirectionalRelationship(context,String.valueOf(bid.getId()),StaticBid.class.getSimpleName(),"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,null,null);
  assertTrue(userRemoved != null);
  dbDelete(newUser);
  bid=restUpdateRelationship(String.valueOf(StaticModelDatabasePopulator.BID1_ID),"String_Node_Str","String_Node_Str",origUser,StaticBid.class,"String_Node_Str",MediaType.APPLICATION_JSON_TYPE,MediaType.APPLICATION_JSON_TYPE);
  assertTrue("String_Node_Str",bid.getUser().getName().equals("String_Node_Str"));
}
Program: 63715
Project: 63715
Buggy source:
/** 
 * INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) into part of some larger expression. You normally would not call this directly, instead calling twist See the comment there for more details"
 */
@Override public Expression twistedForBaseAndContext(Expression newBase,Expression context,Expression oldBase){
  return (Expression)this.clone();
}

Fixed version (ground truth):
/** 
 * INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) into part of some larger expression. You normally would not call this directly, instead calling twist See the comment there for more details"
 */
@Override public Expression twistedForBaseAndContext(Expression newBase,Expression context,Expression oldBase){
  return this;
}
Program: 63716
Project: 63716
Buggy source:
/** 
 * INTERNAL: Rebuild against the base, with the values of parameters supplied by the context expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) into part of some larger expression. You normally would not call this directly, instead calling twist, (see the comment there for more details).
 */
@Override public Expression twistedForBaseAndContext(Expression newBase,Expression context,Expression oldBase){
  if (isProperty()) {
    return context.getProperty(getField());
  }
 else {
    return context.getField(getField());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Rebuild against the base, with the values of parameters supplied by the context expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) into part of some larger expression. You normally would not call this directly, instead calling twist, (see the comment there for more details).
 */
@Override public Expression twistedForBaseAndContext(Expression newBase,Expression context,Expression oldBase){
  if (isProperty()) {
    return context.getProperty(getField());
  }
 else   if (newBase == oldBase) {
    return this;
  }
 else {
    return context.getField(getField());
  }
}
Program: 63717
Project: 63717
Buggy source:
private NodeList getNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,AbstractNullPolicy nullPolicy){
  if (xPathFragment.isAttribute()) {
    return selectAttributeNodes(contextNode,xPathFragment,xmlNamespaceResolver);
  }
 else   if (xPathFragment.nameIsText()) {
    return selectTextNodes(contextNode,nullPolicy);
  }
 else   if (xPathFragment.isSelfFragment()) {
    XMLNodeList xmlNodeList=new XMLNodeList(1);
    xmlNodeList.add(contextNode);
    return xmlNodeList;
  }
  if (xPathFragment.containsIndex()) {
    return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver,xPathFragment.getIndexValue());
  }
  return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver);
}

Fixed version (ground truth):
private NodeList getNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,AbstractNullPolicy nullPolicy,boolean concatText){
  if (xPathFragment.isAttribute()) {
    return selectAttributeNodes(contextNode,xPathFragment,xmlNamespaceResolver);
  }
 else   if (xPathFragment.nameIsText()) {
    return selectTextNodes(contextNode,nullPolicy,concatText);
  }
 else   if (xPathFragment.isSelfFragment()) {
    XMLNodeList xmlNodeList=new XMLNodeList(1);
    xmlNodeList.add(contextNode);
    return xmlNodeList;
  }
  if (xPathFragment.containsIndex()) {
    return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver,xPathFragment.getIndexValue());
  }
  return selectElementNodes(contextNode,xPathFragment,xmlNamespaceResolver);
}
Program: 63718
Project: 63718
Buggy source:
private NodeList selectTextNodes(Node contextNode,AbstractNullPolicy nullPolicy){
  Node n=selectSingleText(contextNode);
  XMLNodeList xmlNodeList=new XMLNodeList();
  if (n == null && nullPolicy != null) {
    if (nullPolicy.valueIsNull((Element)contextNode)) {
      if (nullPolicy.getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) {
        xmlNodeList.add(n);
      }
    }
 else {
      xmlNodeList.add(contextNode.getOwnerDocument().createTextNode(Constants.EMPTY_STRING));
    }
  }
 else {
    if (nullPolicy != null && nullPolicy.isNullRepresentedByXsiNil() && nullPolicy.valueIsNull((Element)contextNode)) {
      xmlNodeList.add(null);
    }
 else     if (n != null) {
      xmlNodeList.add(n);
    }
  }
  return xmlNodeList;
}

Fixed version (ground truth):
private NodeList selectTextNodes(Node contextNode,AbstractNullPolicy nullPolicy,boolean concatText){
  if (!concatText) {
    return selectAllText(contextNode);
  }
  Node n=selectSingleText(contextNode);
  XMLNodeList xmlNodeList=new XMLNodeList();
  if (n == null && nullPolicy != null) {
    if (nullPolicy.valueIsNull((Element)contextNode)) {
      if (nullPolicy.getMarshalNullRepresentation() != XMLNullRepresentationType.ABSENT_NODE) {
        xmlNodeList.add(n);
      }
    }
 else {
      xmlNodeList.add(contextNode.getOwnerDocument().createTextNode(Constants.EMPTY_STRING));
    }
  }
 else {
    if (nullPolicy != null && nullPolicy.isNullRepresentedByXsiNil() && nullPolicy.valueIsNull((Element)contextNode)) {
      xmlNodeList.add(null);
    }
 else     if (n != null) {
      xmlNodeList.add(n);
    }
  }
  return xmlNodeList;
}
Program: 63719
Project: 63719
Buggy source:
private NodeList selectNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,AbstractNullPolicy nullPolicy,boolean omitText){
  NodeList resultNodes=getNodes(contextNode,xPathFragment,xmlNamespaceResolver,nullPolicy);
  if (xPathFragment.getNextFragment() != null && !(omitText && xPathFragment.getNextFragment().nameIsText())) {
    Node resultNode;
    XMLNodeList result=new XMLNodeList();
    int numberOfResultNodes=resultNodes.getLength();
    for (int x=0; x < numberOfResultNodes; x++) {
      resultNode=resultNodes.item(x);
      result.addAll(selectNodes(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,nullPolicy,omitText));
    }
    return result;
  }
  return resultNodes;
}

Fixed version (ground truth):
private NodeList selectNodes(Node contextNode,XPathFragment xPathFragment,XMLNamespaceResolver xmlNamespaceResolver,AbstractNullPolicy nullPolicy,boolean omitText,boolean concatText){
  NodeList resultNodes=getNodes(contextNode,xPathFragment,xmlNamespaceResolver,nullPolicy,concatText);
  if (xPathFragment.getNextFragment() != null && !(omitText && xPathFragment.getNextFragment().nameIsText())) {
    Node resultNode;
    XMLNodeList result=new XMLNodeList();
    int numberOfResultNodes=resultNodes.getLength();
    for (int x=0; x < numberOfResultNodes; x++) {
      resultNode=resultNodes.item(x);
      result.addAll(selectNodes(resultNode,xPathFragment.getNextFragment(),xmlNamespaceResolver,nullPolicy,omitText,concatText));
    }
    return result;
  }
  return resultNodes;
}
Program: 63721
Project: 63721
Buggy source:
/** 
 * Attempt to load the DatabasePlatform using the given platform class name.  If the platform cannot be loaded Oracle11Platform will be returned.
 * @param platformClassName class name of the DatabasePlatform to be loaded
 * @return DatabasePlatform loaded for the given platformClassname, or Oracle11Platform if not found
 * @see org.eclipse.persistence.platform.database.oracle.Oracle11Platform
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static DatabasePlatform loadDatabasePlatform(String platformClassName){
  DatabasePlatform dbPlatform;
  try {
    Class platformClass=null;
    if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
      platformClass=(Class)AccessController.doPrivileged(new PrivilegedClassForName(platformClassName));
    }
 else {
      platformClass=PrivilegedAccessHelper.getClassForName(platformClassName);
    }
    dbPlatform=(DatabasePlatform)Helper.getInstanceFromClass(platformClass);
  }
 catch (  Exception e) {
    dbPlatform=new Oracle11Platform();
  }
  return dbPlatform;
}

Fixed version (ground truth):
/** 
 * Attempt to load the DatabasePlatform using the given platform class name.  If the platform cannot be loaded Oracle11Platform will be returned - if available.
 * @param platformClassName class name of the DatabasePlatform to be loaded
 * @return DatabasePlatform loaded for the given platformClassname, or Oracle11Platform if not found
 * @see org.eclipse.persistence.platform.database.oracle.Oracle11Platform
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static DatabasePlatform loadDatabasePlatform(String platformClassName){
  DatabasePlatform dbPlatform=null;
  Class platformClass=null;
  try {
    if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
      platformClass=(Class)AccessController.doPrivileged(new PrivilegedClassForName(platformClassName));
    }
 else {
      platformClass=PrivilegedAccessHelper.getClassForName(platformClassName);
    }
    dbPlatform=(DatabasePlatform)Helper.getInstanceFromClass(platformClass);
  }
 catch (  Exception e) {
    try {
      if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
        platformClass=(Class)AccessController.doPrivileged(new PrivilegedClassForName(DEFAULT_PLATFORM));
      }
 else {
        platformClass=PrivilegedAccessHelper.getClassForName(DEFAULT_PLATFORM);
      }
      dbPlatform=(DatabasePlatform)Helper.getInstanceFromClass(platformClass);
    }
 catch (    Exception ex) {
    }
  }
  return dbPlatform;
}
Program: 63722
Project: 63722
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object value=unmarshalRecord.getCharacters().toString();
  boolean isCDATA=unmarshalRecord.isBufferCDATA();
  unmarshalRecord.resetStringBuffer();
  Field toWrite=xmlField;
  if (xmlField.isCDATA() != isCDATA) {
    toWrite=new XMLField(xmlField.getName());
    toWrite.setNamespaceResolver(xmlField.getNamespaceResolver());
    toWrite.setIsCDATA(isCDATA);
  }
  ConversionManager conversionManager=(ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=conversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  if (null == unmarshalRecord.getTransformationRecord()) {
    unmarshalRecord.setTransformationRecord(new XMLTransformationRecord("String_Node_Str",unmarshalRecord));
  }
  unmarshalRecord.getTransformationRecord().put(toWrite,value);
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object value=unmarshalRecord.getCharacters().toString();
  boolean isCDATA=unmarshalRecord.isBufferCDATA();
  unmarshalRecord.resetStringBuffer();
  Field toWrite=xmlField;
  if (xmlField.isCDATA() != isCDATA) {
    toWrite=new XMLField(xmlField.getName());
    toWrite.setNamespaceResolver(xmlField.getNamespaceResolver());
    toWrite.setIsCDATA(isCDATA);
  }
  ConversionManager conversionManager=unmarshalRecord.getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName(),conversionManager);
    value=conversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  if (null == unmarshalRecord.getTransformationRecord()) {
    unmarshalRecord.setTransformationRecord(new XMLTransformationRecord("String_Node_Str",unmarshalRecord));
  }
  unmarshalRecord.getTransformationRecord().put(toWrite,value);
}
Program: 63723
Project: 63723
Buggy source:
private QName getSchemaType(Field xmlField,Object value,CoreAbstractSession session){
  QName schemaType=null;
  if (xmlField.isTypedTextField()) {
    schemaType=xmlField.getXMLType(value.getClass());
  }
 else   if (xmlField.isUnionField()) {
    return getSchemaTypeForUnion((UnionField)xmlField,value,session);
  }
 else   if (xmlField.getSchemaType() != null) {
    schemaType=xmlField.getSchemaType();
  }
  return schemaType;
}

Fixed version (ground truth):
private QName getSchemaType(Field xmlField,Object value,CoreAbstractSession session){
  QName schemaType=null;
  if (xmlField.isTypedTextField()) {
    ConversionManager conversionManager=(ConversionManager)session.getDatasourcePlatform().getConversionManager();
    schemaType=xmlField.getXMLType(value.getClass(),conversionManager);
  }
 else   if (xmlField.isUnionField()) {
    return getSchemaTypeForUnion((UnionField)xmlField,value,session);
  }
 else   if (xmlField.getSchemaType() != null) {
    schemaType=xmlField.getSchemaType();
  }
  return schemaType;
}
Program: 63724
Project: 63724
Buggy source:
private QName getSchemaTypeForUnion(UnionField xmlField,Object value,CoreAbstractSession session){
  List schemaTypes=xmlField.getSchemaTypes();
  QName schemaType=null;
  QName nextQName;
  Class javaClass;
  for (int i=0; i < schemaTypes.size(); i++) {
    nextQName=(QName)xmlField.getSchemaTypes().get(i);
    try {
      if (nextQName != null) {
        javaClass=xmlField.getJavaClass(nextQName);
        value=((ConversionManager)session.getDatasourcePlatform().getConversionManager()).convertObject(value,javaClass,nextQName);
        schemaType=nextQName;
        break;
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        schemaType=nextQName;
      }
    }
  }
  return schemaType;
}

Fixed version (ground truth):
private QName getSchemaTypeForUnion(UnionField xmlField,Object value,CoreAbstractSession session){
  List schemaTypes=xmlField.getSchemaTypes();
  QName schemaType=null;
  QName nextQName;
  Class javaClass;
  for (int i=0; i < schemaTypes.size(); i++) {
    nextQName=(QName)xmlField.getSchemaTypes().get(i);
    try {
      if (nextQName != null) {
        ConversionManager conversionManager=(ConversionManager)session.getDatasourcePlatform().getConversionManager();
        javaClass=xmlField.getJavaClass(nextQName,conversionManager);
        value=conversionManager.convertObject(value,javaClass,nextQName);
        schemaType=nextQName;
        break;
      }
    }
 catch (    ConversionException ce) {
      if (i == (schemaTypes.size() - 1)) {
        schemaType=nextQName;
      }
    }
  }
  return schemaType;
}
Program: 63728
Project: 63728
Buggy source:
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord,Object value,Object collection){
  if (unmarshalRecord.isNil() && unmarshalRecord.getXMLReader().isNullRepresentedByXsiNil(xmlCompositeDirectCollectionMapping.getNullPolicy())) {
    value=null;
  }
 else   if (!isWhitespaceAware() && Constants.EMPTY_STRING.equals(value)) {
    value=null;
  }
  Field xmlField=(Field)xmlCompositeDirectCollectionMapping.getField();
  ConversionManager conversionManager=(ConversionManager)unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName());
    value=conversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  value=xmlCompositeDirectCollectionMapping.convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
  if (value != null && value.getClass() == CoreClassConstants.STRING) {
    if (xmlCompositeDirectCollectionMapping.isCollapsingStringValues()) {
      value=XMLConversionManager.getDefaultXMLManager().collapseStringValue((String)value);
    }
 else     if (xmlCompositeDirectCollectionMapping.isNormalizingStringValues()) {
      value=XMLConversionManager.getDefaultXMLManager().normalizeStringValue((String)value);
    }
  }
  unmarshalRecord.addAttributeValue(this,value,collection);
}

Fixed version (ground truth):
private void addUnmarshalValue(UnmarshalRecord unmarshalRecord,Object value,Object collection){
  if (unmarshalRecord.isNil() && unmarshalRecord.getXMLReader().isNullRepresentedByXsiNil(xmlCompositeDirectCollectionMapping.getNullPolicy())) {
    value=null;
  }
 else   if (!isWhitespaceAware() && Constants.EMPTY_STRING.equals(value)) {
    value=null;
  }
  Field xmlField=(Field)xmlCompositeDirectCollectionMapping.getField();
  ConversionManager conversionManager=unmarshalRecord.getConversionManager();
  if (unmarshalRecord.getTypeQName() != null) {
    Class typeClass=xmlField.getJavaClass(unmarshalRecord.getTypeQName(),conversionManager);
    value=conversionManager.convertObject(value,typeClass,unmarshalRecord.getTypeQName());
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  value=xmlCompositeDirectCollectionMapping.convertDataValueToObjectValue(value,unmarshalRecord.getSession(),unmarshalRecord.getUnmarshaller());
  if (value != null && value.getClass() == CoreClassConstants.STRING) {
    if (xmlCompositeDirectCollectionMapping.isCollapsingStringValues()) {
      value=conversionManager.collapseStringValue((String)value);
    }
 else     if (xmlCompositeDirectCollectionMapping.isNormalizingStringValues()) {
      value=conversionManager.normalizeStringValue((String)value);
    }
  }
  unmarshalRecord.addAttributeValue(this,value,collection);
}
Program: 63730
Project: 63730
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (unmarshalRecord.isNil() && xmlCompositeObjectMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
    unmarshalRecord.resetStringBuffer();
    return;
  }
  if (null == unmarshalRecord.getChildRecord()) {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlCompositeObjectMapping.getKeepAsElementPolicy();
    if (null != keepAsElementPolicy && (keepAsElementPolicy.isKeepUnknownAsElement() || keepAsElementPolicy.isKeepAllAsElement()) && builder.getNodes().size() != 0) {
      if (unmarshalRecord.getTypeQName() != null) {
        Class theClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(unmarshalRecord.getTypeQName());
        if (theClass != null) {
          endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping,xPathFragment,null);
          return;
        }
      }
      if (builder.getDocument() != null) {
        setOrAddAttributeValueForKeepAsElement(builder,xmlCompositeObjectMapping,xmlCompositeObjectMapping,unmarshalRecord,false,null);
        return;
      }
    }
 else {
      endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping,xPathFragment,null);
      return;
    }
  }
 else {
    Object object=unmarshalRecord.getChildRecord().getCurrentObject();
    setAttributeValue(object,unmarshalRecord);
    unmarshalRecord.setChildRecord(null);
  }
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (unmarshalRecord.isNil() && xmlCompositeObjectMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
    unmarshalRecord.resetStringBuffer();
    return;
  }
  if (null == unmarshalRecord.getChildRecord()) {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlCompositeObjectMapping.getKeepAsElementPolicy();
    if (null != keepAsElementPolicy && (keepAsElementPolicy.isKeepUnknownAsElement() || keepAsElementPolicy.isKeepAllAsElement()) && builder.getNodes().size() != 0) {
      if (unmarshalRecord.getTypeQName() != null) {
        Class theClass=unmarshalRecord.getConversionManager().javaType(unmarshalRecord.getTypeQName());
        if (theClass != null) {
          endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping,xPathFragment,null);
          return;
        }
      }
      if (builder.getDocument() != null) {
        setOrAddAttributeValueForKeepAsElement(builder,xmlCompositeObjectMapping,xmlCompositeObjectMapping,unmarshalRecord,false,null);
        return;
      }
    }
 else {
      endElementProcessText(unmarshalRecord,xmlCompositeObjectMapping,xPathFragment,null);
      return;
    }
  }
 else {
    Object object=unmarshalRecord.getChildRecord().getCurrentObject();
    setAttributeValue(object,unmarshalRecord);
    unmarshalRecord.setChildRecord(null);
  }
}
Program: 63732
Project: 63732
Buggy source:
/** 
 * Removes all leading and trailing whitespaces, and replaces any sequences of whitespaces that occur in the string with a single ' ' character.
 */
public String collapseStringValue(String value){
  int length=value.length();
  int start=0;
  while (start < length) {
    if (isWhitespace(value.charAt(start),true)) {
      break;
    }
    start++;
  }
  if (start == length) {
    return value;
  }
  StringBuffer collapsedString=new StringBuffer(length);
  if (start != 0) {
    for (int i=0; i < start; i++) {
      collapsedString.append(value.charAt(i));
    }
    collapsedString.append(' ');
  }
  boolean inSequence=true;
  for (int i=start + 1; i < length; i++) {
    char nextCharacter=value.charAt(i);
    if (!isWhitespace(nextCharacter,true)) {
      collapsedString.append(nextCharacter);
      inSequence=false;
    }
 else {
      if (inSequence) {
        continue;
      }
 else {
        collapsedString.append(' ');
        inSequence=true;
      }
    }
  }
  length=collapsedString.length();
  if (length > 0 && collapsedString.charAt(length - 1) == ' ') {
    collapsedString.setLength(length - 1);
  }
  return collapsedString.toString();
}

Fixed version (ground truth):
/** 
 * Removes all leading and trailing whitespaces, and replaces any sequences of whitespaces that occur in the string with a single ' ' character.
 */
@Override public String collapseStringValue(String value){
  int length=value.length();
  int start=0;
  while (start < length) {
    if (isWhitespace(value.charAt(start),true)) {
      break;
    }
    start++;
  }
  if (start == length) {
    return value;
  }
  StringBuffer collapsedString=new StringBuffer(length);
  if (start != 0) {
    for (int i=0; i < start; i++) {
      collapsedString.append(value.charAt(i));
    }
    collapsedString.append(' ');
  }
  boolean inSequence=true;
  for (int i=start + 1; i < length; i++) {
    char nextCharacter=value.charAt(i);
    if (!isWhitespace(nextCharacter,true)) {
      collapsedString.append(nextCharacter);
      inSequence=false;
    }
 else {
      if (inSequence) {
        continue;
      }
 else {
        collapsedString.append(' ');
        inSequence=true;
      }
    }
  }
  length=collapsedString.length();
  if (length > 0 && collapsedString.charAt(length - 1) == ' ') {
    collapsedString.setLength(length - 1);
  }
  return collapsedString.toString();
}
Program: 63733
Project: 63733
Buggy source:
public Object convertSchemaBase64ListToByteArrayList(Object sourceObject,CoreContainerPolicy containerPolicy,CoreAbstractSession session) throws ConversionException {
  if (sourceObject instanceof String) {
    StringTokenizer tokenizer=new StringTokenizer((String)sourceObject,"String_Node_Str");
    Object container=containerPolicy.containerInstance();
    while (tokenizer.hasMoreElements()) {
      String token=tokenizer.nextToken();
      byte[] bytes=Base64.base64Decode(token.getBytes());
      containerPolicy.addInto(bytes,container,session);
    }
    return container;
  }
  throw ConversionException.couldNotBeConverted(sourceObject,CoreClassConstants.ABYTE);
}

Fixed version (ground truth):
@Override public Object convertSchemaBase64ListToByteArrayList(Object sourceObject,CoreContainerPolicy containerPolicy,CoreAbstractSession session) throws ConversionException {
  if (sourceObject instanceof String) {
    StringTokenizer tokenizer=new StringTokenizer((String)sourceObject,"String_Node_Str");
    Object container=containerPolicy.containerInstance();
    while (tokenizer.hasMoreElements()) {
      String token=tokenizer.nextToken();
      byte[] bytes=Base64.base64Decode(token.getBytes());
      containerPolicy.addInto(bytes,container,session);
    }
    return container;
  }
  throw ConversionException.couldNotBeConverted(sourceObject,CoreClassConstants.ABYTE);
}
Program: 63734
Project: 63734
Buggy source:
/** 
 * Replaces any CR, Tab or LF characters in the string with a single ' ' character.
 */
public String normalizeStringValue(String value){
  int i=0;
  int length=value.length();
  while (i < length) {
    if (isWhitespace(value.charAt(i),false)) {
      break;
    }
    i++;
  }
  if (i == length) {
    return value;
  }
  char[] buffer=value.toCharArray();
  buffer[i]=' ';
  i++;
  for (; i < length; i++) {
    if (isWhitespace(buffer[i],false)) {
      buffer[i]=' ';
    }
  }
  return new String(buffer);
}

Fixed version (ground truth):
/** 
 * Replaces any CR, Tab or LF characters in the string with a single ' ' character.
 */
@Override public String normalizeStringValue(String value){
  int i=0;
  int length=value.length();
  while (i < length) {
    if (isWhitespace(value.charAt(i),false)) {
      break;
    }
    i++;
  }
  if (i == length) {
    return value;
  }
  char[] buffer=value.toCharArray();
  buffer[i]=' ';
  i++;
  for (; i < length; i++) {
    if (isWhitespace(buffer[i],false)) {
      buffer[i]=' ';
    }
  }
  return new String(buffer);
}
Program: 63735
Project: 63735
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (unmarshalRecord.isNil() && xmlDirectMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
    unmarshalRecord.resetStringBuffer();
    return;
  }
  unmarshalRecord.removeNullCapableValue(this);
  Field xmlField=(Field)xmlDirectMapping.getField();
  if (!xmlField.getLastXPathFragment().nameIsText) {
    return;
  }
  Object value;
  CharSequence unmarshalRecordCharacters=unmarshalRecord.getCharacters();
  if (unmarshalRecordCharacters.length() == 0) {
    value=xmlDirectMapping.getNullValue();
  }
 else {
    value=unmarshalRecordCharacters.toString();
  }
  unmarshalRecord.resetStringBuffer();
  CoreAbstractSession session=unmarshalRecord.getSession();
  ConversionManager conversionManager=(ConversionManager)session.getDatasourcePlatform().getConversionManager();
  QName typeQName=unmarshalRecord.getTypeQName();
  if (typeQName != null) {
    Class typeClass=xmlField.getJavaClass(typeQName);
    value=conversionManager.convertObject(value,typeClass,typeQName);
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  Object convertedValue=xmlDirectMapping.getAttributeValue(value,session,unmarshalRecord);
  unmarshalRecord.setAttributeValue(convertedValue,xmlDirectMapping);
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  if (unmarshalRecord.isNil() && xmlDirectMapping.getNullPolicy().isNullRepresentedByXsiNil()) {
    unmarshalRecord.resetStringBuffer();
    return;
  }
  unmarshalRecord.removeNullCapableValue(this);
  Field xmlField=(Field)xmlDirectMapping.getField();
  if (!xmlField.getLastXPathFragment().nameIsText) {
    return;
  }
  Object value;
  CharSequence unmarshalRecordCharacters=unmarshalRecord.getCharacters();
  if (unmarshalRecordCharacters.length() == 0) {
    value=xmlDirectMapping.getNullValue();
  }
 else {
    value=unmarshalRecordCharacters.toString();
  }
  unmarshalRecord.resetStringBuffer();
  CoreAbstractSession session=unmarshalRecord.getSession();
  ConversionManager conversionManager=(ConversionManager)session.getDatasourcePlatform().getConversionManager();
  QName typeQName=unmarshalRecord.getTypeQName();
  if (typeQName != null) {
    Class typeClass=xmlField.getJavaClass(typeQName,conversionManager);
    value=conversionManager.convertObject(value,typeClass,typeQName);
  }
 else {
    value=unmarshalRecord.getXMLReader().convertValueBasedOnSchemaType(xmlField,value,conversionManager,unmarshalRecord);
  }
  Object convertedValue=xmlDirectMapping.getAttributeValue(value,session,unmarshalRecord);
  unmarshalRecord.setAttributeValue(convertedValue,xmlDirectMapping);
}
Program: 63739
Project: 63739
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()) {
        if (!charactersAllowed) {
          throw JAXBException.jsonValuePropertyRequired("String_Node_Str");
        }
        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 {
    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);
  }
}
Program: 63740
Project: 63740
Buggy source:
@Override public void startCollection(){
  if (null == level) {
    try {
      startCallback();
      writer.write('[');
      level=new Level(true,false,level);
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
  }
 else {
    level.setCollection(true);
    level.setEmptyCollection(true);
  }
}

Fixed version (ground truth):
@Override public void startCollection(){
  if (null == level) {
    try {
      startCallback();
      writer.write('[');
      level=new Level(true,false,level);
    }
 catch (    IOException e) {
      throw XMLMarshalException.marshalException(e);
    }
  }
 else {
    level.setCollection(true);
    level.setEmptyCollection(true);
    charactersAllowed=false;
    isStartElementOpen=false;
  }
}
Program: 63741
Project: 63741
Buggy source:
/** 
 * This constructor allows setting the default package name and database platform.
 * @param defaultPackage package name to be prepended to generated class names for artifactsnot in a PL/SQL package such as an Entity (to avoid having classes in the default package)
 * @param dbPlatform DatabasePlatform to be used to get class names for database types, i.e. java.math.BigDecimal for DECIMAL.
 * @param generateCRUDOps if true, CRUD operations (NamedNativeQueryMetadata) will be generated for each Entity
 * @see org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
 */
public JPAMetadataGenerator(String defaultPackage,DatabasePlatform dbPlatform,boolean generateCRUDOps){
  this.defaultPackage=defaultPackage;
  this.dbPlatform=dbPlatform;
  this.generateCRUDOps=generateCRUDOps;
  xmlEntityMappings=new XMLEntityMappings();
  initializeXMLEntityMappingLists();
}

Fixed version (ground truth):
/** 
 * This constructor allows setting the default package name and database platform.
 * @param defaultPackage package name to be prepended to generated class names for artifactsnot in a PL/SQL package such as an Entity (to avoid having classes in the default package)
 * @param dbPlatform DatabasePlatform to be used to get class names for database types, i.e. java.math.BigDecimal for DECIMAL.
 * @param generateCRUDOps if true, CRUD operations (NamedNativeQueryMetadata) will be generated for each Entity
 * @see org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
 */
public JPAMetadataGenerator(String defaultPackage,DatabasePlatform dbPlatform,boolean generateCRUDOps){
  this.defaultPackage=defaultPackage.toLowerCase();
  this.dbPlatform=dbPlatform;
  this.generateCRUDOps=generateCRUDOps;
  xmlEntityMappings=new XMLEntityMappings();
  initializeXMLEntityMappingLists();
}
Program: 63743
Project: 63743
Buggy source:
protected ContextState(Context context,PROJECT project,ClassLoader classLoader,Collection<SESSION_EVENT_LISTENER> sessionEventListeners){
  this();
  this.context=context;
  preLogin(project,classLoader);
  session=(SESSION)project.createDatabaseSession();
  if (sessionEventListeners != null) {
    for (    SESSION_EVENT_LISTENER sessionEventListener : sessionEventListeners) {
      session.getEventManager().addListener(sessionEventListener);
    }
  }
  session.setLogLevel(SessionLog.OFF);
  setupSession(session);
  storeDescriptorsByQName(session);
}

Fixed version (ground truth):
protected ContextState(Context context,PROJECT project,ClassLoader classLoader,Collection<SESSION_EVENT_LISTENER> sessionEventListeners){
  this();
  this.context=context;
  preLogin(project,classLoader);
  session=(SESSION)project.createDatabaseSession();
  if (sessionEventListeners != null) {
    for (    SESSION_EVENT_LISTENER sessionEventListener : sessionEventListeners) {
      session.getEventManager().addListener(sessionEventListener);
    }
  }
  setupSession(session);
  storeDescriptorsByQName(session);
}
Program: 63744
Project: 63744
Buggy source:
public EncodedData getBytesFromMultipart(MimeMultipart value,Marshaller marshaller){
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  try {
    ContentType contentType=new ContentType(value.getContentType());
    String boundary=contentType.getParameter("String_Node_Str");
    output.write(Helper.cr().getBytes());
    output.write(("String_Node_Str" + contentType.getBaseType() + "String_Node_Str"+ boundary+ "String_Node_Str").getBytes());
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(value,byte[].class,ex);
  }
  try {
    value.writeTo(output);
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(value,byte[].class,ex);
  }
  return new EncodedData(output.toByteArray(),value.getContentType());
}

Fixed version (ground truth):
public EncodedData getBytesFromMultipart(MimeMultipart value,Marshaller marshaller){
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  try {
    ContentType contentType=new ContentType(value.getContentType());
    String boundary=contentType.getParameter("String_Node_Str");
    output.write(Constants.cr().getBytes());
    output.write(("String_Node_Str" + contentType.getBaseType() + "String_Node_Str"+ boundary+ "String_Node_Str").getBytes());
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(value,byte[].class,ex);
  }
  try {
    value.writeTo(output);
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(value,byte[].class,ex);
  }
  return new EncodedData(output.toByteArray(),value.getContentType());
}
Program: 63745
Project: 63745
Buggy source:
/** 
 * INTERNAL:
 * @since EclipseLink 2.5.0
 */
public Root createRoot(){
  return new XMLRoot();
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 * @since EclipseLink 2.5.0
 */
public Root createRoot(){
  return unmarshaller.createRoot();
}