nus-yam/ex-repair huggingface dataset:
Program: 64711
Project: 64711
Buggy source:
/** 
 * Process @XmlElement annotation on a given property.
 * @param property
 */
private void processXmlElement(Property property,TypeInfo info){
  if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
    XmlElement element=(XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class);
    property.setIsRequired(element.required());
    property.setNillable(element.nillable());
    if (element.type() != XmlElement.DEFAULT.class && !(property.isSwaAttachmentRef())) {
      property.setOriginalType(property.getType());
      if (isCollectionType(property.getType())) {
        property.setGenericType(helper.getJavaClass(element.type()));
      }
 else {
        property.setType(helper.getJavaClass(element.type()));
      }
      property.setHasXmlElementType(true);
    }
    if (!element.defaultValue().equals(ELEMENT_DECL_DEFAULT)) {
      property.setDefaultValue(element.defaultValue());
    }
    validateElementIsInPropOrder(info,property.getPropertyName());
  }
}

Fixed version (ground truth):
/** 
 * Process @XmlElement annotation on a given property.
 * @param property
 */
private void processXmlElement(Property property,TypeInfo info){
  if (helper.isAnnotationPresent(property.getElement(),XmlElement.class)) {
    XmlElement element=(XmlElement)helper.getAnnotation(property.getElement(),XmlElement.class);
    property.setIsRequired(element.required());
    property.setNillable(element.nillable());
    if (element.type() != XmlElement.DEFAULT.class && !(property.isSwaAttachmentRef())) {
      property.setOriginalType(property.getType());
      if (isCollectionType(property.getType())) {
        property.setGenericType(helper.getJavaClass(element.type()));
      }
 else {
        property.setType(helper.getJavaClass(element.type()));
      }
      property.setHasXmlElementType(true);
    }
    if (!element.defaultValue().equals(ELEMENT_DECL_DEFAULT)) {
      property.setDefaultValue(element.defaultValue());
    }
  }
}
Program: 64716
Project: 64716
Buggy source:
@AfterClass public static void tearDown(){
  if (ddlDrop) {
    runDdl(conn,DROP_VARCHARSP_PROC,ddlDebug);
    runDdl(conn,DROP_NOARGSP_PROC,ddlDebug);
    runDdl(conn,DROP_INOUTARGSSP_PROC,ddlDebug);
    runDdl(conn,DROP_FINDBYJOB_PROC,ddlDebug);
    runDdl(conn,DROP_GETALL_PROC,ddlDebug);
    runDdl(conn,DROP_GETSALARYBYID_PROC,ddlDebug);
    runDdl(conn,DROP_SIMPLESP_TABLE,ddlDebug);
  }
}

Fixed version (ground truth):
@AfterClass public static void tearDown(){
  if (ddlDrop) {
    runDdl(conn,DROP_VARCHARSP_PROC,ddlDebug);
    runDdl(conn,DROP_NOARGSP_PROC,ddlDebug);
    runDdl(conn,DROP_INOUTARGSSP_PROC,ddlDebug);
    runDdl(conn,DROP_FINDBYJOB_PROC,ddlDebug);
    runDdl(conn,DROP_GETALL_PROC,ddlDebug);
    runDdl(conn,DROP_GETSALARYBYID_PROC,ddlDebug);
    runDdl(conn,DROP_SIMPLESP_TABLE,ddlDebug);
    runDdl(conn,DROP_OUT_IN_INOUT_ARGSSP_PROC,ddlDebug);
  }
}
Program: 64719
Project: 64719
Buggy source:
/** 
 * INTERNAL: If the UnmarshalRecord has a ReferenceResolver, tell it to resolve its references.
 * @since EclipseLink 2.5.0
 */
public void resolveReferences(AbstractSession abstractSession,IDResolver idResolver){
  if (null != referenceResolver) {
    referenceResolver.resolveReferences(abstractSession,idResolver);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: If the UnmarshalRecord has a ReferenceResolver, tell it to resolve its references.
 * @since EclipseLink 2.5.0
 */
public void resolveReferences(AbstractSession abstractSession,IDResolver idResolver){
  if (null != referenceResolver) {
    referenceResolver.resolveReferences(abstractSession,idResolver,unmarshaller.getErrorHandler());
  }
}
Program: 64720
Project: 64720
Buggy source:
/** 
 * INTERNAL: If the UnmarshalRecord has a ReferenceResolver, tell it to resolve its references.
 * @since EclipseLink 2.5.0
 */
public void resolveReferences(AbstractSession abstractSession,IDResolver idResolver){
  if (null != referenceResolver) {
    referenceResolver.resolveReferences(abstractSession,idResolver);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: If the UnmarshalRecord has a ReferenceResolver, tell it to resolve its references.
 * @since EclipseLink 2.5.0
 */
public void resolveReferences(AbstractSession abstractSession,IDResolver idResolver){
  if (null != referenceResolver) {
    referenceResolver.resolveReferences(abstractSession,idResolver,unmarshaller.getErrorHandler());
  }
}
Program: 64723
Project: 64723
Buggy source:
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  if ((getReferenceClass() == null) && (getReferenceClassName() != null)) {
    if (!getReferenceClassName().equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)) {
      setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));
    }
  }
  if (getReferenceClass() != null) {
    super.initialize(session);
  }
 else {
    if (getField() == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(getField()));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  ContainerPolicy cp=getContainerPolicy();
  if (cp != null) {
    if (cp.getContainerClass() == null) {
      Class cls=session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
      cp.setContainerClass(cls);
    }
    if (cp instanceof MapContainerPolicy) {
      ((MapContainerPolicy)cp).setElementClass(this.getReferenceClass());
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  String referenceClassName=getReferenceClassName();
  if (this.referenceClass == null && referenceClassName != null) {
    if (!referenceClassName.equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)) {
      setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(referenceClassName));
    }
  }
  if (this.referenceClass != null) {
    super.initialize(session);
  }
 else {
    if (this.field == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(this.field));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  ContainerPolicy cp=getContainerPolicy();
  if (cp != null) {
    if (cp.getContainerClass() == null) {
      Class cls=session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
      cp.setContainerClass(cls);
    }
    if (cp instanceof MapContainerPolicy) {
      ((MapContainerPolicy)cp).setElementClass(this.referenceClass);
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}
Program: 64724
Project: 64724
Buggy source:
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  if ((getReferenceClass() == null) && (getReferenceClassName() != null)) {
    if (!getReferenceClassName().equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)) {
      setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));
    }
  }
  if (getReferenceClass() != null) {
    super.initialize(session);
  }
 else {
    if (getField() == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(getField()));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  String referenceClassName=getReferenceClassName();
  if ((this.referenceClass == null) && (referenceClassName != null)) {
    if (!referenceClassName.equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)) {
      setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(referenceClassName));
    }
  }
  if (this.referenceClass != null) {
    super.initialize(session);
  }
 else {
    if (this.field == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(this.field));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}
Program: 64725
Project: 64725
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(CycleRecoverableTestCases.class);
  suite.addTestSuite(ClassLevelAccessorTestCases.class);
  suite.addTestSuite(PackageLevelAccessorTestCases.class);
  suite.addTestSuite(NonELIDResolverTestCases.class);
  suite.addTestSuite(NonELPrefixMapperTestCases.class);
  suite.addTest(XmlLocationTestSuite.suite());
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(CycleRecoverableTestCases.class);
  suite.addTestSuite(ClassLevelAccessorTestCases.class);
  suite.addTestSuite(PackageLevelAccessorTestCases.class);
  suite.addTestSuite(NonELIDResolverTestCases.class);
  suite.addTestSuite(NonELPrefixMapperTestCases.class);
  suite.addTest(XmlLocationTestSuite.suite());
  suite.addTestSuite(XmlAccessorFactorySupportTestCases.class);
  return suite;
}
Program: 64726
Project: 64726
Buggy source:
/** 
 * Test exception handling:  in this case an invalid transformer class has been set.  An exception should be thrown. Negative test.
 */
public void testInvalidTransformerClass(){
  InputStream inputStream=ClassLoader.getSystemResourceAsStream(METADATA_FILE_BAD_CLASS);
  HashMap<String,Source> metadataSourceMap=new HashMap<String,Source>();
  metadataSourceMap.put("String_Node_Str",new StreamSource(inputStream));
  Map<String,Map<String,Source>> properties=new HashMap<String,Map<String,Source>>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,metadataSourceMap);
  int exceptionCount=0;
  try {
    JAXBContext jaxbContext=(JAXBContext)JAXBContextFactory.createContext(new Class[]{Employee.class},properties,Thread.currentThread().getContextClassLoader());
  }
 catch (  JAXBException e) {
    exceptionCount++;
  }
  assertTrue("String_Node_Str",exceptionCount > 0);
  exceptionCount--;
  try {
    Map<String,XmlBindings> bindings=JAXBContextFactory.getXmlBindingsFromProperties(properties,Thread.currentThread().getContextClassLoader());
    JavaModelInputImpl jModelInput=new JavaModelInputImpl(new Class[]{Employee.class},new JavaModelImpl(new JaxbClassLoader(Thread.currentThread().getContextClassLoader(),new Class[]{Employee.class})));
    Generator generator=new Generator(jModelInput,bindings,Thread.currentThread().getContextClassLoader(),"String_Node_Str");
    generator.generateSchema();
  }
 catch (  Exception e) {
    exceptionCount++;
  }
  assertTrue("String_Node_Str",exceptionCount > 0);
}

Fixed version (ground truth):
/** 
 * Test exception handling:  in this case an invalid transformer class has been set.  An exception should be thrown. Negative test.
 */
public void testInvalidTransformerClass(){
  InputStream inputStream=ClassLoader.getSystemResourceAsStream(METADATA_FILE_BAD_CLASS);
  HashMap<String,Source> metadataSourceMap=new HashMap<String,Source>();
  metadataSourceMap.put("String_Node_Str",new StreamSource(inputStream));
  Map<String,Map<String,Source>> properties=new HashMap<String,Map<String,Source>>();
  properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY,metadataSourceMap);
  int exceptionCount=0;
  try {
    JAXBContext jaxbContext=(JAXBContext)JAXBContextFactory.createContext(new Class[]{Employee.class},properties,Thread.currentThread().getContextClassLoader());
  }
 catch (  JAXBException e) {
    exceptionCount++;
  }
  assertTrue("String_Node_Str",exceptionCount > 0);
  exceptionCount--;
  try {
    Map<String,XmlBindings> bindings=JAXBContextFactory.getXmlBindingsFromProperties(properties,Thread.currentThread().getContextClassLoader());
    JavaModelInputImpl jModelInput=new JavaModelInputImpl(new Class[]{Employee.class},new JavaModelImpl(new JaxbClassLoader(Thread.currentThread().getContextClassLoader(),new Class[]{Employee.class})));
    Generator generator=new Generator(jModelInput,bindings,Thread.currentThread().getContextClassLoader(),"String_Node_Str",false);
    generator.generateSchema();
  }
 catch (  Exception e) {
    exceptionCount++;
  }
  assertTrue("String_Node_Str",exceptionCount > 0);
}
Program: 64728
Project: 64728
Buggy source:
private void processAccessorFactory(JavaClass javaClass,TypeInfo info){
  Annotation xmlAccessorFactory=helper.getAnnotation(javaClass,CompilerHelper.ACCESSOR_FACTORY_ANNOTATION_CLASS);
  Method valueMethod=null;
  if (xmlAccessorFactory != null) {
    valueMethod=CompilerHelper.ACCESSOR_FACTORY_VALUE_METHOD;
  }
 else {
    xmlAccessorFactory=helper.getAnnotation(javaClass,CompilerHelper.INTERNAL_ACCESSOR_FACTORY_ANNOTATION_CLASS);
    if (xmlAccessorFactory != null) {
      valueMethod=CompilerHelper.INTERNAL_ACCESSOR_FACTORY_VALUE_METHOD;
    }
  }
  if (xmlAccessorFactory != null) {
    Class xmlAccessorFactoryClass=null;
    try {
      xmlAccessorFactoryClass=(Class)PrivilegedAccessHelper.invokeMethod(valueMethod,xmlAccessorFactory,new Object[]{});
      info.setXmlAccessorFactory(new AccessorFactoryWrapper(PrivilegedAccessHelper.newInstanceFromClass(xmlAccessorFactoryClass)));
    }
 catch (    Exception ex) {
      throw JAXBException.errorInstantiatingAccessorFactory(xmlAccessorFactoryClass,ex);
    }
  }
  PackageInfo pInfo=getPackageInfoForPackage(javaClass);
  if (pInfo != null) {
    info.setPackageLevelXmlAccessorFactory(pInfo.getAccessorFactory());
  }
}

Fixed version (ground truth):
private void processAccessorFactory(JavaClass javaClass,TypeInfo info){
  if (!xmlAccessorFactorySupport) {
    return;
  }
  Annotation xmlAccessorFactory=helper.getAnnotation(javaClass,CompilerHelper.ACCESSOR_FACTORY_ANNOTATION_CLASS);
  Method valueMethod=null;
  if (xmlAccessorFactory != null) {
    valueMethod=CompilerHelper.ACCESSOR_FACTORY_VALUE_METHOD;
  }
 else {
    xmlAccessorFactory=helper.getAnnotation(javaClass,CompilerHelper.INTERNAL_ACCESSOR_FACTORY_ANNOTATION_CLASS);
    if (xmlAccessorFactory != null) {
      valueMethod=CompilerHelper.INTERNAL_ACCESSOR_FACTORY_VALUE_METHOD;
    }
  }
  if (xmlAccessorFactory != null) {
    Class xmlAccessorFactoryClass=null;
    try {
      xmlAccessorFactoryClass=(Class)PrivilegedAccessHelper.invokeMethod(valueMethod,xmlAccessorFactory,new Object[]{});
      info.setXmlAccessorFactory(new AccessorFactoryWrapper(PrivilegedAccessHelper.newInstanceFromClass(xmlAccessorFactoryClass)));
    }
 catch (    Exception ex) {
      throw JAXBException.errorInstantiatingAccessorFactory(xmlAccessorFactoryClass,ex);
    }
  }
  PackageInfo pInfo=getPackageInfoForPackage(javaClass);
  if (pInfo != null) {
    info.setPackageLevelXmlAccessorFactory(pInfo.getAccessorFactory());
  }
}
Program: 64729
Project: 64729
Buggy source:
/** 
 * This constructor will process and apply the given XmlBindings as appropriate.  Classes declared in the bindings will be amalgamated with any classes in the JavaModelInput. If xmlBindings is null or empty, AnnotationsProcessor will be used to process  annotations as per usual.
 * @param jModelInput
 * @param javaClassToType
 * @param xmlBindings map of XmlBindings keyed on package name
 * @param cLoader
 */
public Generator(JavaModelInput jModelInput,TypeMappingInfo[] typeMappingInfos,JavaClass[] javaClasses,Map<Type,TypeMappingInfo> typeToTypeMappingInfo,Map<String,XmlBindings> xmlBindings,ClassLoader cLoader,String defaultTargetNamespace){
  helper=new Helper(jModelInput.getJavaModel());
  annotationsProcessor=new AnnotationsProcessor(helper);
  annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
  schemaGenerator=new SchemaGenerator(helper);
  mappingsGenerator=new MappingsGenerator(helper);
  this.typeToTypeMappingInfo=typeToTypeMappingInfo;
  if (xmlBindings != null && xmlBindings.size() > 0) {
    new XMLProcessor(xmlBindings).processXML(annotationsProcessor,jModelInput,typeMappingInfos,javaClasses);
  }
 else {
    annotationsProcessor.processClassesAndProperties(javaClasses,typeMappingInfos);
  }
}

Fixed version (ground truth):
/** 
 * This constructor will process and apply the given XmlBindings as appropriate.  Classes declared in the bindings will be amalgamated with any classes in the JavaModelInput. If xmlBindings is null or empty, AnnotationsProcessor will be used to process  annotations as per usual.
 * @param jModelInput
 * @param javaClassToType
 * @param xmlBindings map of XmlBindings keyed on package name
 * @param cLoader
 */
public Generator(JavaModelInput jModelInput,TypeMappingInfo[] typeMappingInfos,JavaClass[] javaClasses,Map<Type,TypeMappingInfo> typeToTypeMappingInfo,Map<String,XmlBindings> xmlBindings,ClassLoader cLoader,String defaultTargetNamespace,boolean enableXmlAccessorFactory){
  helper=new Helper(jModelInput.getJavaModel());
  annotationsProcessor=new AnnotationsProcessor(helper);
  annotationsProcessor.setXmlAccessorFactorySupport(enableXmlAccessorFactory);
  annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
  schemaGenerator=new SchemaGenerator(helper);
  mappingsGenerator=new MappingsGenerator(helper);
  this.typeToTypeMappingInfo=typeToTypeMappingInfo;
  if (xmlBindings != null && xmlBindings.size() > 0) {
    new XMLProcessor(xmlBindings).processXML(annotationsProcessor,jModelInput,typeMappingInfos,javaClasses);
  }
 else {
    annotationsProcessor.processClassesAndProperties(javaClasses,typeMappingInfos);
  }
}
Program: 64730
Project: 64730
Buggy source:
public boolean equals(Object obj){
  Child child=(Child)obj;
  return this.parent != null && child.parent != null;
}

Fixed version (ground truth):
public boolean equals(Object obj){
  Child child=(Child)obj;
  if (name == null) {
    if (child.name != null) {
      return false;
    }
  }
 else   if (!name.equals(child.name)) {
    return false;
  }
  return this.parent != null && child.parent != null;
}
Program: 64732
Project: 64732
Buggy source:
private void marshalNilAttribute(SDOProperty property,DOMRecord row){
  String xsiPrefix=typeHelper.getNamespaceResolver().resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  if ((xsiPrefix == null) || xsiPrefix.equals(SDOConstants.EMPTY_STRING)) {
    xsiPrefix=typeHelper.getNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    typeHelper.getNamespaceResolver().put(xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
  }
  String xPath=getXPathForProperty(property,true);
  xPath=xPath + "String_Node_Str" + xsiPrefix+ XMLConstants.COLON+ XMLConstants.SCHEMA_NIL_ATTRIBUTE;
  XMLField field=new XMLField(xPath);
  field.setNamespaceResolver(typeHelper.getNamespaceResolver());
  row.put(field,XMLConstants.BOOLEAN_STRING_TRUE);
}

Fixed version (ground truth):
private void marshalNilAttribute(SDOProperty property,DOMRecord row){
  NamespaceResolver resolver;
  if (this.resolver == null) {
    resolver=typeHelper.getNamespaceResolver();
  }
 else {
    resolver=this.resolver;
  }
  String xsiPrefix=resolver.resolveNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
  if ((xsiPrefix == null) || xsiPrefix.equals(SDOConstants.EMPTY_STRING)) {
    this.resolver=new NamespaceResolver();
    resolver=this.resolver;
    copyNamespaces(typeHelper.getNamespaceResolver(),resolver);
    xsiPrefix=resolver.generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    resolver.put(xsiPrefix,XMLConstants.SCHEMA_INSTANCE_URL);
  }
  String xPath=getXPathForProperty(property,true);
  xPath=xPath + "String_Node_Str" + xsiPrefix+ XMLConstants.COLON+ XMLConstants.SCHEMA_NIL_ATTRIBUTE;
  XMLField field=new XMLField(xPath);
  field.setNamespaceResolver(resolver);
  row.put(field,XMLConstants.BOOLEAN_STRING_TRUE);
}
Program: 64733
Project: 64733
Buggy source:
public void testMarshallerJsonValueWrapper() throws Exception {
  m.setProperty(MarshallerProperties.JSON_VALUE_WRAPPER,"String_Node_Str");
  assertEquals("String_Node_Str",m.getProperty(MarshallerProperties.JSON_VALUE_WRAPPER));
  m.setProperty(MarshallerProperties.JSON_VALUE_WRAPPER,null);
  assertEquals(null,m.getProperty(MarshallerProperties.JSON_VALUE_WRAPPER));
}

Fixed version (ground truth):
public void testMarshallerJsonValueWrapper() throws Exception {
  m.setProperty(MarshallerProperties.JSON_VALUE_WRAPPER,"String_Node_Str");
  assertEquals("String_Node_Str",m.getProperty(MarshallerProperties.JSON_VALUE_WRAPPER));
}
Program: 64735
Project: 64735
Buggy source:
@Override public String getValue(String uri,String localName){
  return xmlStreamReader.getAttributeValue(uri,localName);
}

Fixed version (ground truth):
@Override public String getValue(String uri,String localName){
  if (XMLConstants.EMPTY_STRING.equals(uri)) {
    uri=null;
  }
  return xmlStreamReader.getAttributeValue(uri,localName);
}
Program: 64736
Project: 64736
Buggy source:
public void testElementCollection(){
  EntityManager em=createEntityManager();
  Query query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  List args=new ArrayList();
  args.add(0);
  args.add(1);
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  closeEntityManager(em);
}

Fixed version (ground truth):
public void testElementCollection(){
  EntityManager em=createEntityManager();
  Query query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  List args=new ArrayList();
  args.add(0);
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  query=em.createQuery("String_Node_Str");
  query.setParameter("String_Node_Str",args);
  query.getResultList();
  closeEntityManager(em);
}
Program: 64737
Project: 64737
Buggy source:
public void run(){
  try {
    beginTransaction(em2);
    Query query2=em2.createQuery("String_Node_Str");
    query2.setParameter("String_Node_Str",bobId);
    query2.setHint(QueryHints.PESSIMISTIC_LOCK_TIMEOUT,10);
    Employee emp=(Employee)query2.getSingleResult();
    emp.setFirstName("String_Node_Str");
    commitTransaction(em2);
  }
 catch (  javax.persistence.RollbackException ex) {
    if (ex.getMessage().indexOf("String_Node_Str") == -1) {
      ex.printStackTrace();
      fail("String_Node_Str" + ex);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    beginTransaction(em2);
    Query query2=em2.createQuery("String_Node_Str");
    query2.setParameter("String_Node_Str",bobId);
    query2.setHint(QueryHints.PESSIMISTIC_LOCK_TIMEOUT,10);
    Employee emp=(Employee)query2.getSingleResult();
    emp.setFirstName("String_Node_Str");
    commitTransaction(em2);
  }
 catch (  javax.persistence.RollbackException ex) {
    if (ex.getMessage().indexOf("String_Node_Str") == -1) {
      ex.printStackTrace();
      fail("String_Node_Str" + ex);
    }
  }
}
Program: 64739
Project: 64739
Buggy source:
protected List<XmlAdapter> getAdapters() throws Exception {
  if (adapters == null) {
    adapters=new ArrayList<XmlAdapter>();
    for (    ClassDescriptor desc : this.getJpaSession().getDescriptors().values()) {
      Class clz=desc.getJavaClass();
      String referenceAdapterName=clz.getName() + "String_Node_Str" + RestAdapterClassWriter.ADAPTER_INNER_CLASS_NAME;
      ClassLoader cl=getJpaSession().getDatasourcePlatform().getConversionManager().getLoader();
      Class referenceAdaptorClass=Class.forName(referenceAdapterName,true,cl);
      Class[] argTypes={String.class,PersistenceContext.class};
      Constructor referenceAdaptorConstructor=referenceAdaptorClass.getDeclaredConstructor(argTypes);
      Object[] args=new Object[]{getBaseURI().toString(),this};
      adapters.add((XmlAdapter)referenceAdaptorConstructor.newInstance(args));
    }
  }
  return adapters;
}

Fixed version (ground truth):
protected List<XmlAdapter> getAdapters() throws Exception {
  if (adapters == null) {
    adapters=new ArrayList<XmlAdapter>();
    for (    ClassDescriptor desc : this.getJpaSession().getDescriptors().values()) {
      if (!desc.isAggregateCollectionDescriptor() && !desc.isAggregateDescriptor()) {
        Class clz=desc.getJavaClass();
        String referenceAdapterName=clz.getName() + "String_Node_Str" + RestAdapterClassWriter.ADAPTER_INNER_CLASS_NAME;
        ClassLoader cl=getJpaSession().getDatasourcePlatform().getConversionManager().getLoader();
        Class referenceAdaptorClass=Class.forName(referenceAdapterName,true,cl);
        Class[] argTypes={String.class,PersistenceContext.class};
        Constructor referenceAdaptorConstructor=referenceAdaptorClass.getDeclaredConstructor(argTypes);
        Object[] args=new Object[]{getBaseURI().toString(),this};
        adapters.add((XmlAdapter)referenceAdaptorConstructor.newInstance(args));
      }
    }
  }
  return adapters;
}
Program: 64741
Project: 64741
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 {
  ContextResolver<JAXBContext> resolver=providers.getContextResolver(JAXBContext.class,mediaType);
  JAXBContext jaxbContext;
  if (null == resolver || null == (jaxbContext=resolver.getContext(domainClass))) {
    return JAXBContextFactory.createContext(new Class[]{domainClass},null);
  }
 else   if (jaxbContext instanceof org.eclipse.persistence.jaxb.JAXBContext) {
    return jaxbContext;
  }
 else {
    return JAXBContextFactory.createContext(new Class[]{domainClass},null);
  }
}

Fixed version (ground truth):
/** 
 * 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=providers.getContextResolver(JAXBContext.class,mediaType);
  if (null == resolver || null == (jaxbContext=resolver.getContext(domainClass))) {
    return JAXBContextFactory.createContext(new Class[]{domainClass},null);
  }
 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;
  }
}
Program: 64744
Project: 64744
Buggy source:
public static ConversionException couldNotBeConverted(Object object,Class javaClass,Exception exception){
  Object[] args={object,object.getClass(),javaClass};
  String message=ExceptionMessageGenerator.buildMessage(ConversionException.class,COULD_NOT_BE_CONVERTED,args);
  ConversionException conversionException=new ConversionException(message,object,javaClass,exception);
  conversionException.setErrorCode(COULD_NOT_BE_CONVERTED);
  return conversionException;
}

Fixed version (ground truth):
public static ConversionException couldNotBeConverted(Object object,Class javaClass,Exception exception){
  Class objectClass=null;
  if (object != null) {
    objectClass=object.getClass();
  }
  Object[] args={object,objectClass,javaClass};
  String message=ExceptionMessageGenerator.buildMessage(ConversionException.class,COULD_NOT_BE_CONVERTED,args);
  ConversionException conversionException=new ConversionException(message,object,javaClass,exception);
  conversionException.setErrorCode(COULD_NOT_BE_CONVERTED);
  return conversionException;
}
Program: 64745
Project: 64745
Buggy source:
/** 
 * Returns the visitor that can find the   {@link IdentificationVariable} of the {@link RangeVariableDeclaration}. This should be used when the query is either a <code><b>DELETE</b></code> or <code><b>UPDATE</b></code> query.
 * @return The visitor that can traverse the query and returns the {@link IdentificationVariable}
 */
protected VirtualIdentificationVariableFinder getVirtualIdentificationVariableFinder(){
  if (virtualIdentificationVariableFinder == null) {
    virtualIdentificationVariableFinder=new VirtualIdentificationVariableFinder();
  }
  return virtualIdentificationVariableFinder;
}

Fixed version (ground truth):
/** 
 * Returns the visitor that can find the   {@link IdentificationVariable} of the {@link RangeVariableDeclaration}. This should be used when the query is either a <code><b>DELETE</b></code> or <code><b>UPDATE</b></code> query.
 * @return The visitor that can traverse the query and returns the {@link IdentificationVariable}
 */
protected BaseDeclarationIdentificationVariableFinder getVirtualIdentificationVariableFinder(){
  if (virtualIdentificationVariableFinder == null) {
    virtualIdentificationVariableFinder=new BaseDeclarationIdentificationVariableFinder();
  }
  return virtualIdentificationVariableFinder;
}
Program: 64747
Project: 64747
Buggy source:
/** 
 * Returns the   {@link IdentificationVariable} that defines the identification variable for eithera <code><b>DELETE</b></code> or an <code><b>UPDATE</b></code> query.
 * @param expression The {@link AbstractSchemaName} that is being validated and that most likelyrepresenting an associated path expression and not an entity name
 * @return The {@link IdentificationVariable} defining either the identification variable or thevirtual identification variable for the <code><b>DELETE</b></code> or for the <code><b>UPDATE</b></code> query
 */
protected IdentificationVariable findVirtualIdentificationVariable(AbstractSchemaName expression){
  VirtualIdentificationVariableFinder visitor=getVirtualIdentificationVariableFinder();
  try {
    expression.accept(visitor);
    return visitor.expression;
  }
  finally {
    visitor.expression=null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the   {@link IdentificationVariable} that defines the identification variable for eithera <code><b>DELETE</b></code> or an <code><b>UPDATE</b></code> query.
 * @param expression The {@link AbstractSchemaName} that is being validated and that most likelyrepresenting an associated path expression and not an entity name
 * @return The {@link IdentificationVariable} defining either the identification variable or thevirtual identification variable for the <code><b>DELETE</b></code> or for the <code><b>UPDATE</b></code> query
 */
protected IdentificationVariable findVirtualIdentificationVariable(AbstractSchemaName expression){
  BaseDeclarationIdentificationVariableFinder visitor=getVirtualIdentificationVariableFinder();
  try {
    expression.accept(visitor);
    return visitor.expression;
  }
  finally {
    visitor.expression=null;
  }
}
Program: 64748
Project: 64748
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=providers.getContextResolver(JAXBContext.class,mediaType);
  if (null == resolver || null == (jaxbContext=resolver.getContext(domainClass))) {
    return JAXBContextFactory.createContext(new Class[]{domainClass},null);
  }
 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):
/** 
 * 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=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;
  }
}
Program: 64751
Project: 64751
Buggy source:
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  if ((getReferenceClass() == null) && (getReferenceClassName() != null)) {
    setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));
  }
  if (getReferenceClass() != null) {
    super.initialize(session);
  }
 else {
    if (getField() == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(getField()));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  ContainerPolicy cp=getContainerPolicy();
  if (cp != null) {
    if (cp.getContainerClass() == null) {
      Class cls=session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
      cp.setContainerClass(cls);
    }
    if (cp instanceof MapContainerPolicy) {
      ((MapContainerPolicy)cp).setElementClass(this.getReferenceClass());
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  if ((getReferenceClass() == null) && (getReferenceClassName() != null)) {
    if (!getReferenceClassName().equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)) {
      setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));
    }
  }
  if (getReferenceClass() != null) {
    super.initialize(session);
  }
 else {
    if (getField() == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(getField()));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  ContainerPolicy cp=getContainerPolicy();
  if (cp != null) {
    if (cp.getContainerClass() == null) {
      Class cls=session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(cp.getContainerClassName());
      cp.setContainerClass(cls);
    }
    if (cp instanceof MapContainerPolicy) {
      ((MapContainerPolicy)cp).setElementClass(this.getReferenceClass());
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}
Program: 64752
Project: 64752
Buggy source:
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  if ((getReferenceClass() == null) && (getReferenceClassName() != null)) {
    setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));
  }
  if (getReferenceClass() != null) {
    super.initialize(session);
  }
 else {
    if (getField() == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(getField()));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.
 */
public void initialize(AbstractSession session) throws DescriptorException {
  if ((getReferenceClass() == null) && (getReferenceClassName() != null)) {
    if (!getReferenceClassName().equals(XMLConstants.UNKNOWN_OR_TRANSIENT_CLASS)) {
      setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));
    }
  }
  if (getReferenceClass() != null) {
    super.initialize(session);
  }
 else {
    if (getField() == null) {
      throw DescriptorException.fieldNameNotSetInMapping(this);
    }
    setField(getDescriptor().buildField(getField()));
    setFields(collectFields());
    if (hasConverter()) {
      getConverter().initialize(this,session);
    }
  }
  if (null != getContainerAccessor()) {
    getContainerAccessor().initializeAttributes(this.referenceClass);
  }
}
Program: 64753
Project: 64753
Buggy source:
/** 
 * Build an XMLInverseMapping based on a particular mapping and replace that mapping with the newly created XMLInverseMapping in jaxbDescriptor
 * @param jaxbDescriptor
 * @param mapping
 * @param mappedBy
 */
protected static void convertMappingToXMLInverseReferenceMapping(ClassDescriptor jaxbDescriptor,DatabaseMapping mapping,String mappedBy){
  if (!(mapping.isXMLMapping() && (mapping.isAbstractCompositeCollectionMapping() || mapping.isAbstractCompositeObjectMapping()))) {
    return;
  }
  XMLInverseReferenceMapping jaxbInverseMapping=new XMLInverseReferenceMapping();
  jaxbInverseMapping.setAttributeName(mapping.getAttributeName());
  jaxbInverseMapping.setGetMethodName(mapping.getGetMethodName());
  jaxbInverseMapping.setSetMethodName(mapping.getSetMethodName());
  jaxbInverseMapping.setProperties(mapping.getProperties());
  jaxbInverseMapping.setIsReadOnly(mapping.isReadOnly());
  jaxbInverseMapping.setMappedBy(mappedBy);
  if (mapping.isAbstractCompositeCollectionMapping()) {
    jaxbInverseMapping.setContainerPolicy(mapping.getContainerPolicy());
    jaxbInverseMapping.setReferenceClass(((XMLCompositeCollectionMapping)mapping).getReferenceClass());
  }
 else   if (mapping.isAbstractCompositeObjectMapping()) {
    jaxbInverseMapping.setReferenceClass(((XMLCompositeObjectMapping)mapping).getReferenceClass());
  }
  jaxbDescriptor.removeMappingForAttributeName(mapping.getAttributeName());
  jaxbDescriptor.addMapping(jaxbInverseMapping);
}

Fixed version (ground truth):
/** 
 * Build an XMLInverseMapping based on a particular mapping and replace that mapping with the newly created XMLInverseMapping in jaxbDescriptor
 * @param jaxbDescriptor
 * @param mapping
 * @param mappedBy
 */
protected static void convertMappingToXMLInverseReferenceMapping(ClassDescriptor jaxbDescriptor,DatabaseMapping mapping,String mappedBy){
  if (!(mapping.isXMLMapping() && (mapping.isAbstractCompositeCollectionMapping() || mapping.isAbstractCompositeObjectMapping()))) {
    return;
  }
  XMLInverseReferenceMapping jaxbInverseMapping=new XMLInverseReferenceMapping();
  copyAccessorToMapping(mapping,jaxbInverseMapping);
  jaxbInverseMapping.setProperties(mapping.getProperties());
  jaxbInverseMapping.setIsReadOnly(mapping.isReadOnly());
  jaxbInverseMapping.setMappedBy(mappedBy);
  if (mapping.isAbstractCompositeCollectionMapping()) {
    jaxbInverseMapping.setContainerPolicy(mapping.getContainerPolicy());
    jaxbInverseMapping.setReferenceClass(((XMLCompositeCollectionMapping)mapping).getReferenceClass());
  }
 else   if (mapping.isAbstractCompositeObjectMapping()) {
    jaxbInverseMapping.setReferenceClass(((XMLCompositeObjectMapping)mapping).getReferenceClass());
  }
  jaxbDescriptor.removeMappingForAttributeName(mapping.getAttributeName());
  jaxbDescriptor.addMapping(jaxbInverseMapping);
}
Program: 64757
Project: 64757
Buggy source:
public void updateXML(Object obj,Node associatedNode){
  if (obj instanceof XMLRoot) {
    obj=((XMLRoot)obj).getObject();
  }
  Node objNode=this.getXMLNode(obj);
  AbstractSession session=context.getSession(obj);
  if (objNode == associatedNode) {
    DOMRecord root=new DOMRecord((Element)associatedNode);
    root.setDocPresPolicy(this.documentPreservationPolicy);
    XMLDescriptor rootDescriptor=(XMLDescriptor)session.getDescriptor(obj);
    ((XMLObjectBuilder)rootDescriptor.getObjectBuilder()).buildIntoNestedRow(root,obj,session);
  }
}

Fixed version (ground truth):
public void updateXML(Object obj,Node associatedNode){
  if (obj instanceof XMLRoot) {
    obj=((XMLRoot)obj).getObject();
  }
  Node objNode=this.getXMLNode(obj);
  AbstractSession session=context.getSession(obj);
  if (objNode == associatedNode) {
    DOMRecord root=new DOMRecord((Element)associatedNode);
    root.setMarshaller(marshaller);
    root.setDocPresPolicy(this.documentPreservationPolicy);
    XMLDescriptor rootDescriptor=(XMLDescriptor)session.getDescriptor(obj);
    ((XMLObjectBuilder)rootDescriptor.getObjectBuilder()).buildIntoNestedRow(root,obj,session);
  }
}
Program: 64759
Project: 64759
Buggy source:
public void initializeNodeValue(){
  XMLMapping xmlMapping=xmlChoiceMapping.getChoiceElementMappings().get(xmlField);
  if (xmlMapping instanceof XMLBinaryDataMapping) {
    choiceElementNodeValue=new XMLBinaryDataMappingNodeValue((XMLBinaryDataMapping)xmlMapping);
  }
 else   if (xmlMapping instanceof XMLDirectMapping) {
    choiceElementNodeValue=new XMLDirectMappingNodeValue((XMLDirectMapping)xmlMapping);
  }
 else   if (xmlMapping instanceof XMLObjectReferenceMapping) {
    choiceElementNodeValue=new XMLObjectReferenceMappingNodeValue((XMLObjectReferenceMapping)xmlMapping,xmlField);
  }
 else {
    choiceElementNodeValue=new XMLCompositeObjectMappingNodeValue((XMLCompositeObjectMapping)xmlMapping);
  }
}

Fixed version (ground truth):
public void initializeNodeValue(){
  XMLMapping xmlMapping=xmlChoiceMapping.getChoiceElementMappings().get(xmlField);
  choiceElementNodeValue=getNodeValueForMapping(xmlMapping);
  for (  Entry<Class,XMLMapping> entry : xmlChoiceMapping.getChoiceElementMappingsByClass().entrySet()) {
    XMLField field=xmlChoiceMapping.getClassToFieldMappings().get(entry.getKey());
    if (field != null && field.equals(this.xmlField)) {
      XMLMapping mappingForClass=entry.getValue();
      if (mappingForClass != xmlMapping) {
        if (this.choiceElementNodeValues == null) {
          choiceElementNodeValues=new HashMap<Class,NodeValue>();
        }
        choiceElementNodeValues.put(entry.getKey(),getNodeValueForMapping(mappingForClass));
      }
    }
  }
}
Program: 64760
Project: 64760
Buggy source:
public void setXPathNode(XPathNode xPathNode){
  super.setXPathNode(xPathNode);
  this.choiceElementNodeValue.setXPathNode(xPathNode);
}

Fixed version (ground truth):
public void setXPathNode(XPathNode xPathNode){
  super.setXPathNode(xPathNode);
  this.choiceElementNodeValue.setXPathNode(xPathNode);
  if (this.choiceElementNodeValues != null) {
    for (    NodeValue next : choiceElementNodeValues.values()) {
      next.setXPathNode(xPathNode);
    }
  }
}
Program: 64761
Project: 64761
Buggy source:
public XMLChoiceObjectMapping(){
  fieldToClassMappings=new HashMap<XMLField,Class>();
  fieldToClassNameMappings=new HashMap<XMLField,String>();
  classToFieldMappings=new HashMap<Class,XMLField>();
  classNameToFieldMappings=new HashMap<String,XMLField>();
  choiceElementMappings=new LinkedHashMap<XMLField,XMLMapping>();
  fieldsToConverters=new HashMap<XMLField,Converter>();
}

Fixed version (ground truth):
public XMLChoiceObjectMapping(){
  fieldToClassMappings=new HashMap<XMLField,Class>();
  fieldToClassNameMappings=new HashMap<XMLField,String>();
  classToFieldMappings=new HashMap<Class,XMLField>();
  classNameToFieldMappings=new HashMap<String,XMLField>();
  choiceElementMappings=new LinkedHashMap<XMLField,XMLMapping>();
  choiceElementMappingsByClass=new LinkedHashMap<Class,XMLMapping>();
  choiceElementMappingsByClassName=new LinkedHashMap<String,XMLMapping>();
  fieldsToConverters=new HashMap<XMLField,Converter>();
}