nus-yam/ex-repair huggingface dataset:
Program: 67482
Project: 67482
Buggy source:
/** 
 * If the element wrapper has a namespace that is not ##default and not the target namespace an element reference should generated 
 */
public void testElementWrapperRef(){
  String msg="String_Node_Str";
  boolean exception=false;
  try {
    MySchemaOutputResolver outputResolver=new MySchemaOutputResolver();
    Class[] classes=new Class[]{MyClassOne.class,MyClassTwo.class};
    JAXBContext context=(org.eclipse.persistence.jaxb.JAXBContext)org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(classes,null);
    context.generateSchema(outputResolver);
    assertTrue("String_Node_Str",outputResolver.schemaFiles.size() > 0);
    assertTrue("String_Node_Str",outputResolver.schemaFiles.size() == 2);
    SchemaFactory sFact=SchemaFactory.newInstance(XMLConstants.SCHEMA_URL);
    Schema theSchema=sFact.newSchema(outputResolver.schemaFiles.get(0));
    Validator validator=theSchema.newValidator();
    String src="String_Node_Str";
    StreamSource ss=new StreamSource(new File(src));
    validator.validate(ss);
  }
 catch (  Exception ex) {
    exception=true;
    msg=ex.toString();
  }
  assertFalse("String_Node_Str" + msg,exception);
}

Fixed version (ground truth):
/** 
 * If the element wrapper has a namespace that is not ##default and not the target namespace an element reference should generated 
 */
public void testElementWrapperRef(){
  MySchemaOutputResolver outputResolver=new MySchemaOutputResolver();
  SchemaFactory sFact=SchemaFactory.newInstance(XMLConstants.SCHEMA_URL);
  Schema theSchema;
  Validator validator;
  String src="String_Node_Str";
  StreamSource ss=new StreamSource(new File(src));
  try {
    Class[] classes=new Class[]{MyClassOne.class,MyClassTwo.class};
    JAXBContext context=(org.eclipse.persistence.jaxb.JAXBContext)org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(classes,null);
    context.generateSchema(outputResolver);
  }
 catch (  Exception ex) {
    fail("String_Node_Str" + ex.toString());
  }
  assertTrue("String_Node_Str",outputResolver.schemaFiles.size() > 0);
  assertTrue("String_Node_Str",outputResolver.schemaFiles.size() == 2);
  try {
    theSchema=sFact.newSchema(outputResolver.schemaFiles.get(0));
    validator=theSchema.newValidator();
    validator.validate(ss);
  }
 catch (  Exception ex) {
    try {
      theSchema=sFact.newSchema(outputResolver.schemaFiles.get(1));
      validator=theSchema.newValidator();
      validator.validate(ss);
    }
 catch (    Exception x) {
      fail("String_Node_Str" + ex.toString() + "String_Node_Str"+ x.toString());
    }
  }
}
Program: 67483
Project: 67483
Buggy source:
public void generateAnyObjectMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLAnyObjectMapping mapping=new XMLAnyObjectMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  if (property.getType().getQualifiedName().equals("String_Node_Str")) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
  descriptor.addMapping(mapping);
}

Fixed version (ground truth):
public void generateAnyObjectMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  XMLAnyObjectMapping mapping=new XMLAnyObjectMapping();
  mapping.setAttributeName(property.getPropertyName());
  if (property.isMethodProperty()) {
    mapping.setSetMethodName(property.getSetMethodName());
    mapping.setGetMethodName(property.getGetMethodName());
    if (property.getGetMethodName() == null) {
      mapping.setIsReadOnly(true);
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setIsWriteOnly(true);
    }
  }
  if (property.getType().getQualifiedName().equals("String_Node_Str")) {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT);
  }
 else {
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
  }
  mapping.setUseXMLRoot(true);
  mapping.setAttributeAccessor(new JAXBElementAttributeAccessor(mapping.getAttributeAccessor()));
  descriptor.addMapping(mapping);
}
Program: 67484
Project: 67484
Buggy source:
/** 
 * Return a QName representation of a qualified table name (aka default root element).  The given descriptor's namespace resolver will be used to determine the correct prefix - if any - to be used.
 * @param desc
 * @param qualifiedTableName
 * @return
 */
protected QName getDefaultRootElementAsQName(XMLDescriptor desc,String qualifiedTableName){
  QName qName=null;
  NamespaceResolver nsResolver=desc.getNamespaceResolver();
  int idx=qualifiedTableName.indexOf(COLON);
  String localName=qualifiedTableName.substring(idx + 1);
  if (idx > -1) {
    String prefix=qualifiedTableName.substring(0,idx);
    String uri=nsResolver.resolveNamespacePrefix(prefix);
    qName=new QName(uri,localName);
  }
 else {
    if (nsResolver.getDefaultNamespaceURI() != null) {
      qName=new QName(nsResolver.getDefaultNamespaceURI(),localName);
    }
 else {
      qName=new QName(localName);
    }
  }
  return qName;
}

Fixed version (ground truth):
/** 
 * Return a QName representation of a qualified table name (aka default root element).  The given descriptor's namespace resolver will be used to determine the correct prefix - if any - to be used.
 * @param desc
 * @param qualifiedTableName
 * @return
 */
protected QName getDefaultRootElementAsQName(XMLDescriptor desc,String qualifiedTableName){
  QName qName=null;
  int idx=qualifiedTableName.indexOf(COLON);
  String localName=qualifiedTableName.substring(idx + 1);
  NamespaceResolver nsResolver=desc.getNamespaceResolver();
  if (nsResolver == null) {
    qName=new QName(localName);
  }
 else   if (idx > -1) {
    String prefix=qualifiedTableName.substring(0,idx);
    String uri=nsResolver.resolveNamespacePrefix(prefix);
    qName=new QName(uri,localName);
  }
 else {
    if (nsResolver.getDefaultNamespaceURI() != null) {
      qName=new QName(nsResolver.getDefaultNamespaceURI(),localName);
    }
 else {
      qName=new QName(localName);
    }
  }
  return qName;
}
Program: 67486
Project: 67486
Buggy source:
/** 
 * Create and return a SimpleType for a given XMLDescriptor.
 * @param desc
 * @param workingSchema
 * @return
 */
protected SimpleType buildSimpleType(XMLDescriptor desc,Schema workingSchema){
  SimpleType st=buildNewSimpleType(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
  DatabaseMapping mapping=desc.getMappings().get(0);
  QName qname=(QName)XMLConversionManager.getDefaultJavaTypes().get(mapping.getAttributeClassification());
  String baseType=qname.getLocalPart();
  if (qname.getNamespaceURI() != null) {
    String prefix=workingSchema.getNamespaceResolver().resolveNamespaceURI(qname.getNamespaceURI());
    if (prefix == null) {
      prefix=workingSchema.getNamespaceResolver().generatePrefix();
      workingSchema.getNamespaceResolver().put(prefix,qname.getNamespaceURI());
    }
    baseType=prefix + COLON + baseType;
  }
  Restriction restriction=new Restriction();
  restriction.setBaseType(baseType);
  st.setRestriction(restriction);
  return st;
}

Fixed version (ground truth):
/** 
 * Create and return a SimpleType for a given XMLDescriptor.
 * @param desc
 * @param workingSchema
 * @return
 */
protected SimpleType buildSimpleType(XMLDescriptor desc,Schema workingSchema,boolean global){
  SimpleType st;
  if (global) {
    st=buildNewSimpleType(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
  }
 else {
    st=new SimpleType();
  }
  DatabaseMapping mapping=desc.getMappings().get(0);
  QName qname=(QName)XMLConversionManager.getDefaultJavaTypes().get(mapping.getAttributeClassification());
  String baseType=qname.getLocalPart();
  if (qname.getNamespaceURI() != null) {
    String prefix=workingSchema.getNamespaceResolver().resolveNamespaceURI(qname.getNamespaceURI());
    if (prefix == null) {
      prefix=workingSchema.getNamespaceResolver().generatePrefix();
      workingSchema.getNamespaceResolver().put(prefix,qname.getNamespaceURI());
    }
    baseType=prefix + COLON + baseType;
  }
  Restriction restriction=new Restriction();
  restriction.setBaseType(baseType);
  st.setRestriction(restriction);
  return st;
}
Program: 67487
Project: 67487
Buggy source:
/** 
 * Process a given XMLDirectMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLDirectMapping(XMLDirectMapping mapping,Sequence seq,ComplexType ct,Schema workingSchema){
  XPathFragment frag=((XMLField)mapping.getField()).getXPathFragment();
  if (frag.isSelfFragment()) {
    return;
  }
  boolean isPk=isFragPrimaryKey(frag,mapping);
  String schemaTypeString=null;
  if (isPk) {
    schemaTypeString=XMLConstants.SCHEMA_PREFIX + COLON + ID;
  }
 else {
    schemaTypeString=getSchemaTypeForDirectMapping(mapping,workingSchema);
  }
  Class attributeClassification=mapping.getAttributeClassification();
  if (attributeClassification != null && Enum.class.isAssignableFrom(attributeClassification)) {
    Converter converter=mapping.getConverter();
    if (converter != null && converter instanceof EnumTypeConverter) {
      processEnumeration(schemaTypeString,frag,mapping,seq,ct,workingSchema,converter);
      return;
    }
  }
  if (frag.isAttribute()) {
    Attribute attr=buildAttribute(mapping,schemaTypeString);
    ct.getOrderedAttributes().add(attr);
  }
 else {
    Element elem=buildElement(frag,schemaTypeString,Occurs.ZERO,null);
    seq.addElement(elem);
  }
}

Fixed version (ground truth):
/** 
 * Process a given XMLDirectMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLDirectMapping(XMLDirectMapping mapping,Sequence seq,ComplexType ct,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties){
  XPathFragment frag=((XMLField)mapping.getField()).getXPathFragment();
  if (frag.isSelfFragment()) {
    return;
  }
  boolean isPk=isFragPrimaryKey(frag,mapping);
  String schemaTypeString=null;
  if (isPk) {
    schemaTypeString=XMLConstants.SCHEMA_PREFIX + COLON + ID;
  }
 else {
    schemaTypeString=getSchemaTypeForDirectMapping(mapping,workingSchema);
  }
  Class attributeClassification=mapping.getAttributeClassification();
  if (attributeClassification != null && Enum.class.isAssignableFrom(attributeClassification)) {
    Converter converter=mapping.getConverter();
    if (converter != null && converter instanceof EnumTypeConverter) {
      processEnumeration(schemaTypeString,frag,mapping,seq,ct,workingSchema,converter);
      return;
    }
  }
  if (frag.isAttribute()) {
    Attribute attr=buildAttribute(mapping,schemaTypeString);
    ct.getOrderedAttributes().add(attr);
  }
 else {
    seq=buildSchemaComponentsForXPath(frag,seq,schemaForNamespace,workingSchema,properties);
    frag=getTargetXPathFragment(frag);
    Element elem=elementExistsInSequence(frag.getLocalName(),frag.getShortName(),seq);
    if (elem == null) {
      if (frag.getNamespaceURI() != null) {
        elem=handleFragNamespace(frag,schemaForNamespace,workingSchema,properties,elem,schemaTypeString);
      }
 else {
        elem=buildElement(frag,schemaTypeString,Occurs.ZERO,null);
      }
      seq.addElement(elem);
    }
  }
}
Program: 67489
Project: 67489
Buggy source:
/** 
 * Indicates if a given fragment is a primary key.
 * @param frag
 * @param mapping
 * @return
 */
protected boolean isFragPrimaryKey(XPathFragment frag,XMLDirectMapping mapping){
  if (true) {
    return false;
  }
  Vector<String> pkFieldNames=mapping.getDescriptor().getPrimaryKeyFieldNames();
  if (pkFieldNames != null) {
    if (frag.isAttribute()) {
      return pkFieldNames.contains(ATTRIBUTE + frag.getLocalName());
    }
    return pkFieldNames.contains(frag.getLocalName() + TEXT);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Indicates if a given fragment is a primary key.
 * @param frag
 * @param mapping
 * @return
 */
protected boolean isFragPrimaryKey(XPathFragment frag,XMLDirectMapping mapping){
  if (true) {
    return false;
  }
  Vector<String> pkFieldNames=mapping.getDescriptor().getPrimaryKeyFieldNames();
  if (pkFieldNames != null) {
    if (frag.isAttribute()) {
      return pkFieldNames.contains(ATTRIBUTE + frag.getLocalName());
    }
    return pkFieldNames.contains(frag.getLocalName() + SLASH + TEXT);
  }
  return false;
}
Program: 67490
Project: 67490
Buggy source:
/** 
 * Process a given XMLCompositeDirectCollectionMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLCompositeDirectCollectionMapping(XMLCompositeDirectCollectionMapping mapping,Sequence seq,ComplexType ct,Schema workingSchema){
  XMLField field=((XMLField)(mapping).getField());
  String schemaTypeString=getSchemaTypeForElement(field,mapping.getAttributeElementClass(),workingSchema);
  Element element;
  if (field.usesSingleNode()) {
    SimpleType st=new SimpleType();
    org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
    if (schemaTypeString == null) {
      schemaTypeString=getSchemaTypeString(XMLConstants.ANY_SIMPLE_TYPE_QNAME,workingSchema);
    }
    list.setItemType(schemaTypeString);
    st.setList(list);
    element=buildElement(field.getXPathFragment(),null,Occurs.ZERO,null);
    element.setSimpleType(st);
  }
 else {
    element=buildElement(field.getXPathFragment(),schemaTypeString,Occurs.ZERO,null);
    element.setMaxOccurs(Occurs.UNBOUNDED);
  }
  seq.addElement(element);
}

Fixed version (ground truth):
/** 
 * Process a given XMLCompositeDirectCollectionMapping.
 * @param mapping
 * @param seq
 * @param ct
 * @param workingSchema
 */
protected void processXMLCompositeDirectCollectionMapping(XMLCompositeDirectCollectionMapping mapping,Sequence seq,ComplexType ct,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties){
  XMLField field=((XMLField)(mapping).getField());
  XPathFragment frag=field.getXPathFragment();
  seq=buildSchemaComponentsForXPath(frag,seq,schemaForNamespace,workingSchema,properties);
  frag=getTargetXPathFragment(frag);
  String schemaTypeString=getSchemaTypeForElement(field,mapping.getAttributeElementClass(),workingSchema);
  Element element;
  if (field.usesSingleNode()) {
    SimpleType st=new SimpleType();
    org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
    if (schemaTypeString == null) {
      schemaTypeString=getSchemaTypeString(XMLConstants.ANY_SIMPLE_TYPE_QNAME,workingSchema);
    }
    list.setItemType(schemaTypeString);
    st.setList(list);
    element=buildElement(field.getXPathFragment(),null,Occurs.ZERO,null);
    element.setSimpleType(st);
  }
 else {
    element=buildElement(field.getXPathFragment(),schemaTypeString,Occurs.ZERO,null);
    element.setMaxOccurs(Occurs.UNBOUNDED);
  }
  seq.addElement(element);
}
Program: 67492
Project: 67492
Buggy source:
/** 
 * Create and return a ComplexType for a given XMLDescriptor.
 * @param anonymous
 * @param desc
 * @param schemaForNamespace
 * @param workingSchema
 * @param properties
 * @param descriptors
 * @return
 */
protected ComplexType buildComplexType(boolean anonymous,XMLDescriptor desc,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties,List<XMLDescriptor> descriptors){
  ComplexType ct=new ComplexType();
  if (!anonymous) {
    ct.setName(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
  }
  InheritancePolicy inheritancePolicy=desc.getInheritancePolicyOrNull();
  Extension extension=null;
  if (inheritancePolicy != null && inheritancePolicy.getParentClass() != null) {
    extension=new Extension();
    extension.setBaseType(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
    ComplexContent complexContent=new ComplexContent();
    complexContent.setExtension(extension);
    ct.setComplexContent(complexContent);
  }
  Sequence seq=new Sequence();
  for (  DatabaseMapping mapping : desc.getMappings()) {
    processMapping(mapping,seq,ct,schemaForNamespace,workingSchema,properties,descriptors);
  }
  if (extension != null) {
    extension.setSequence(seq);
  }
 else {
    ct.setSequence(seq);
  }
  return ct;
}

Fixed version (ground truth):
/** 
 * Create and return a ComplexType for a given XMLDescriptor.  Assumes that the descriptor has a schema context set.
 * @param anonymous
 * @param desc
 * @param schemaForNamespace
 * @param workingSchema
 * @param properties
 * @param descriptors
 * @return
 */
protected ComplexType buildComplexType(boolean anonymous,XMLDescriptor desc,HashMap<String,Schema> schemaForNamespace,Schema workingSchema,SchemaModelGeneratorProperties properties,List<XMLDescriptor> descriptors){
  ComplexType ct=new ComplexType();
  if (!anonymous) {
    ct.setName(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
  }
  InheritancePolicy inheritancePolicy=desc.getInheritancePolicyOrNull();
  Extension extension=null;
  if (inheritancePolicy != null && inheritancePolicy.getParentClass() != null) {
    extension=new Extension();
    extension.setBaseType(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
    ComplexContent complexContent=new ComplexContent();
    complexContent.setExtension(extension);
    ct.setComplexContent(complexContent);
  }
  Sequence seq=new Sequence();
  for (  DatabaseMapping mapping : desc.getMappings()) {
    processMapping(mapping,seq,ct,schemaForNamespace,workingSchema,properties,descriptors);
  }
  if (extension != null) {
    extension.setSequence(seq);
  }
 else {
    ct.setSequence(seq);
  }
  return ct;
}
Program: 67493
Project: 67493
Buggy source:
/** 
 * Return the schema type as a string for a given QName and Schema.  The schema's  namespace resolver will be used to determine the prefix (if any) to use. 
 * @param schemaType
 * @param workingSchema
 * @return
 */
protected String getSchemaTypeString(QName schemaType,Schema workingSchema){
  String schemaTypeString=schemaType.getLocalPart();
  String uri=schemaType.getNamespaceURI();
  String prefix=workingSchema.getNamespaceResolver().resolveNamespaceURI(uri);
  if (prefix == null && !uri.equals(workingSchema.getDefaultNamespace())) {
    if (uri.equals(XMLConstants.SCHEMA_URL)) {
      prefix=workingSchema.getNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_PREFIX);
    }
 else     if (uri.equals(XMLConstants.SCHEMA_INSTANCE_URL)) {
      prefix=workingSchema.getNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    }
 else {
      prefix=workingSchema.getNamespaceResolver().generatePrefix();
    }
    workingSchema.getNamespaceResolver().put(prefix,uri);
  }
  if (prefix != null) {
    schemaTypeString=prefix + COLON + schemaTypeString;
  }
  return schemaTypeString;
}

Fixed version (ground truth):
/** 
 * Return the schema type as a string for a given QName and Schema.  The schema's  namespace resolver will be used to determine the prefix (if any) to use. 
 * @param schemaType
 * @param workingSchema
 * @return
 */
protected String getSchemaTypeString(QName schemaType,Schema workingSchema){
  String schemaTypeString=schemaType.getLocalPart();
  String uri=schemaType.getNamespaceURI();
  String prefix=workingSchema.getNamespaceResolver().resolveNamespaceURI(uri);
  if (prefix == null && !areNamespacesEqual(uri,workingSchema.getDefaultNamespace())) {
    if (uri.equals(XMLConstants.SCHEMA_URL)) {
      prefix=workingSchema.getNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_PREFIX);
    }
 else     if (uri.equals(XMLConstants.SCHEMA_INSTANCE_URL)) {
      prefix=workingSchema.getNamespaceResolver().generatePrefix(XMLConstants.SCHEMA_INSTANCE_PREFIX);
    }
 else {
      prefix=workingSchema.getNamespaceResolver().generatePrefix();
    }
    workingSchema.getNamespaceResolver().put(prefix,uri);
  }
  if (prefix != null) {
    schemaTypeString=prefix + COLON + schemaTypeString;
  }
  return schemaTypeString;
}
Program: 67494
Project: 67494
Buggy source:
/** 
 * Allow for the cache keys to be iterated on.
 */
public Enumeration keys(){
  return new IdentityMapKeyEnumeration(this);
}

Fixed version (ground truth):
/** 
 * Allow for the cache keys to be iterated on.
 * @param checkReadLocks - true if readLocks should be checked, false otherwise.
 */
public Enumeration keys(boolean checkReadLocks){
  return new IdentityMapKeyEnumeration(this,checkReadLocks);
}
Program: 67495
Project: 67495
Buggy source:
/** 
 * Allow for the CacheKeys to be iterated on.
 */
public Enumeration keys();

Fixed version (ground truth):
/** 
 * Allow for the CacheKeys to be iterated on.
 * @param checkReadLocks - true if readLocks should be checked, false otherwise.
 */
public Enumeration keys(boolean checkReadLocks);
Program: 67496
Project: 67496
Buggy source:
public IdentityMapKeyEnumeration(FullIdentityMap map){
  this.map=map;
  this.cacheKeysIterator=map.getCacheKeys().values().iterator();
}

Fixed version (ground truth):
public IdentityMapKeyEnumeration(FullIdentityMap map,boolean shouldCheckReadLocks){
  this.map=map;
  this.shouldCheckReadLocks=shouldCheckReadLocks;
  this.cacheKeysIterator=map.getCacheKeys().values().iterator();
}
Program: 67497
Project: 67497
Buggy source:
public Object nextElement(){
  if (this.nextKey == null) {
    throw new NoSuchElementException("String_Node_Str");
  }
  this.nextKey.checkReadLock();
  return this.nextKey;
}

Fixed version (ground truth):
public Object nextElement(){
  if (this.nextKey == null) {
    throw new NoSuchElementException("String_Node_Str");
  }
  if (shouldCheckReadLocks) {
    this.nextKey.checkReadLock();
  }
  return this.nextKey;
}
Program: 67498
Project: 67498
Buggy source:
/** 
 * Return an empty enumerator.
 */
public Enumeration keys(){
  return new Vector(1).elements();
}

Fixed version (ground truth):
/** 
 * Return an empty enumerator.
 */
public Enumeration keys(boolean shouldCheckReadLocks){
  return new Vector(1).elements();
}
Program: 67499
Project: 67499
Buggy source:
/** 
 * ADVANCED: Set all of the objects of a specific class to be invalid in the cache. User can set the recurse flag to false if they do not want to invalidate all the classes within an inheritance tree.
 */
public void invalidateClass(Class myClass,boolean recurse){
  IdentityMap identityMap=this.getIdentityMap(myClass);
  Enumeration keys=identityMap.keys();
  while (keys.hasMoreElements()) {
    CacheKey key=(CacheKey)keys.nextElement();
    Object obj=key.getObject();
    if (recurse || ((obj != null) && obj.getClass().equals(myClass))) {
      key.setInvalidationState(CacheKey.CACHE_KEY_INVALID);
    }
  }
}

Fixed version (ground truth):
/** 
 * ADVANCED: Set all of the objects of a specific class to be invalid in the cache. User can set the recurse flag to false if they do not want to invalidate all the classes within an inheritance tree.
 */
public void invalidateClass(Class myClass,boolean recurse){
  IdentityMap identityMap=this.getIdentityMap(myClass);
  Enumeration keys=identityMap.keys(false);
  while (keys.hasMoreElements()) {
    CacheKey key=(CacheKey)keys.nextElement();
    Object obj=key.getObject();
    if (recurse || ((obj != null) && obj.getClass().equals(myClass))) {
      key.setInvalidationState(CacheKey.CACHE_KEY_INVALID);
    }
  }
}
Program: 67503
Project: 67503
Buggy source:
/** 
 * Returns true if the field or method passed in is annotated with JAXB annotations.
 */
private boolean hasJAXBAnnotations(JavaHasAnnotations elem){
  if (helper.isAnnotationPresent(elem,XmlElement.class) || helper.isAnnotationPresent(elem,XmlAttribute.class) || helper.isAnnotationPresent(elem,XmlAnyElement.class)|| helper.isAnnotationPresent(elem,XmlAnyAttribute.class)|| helper.isAnnotationPresent(elem,XmlValue.class)|| helper.isAnnotationPresent(elem,XmlElements.class)|| helper.isAnnotationPresent(elem,XmlElementRef.class)|| helper.isAnnotationPresent(elem,XmlElementRefs.class)|| helper.isAnnotationPresent(elem,XmlID.class)|| helper.isAnnotationPresent(elem,XmlSchemaType.class)|| helper.isAnnotationPresent(elem,XmlElementWrapper.class)|| helper.isAnnotationPresent(elem,XmlID.class)|| helper.isAnnotationPresent(elem,XmlIDREF.class)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if the field or method passed in is annotated with JAXB annotations.
 */
private boolean hasJAXBAnnotations(JavaHasAnnotations elem){
  if (helper.isAnnotationPresent(elem,XmlElement.class) || helper.isAnnotationPresent(elem,XmlAttribute.class) || helper.isAnnotationPresent(elem,XmlAnyElement.class)|| helper.isAnnotationPresent(elem,XmlAnyAttribute.class)|| helper.isAnnotationPresent(elem,XmlValue.class)|| helper.isAnnotationPresent(elem,XmlElements.class)|| helper.isAnnotationPresent(elem,XmlElementRef.class)|| helper.isAnnotationPresent(elem,XmlElementRefs.class)|| helper.isAnnotationPresent(elem,XmlID.class)|| helper.isAnnotationPresent(elem,XmlSchemaType.class)|| helper.isAnnotationPresent(elem,XmlElementWrapper.class)|| helper.isAnnotationPresent(elem,XmlID.class)|| helper.isAnnotationPresent(elem,XmlList.class)|| helper.isAnnotationPresent(elem,XmlMimeType.class)|| helper.isAnnotationPresent(elem,XmlIDREF.class)) {
    return true;
  }
  return false;
}
Program: 67504
Project: 67504
Buggy source:
public void generateMappings(TypeInfo info,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  String[] propOrder=info.getPropOrder();
  if (propOrder.length == 0 || propOrder[0].equals("String_Node_Str")) {
    ArrayList<String> propertyNames=info.getPropertyNames();
    for (int i=0; i < propertyNames.size(); i++) {
      String nextPropertyKey=propertyNames.get(i);
      Property next=info.getProperties().get(nextPropertyKey);
      generateMapping(next,descriptor,namespaceInfo);
    }
  }
 else {
    for (int i=0; i < propOrder.length; i++) {
      Property next=info.getProperties().get(propOrder[i]);
      if (next != null) {
        generateMapping(next,descriptor,namespaceInfo);
      }
    }
  }
}

Fixed version (ground truth):
public void generateMappings(TypeInfo info,XMLDescriptor descriptor,NamespaceInfo namespaceInfo){
  List<Property> propertiesInOrder=info.getNonTransientPropertiesInPropOrder();
  for (int i=0; i < propertiesInOrder.size(); i++) {
    Property next=propertiesInOrder.get(i);
    if (next != null) {
      generateMapping(next,descriptor,namespaceInfo);
    }
  }
}
Program: 67505
Project: 67505
Buggy source:
public void populateSchemaTypes(){
  Iterator<String> classNames=typeInfo.keySet().iterator();
  while (classNames.hasNext()) {
    String javaClassName=classNames.next();
    TypeInfo info=(TypeInfo)typeInfo.get(javaClassName);
    if (info.isComplexType()) {
      if (info.getSchema() != null) {
        ComplexType type=info.getComplexType();
        TypeDefParticle compositor=info.getCompositor();
        String[] propOrder=info.getPropOrder();
        if (propOrder.length == 0 || propOrder[0].equals("String_Node_Str")) {
          propOrder=(String[])info.getPropertyNames().toArray(new String[info.getPropertyNames().size()]);
        }
        ArrayList<Property> properties=new ArrayList(propOrder.length);
        for (int i=0; i < propOrder.length; i++) {
          Property next=info.getProperties().get(propOrder[i]);
          properties.add(next);
        }
        addToSchemaType(properties,compositor,type,info.getSchema());
      }
    }
  }
}

Fixed version (ground truth):
public void populateSchemaTypes(){
  Iterator<String> classNames=typeInfo.keySet().iterator();
  while (classNames.hasNext()) {
    String javaClassName=classNames.next();
    TypeInfo info=(TypeInfo)typeInfo.get(javaClassName);
    if (info.isComplexType()) {
      if (info.getSchema() != null) {
        addToSchemaType(info.getNonTransientPropertiesInPropOrder(),info.getCompositor(),info.getComplexType(),info.getSchema());
      }
    }
  }
}
Program: 67509
Project: 67509
Buggy source:
public String getSchemaTypeNameForClassName(String className){
  String typeName="String_Node_Str";
  if (className.indexOf('$') != -1) {
    typeName=Introspector.decapitalize(className.substring(className.lastIndexOf('$') + 1));
  }
 else {
    typeName=Introspector.decapitalize(className.substring(className.lastIndexOf('.') + 1));
  }
  boolean inBreak=false;
  StringBuffer toReturn=new StringBuffer(typeName.length());
  for (int i=0; i < typeName.length(); i++) {
    char next=typeName.charAt(i);
    if (Character.isDigit(next)) {
      if (!inBreak) {
        inBreak=true;
      }
      toReturn.append(next);
    }
 else {
      if (inBreak) {
        toReturn.append(Character.toUpperCase(next));
      }
 else {
        toReturn.append(next);
      }
    }
  }
  return toReturn.toString();
}

Fixed version (ground truth):
public String getSchemaTypeNameForClassName(String className){
  String typeName="String_Node_Str";
  if (className.indexOf('$') != -1) {
    typeName=decapitalize(className.substring(className.lastIndexOf('$') + 1));
  }
 else {
    typeName=decapitalize(className.substring(className.lastIndexOf('.') + 1));
  }
  boolean inBreak=false;
  StringBuffer toReturn=new StringBuffer(typeName.length());
  for (int i=0; i < typeName.length(); i++) {
    char next=typeName.charAt(i);
    if (Character.isDigit(next)) {
      if (!inBreak) {
        inBreak=true;
      }
      toReturn.append(next);
    }
 else {
      if (inBreak) {
        toReturn.append(Character.toUpperCase(next));
      }
 else {
        toReturn.append(next);
      }
    }
  }
  return toReturn.toString();
}
Program: 67511
Project: 67511
Buggy source:
public QName getSchemaTypeFor(JavaClass javaClass){
  QName schemaType=(QName)userDefinedSchemaTypes.get(javaClass.getQualifiedName());
  if (schemaType == null) {
    schemaType=(QName)helper.getXMLToJavaTypeMap().get(javaClass.getRawName());
  }
  if (schemaType == null) {
    TypeInfo targetInfo=this.typeInfo.get(javaClass.getQualifiedName());
    if (targetInfo != null) {
      schemaType=new QName(targetInfo.getClassNamespace(),targetInfo.getSchemaTypeName());
    }
  }
  if (schemaType == null) {
    return XMLConstants.ANY_SIMPLE_TYPE_QNAME;
  }
  return schemaType;
}

Fixed version (ground truth):
public QName getSchemaTypeFor(JavaClass javaClass){
  QName schemaType=(QName)userDefinedSchemaTypes.get(javaClass.getQualifiedName());
  if (schemaType == null) {
    schemaType=(QName)helper.getXMLToJavaTypeMap().get(javaClass.getRawName());
  }
  if (schemaType == null) {
    TypeInfo targetInfo=this.typeInfo.get(javaClass.getQualifiedName());
    if (targetInfo != null) {
      schemaType=new QName(targetInfo.getClassNamespace(),targetInfo.getSchemaTypeName());
    }
  }
  if (schemaType == null) {
    if (javaClass.getQualifiedName().equals("String_Node_Str")) {
      return XMLConstants.ANY_TYPE_QNAME;
    }
    return XMLConstants.ANY_SIMPLE_TYPE_QNAME;
  }
  return schemaType;
}
Program: 67512
Project: 67512
Buggy source:
/** 
 * Builds a map of Java types to XML types.
 * @return
 */
private HashMap buildXMLToJavaTypeMap(){
  HashMap javaTypes=new HashMap();
  javaTypes.put(APBYTE,XMLConstants.HEX_BINARY_QNAME);
  javaTypes.put(BIGDECIMAL,XMLConstants.DECIMAL_QNAME);
  javaTypes.put(BIGINTEGER,XMLConstants.INTEGER_QNAME);
  javaTypes.put(PBOOLEAN,XMLConstants.BOOLEAN_QNAME);
  javaTypes.put(PBYTE,XMLConstants.BYTE_QNAME);
  javaTypes.put(CALENDAR,XMLConstants.DATE_TIME_QNAME);
  javaTypes.put(PDOUBLE,XMLConstants.DOUBLE_QNAME);
  javaTypes.put(PFLOAT,XMLConstants.FLOAT_QNAME);
  javaTypes.put(PINT,XMLConstants.INT_QNAME);
  javaTypes.put(PLONG,XMLConstants.LONG_QNAME);
  javaTypes.put(PSHORT,XMLConstants.SHORT_QNAME);
  javaTypes.put(QNAME_CLASS,XMLConstants.QNAME_QNAME);
  javaTypes.put(STRING,XMLConstants.STRING_QNAME);
  javaTypes.put(ABYTE,XMLConstants.HEX_BINARY_QNAME);
  javaTypes.put(BOOLEAN,XMLConstants.BOOLEAN_QNAME);
  javaTypes.put(BYTE,XMLConstants.BYTE_QNAME);
  javaTypes.put(GREGORIAN_CALENDAR,XMLConstants.DATE_TIME_QNAME);
  javaTypes.put(DOUBLE,XMLConstants.DOUBLE_QNAME);
  javaTypes.put(FLOAT,XMLConstants.FLOAT_QNAME);
  javaTypes.put(INTEGER,XMLConstants.INT_QNAME);
  javaTypes.put(LONG,XMLConstants.LONG_QNAME);
  javaTypes.put(SHORT,XMLConstants.SHORT_QNAME);
  javaTypes.put(UTIL_DATE,XMLConstants.DATE_TIME_QNAME);
  javaTypes.put(XMLGREGORIANCALENDAR,XMLConstants.ANY_SIMPLE_TYPE_QNAME);
  javaTypes.put(DURATION,XMLConstants.DURATION_QNAME);
  return javaTypes;
}

Fixed version (ground truth):
/** 
 * Builds a map of Java types to XML types.
 * @return
 */
private HashMap buildXMLToJavaTypeMap(){
  HashMap javaTypes=new HashMap();
  javaTypes.put(APBYTE,XMLConstants.HEX_BINARY_QNAME);
  javaTypes.put(BIGDECIMAL,XMLConstants.DECIMAL_QNAME);
  javaTypes.put(BIGINTEGER,XMLConstants.INTEGER_QNAME);
  javaTypes.put(PBOOLEAN,XMLConstants.BOOLEAN_QNAME);
  javaTypes.put(PBYTE,XMLConstants.BYTE_QNAME);
  javaTypes.put(CALENDAR,XMLConstants.DATE_TIME_QNAME);
  javaTypes.put(PDOUBLE,XMLConstants.DOUBLE_QNAME);
  javaTypes.put(PFLOAT,XMLConstants.FLOAT_QNAME);
  javaTypes.put(PINT,XMLConstants.INT_QNAME);
  javaTypes.put(PLONG,XMLConstants.LONG_QNAME);
  javaTypes.put(PSHORT,XMLConstants.SHORT_QNAME);
  javaTypes.put(QNAME_CLASS,XMLConstants.QNAME_QNAME);
  javaTypes.put(STRING,XMLConstants.STRING_QNAME);
  javaTypes.put(ABYTE,XMLConstants.HEX_BINARY_QNAME);
  javaTypes.put(BOOLEAN,XMLConstants.BOOLEAN_QNAME);
  javaTypes.put(BYTE,XMLConstants.BYTE_QNAME);
  javaTypes.put(GREGORIAN_CALENDAR,XMLConstants.DATE_TIME_QNAME);
  javaTypes.put(DOUBLE,XMLConstants.DOUBLE_QNAME);
  javaTypes.put(FLOAT,XMLConstants.FLOAT_QNAME);
  javaTypes.put(INTEGER,XMLConstants.INT_QNAME);
  javaTypes.put(LONG,XMLConstants.LONG_QNAME);
  javaTypes.put(SHORT,XMLConstants.SHORT_QNAME);
  javaTypes.put(UTIL_DATE,XMLConstants.DATE_TIME_QNAME);
  javaTypes.put(XMLGREGORIANCALENDAR,XMLConstants.ANY_SIMPLE_TYPE_QNAME);
  javaTypes.put(DURATION,XMLConstants.DURATION_QNAME);
  javaTypes.put(UUID,XMLConstants.STRING_QNAME);
  return javaTypes;
}
Program: 67513
Project: 67513
Buggy source:
public XMLBinder(XMLContext context){
  unmarshaller=context.createUnmarshaller();
  saxUnmarshaller=new SAXUnmarshaller(unmarshaller);
  this.context=context;
  documentPreservationPolicy=new XMLBinderPolicy();
  reader=new DOMReader();
}

Fixed version (ground truth):
public XMLBinder(XMLContext context){
  marshaller=context.createMarshaller();
  unmarshaller=context.createUnmarshaller();
  saxUnmarshaller=new SAXUnmarshaller(unmarshaller);
  this.context=context;
  documentPreservationPolicy=new XMLBinderPolicy();
  reader=new DOMReader();
}
Program: 67514
Project: 67514
Buggy source:
public Object getProperty(String propName){
  return null;
}

Fixed version (ground truth):
public Object getProperty(String propName) throws PropertyException {
  if (null == propName) {
    throw new IllegalArgumentException();
  }
  if (propName.equals(Marshaller.JAXB_ENCODING)) {
    return this.xmlBinder.getMarshaller().getEncoding();
  }
  if (propName.equals(Marshaller.JAXB_FORMATTED_OUTPUT)) {
    return this.xmlBinder.getMarshaller().isFormattedOutput();
  }
  if (propName.equals(Marshaller.JAXB_FRAGMENT)) {
    return this.xmlBinder.getMarshaller().isFragment();
  }
  if (propName.equals(Marshaller.JAXB_SCHEMA_LOCATION)) {
    return this.xmlBinder.getMarshaller().getSchemaLocation();
  }
  if (propName.equals(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION)) {
    return this.xmlBinder.getMarshaller().getNoNamespaceSchemaLocation();
  }
  throw new PropertyException(propName);
}
Program: 67515
Project: 67515
Buggy source:
public ValidationEventHandler getEventHandler(){
  return null;
}

Fixed version (ground truth):
public ValidationEventHandler getEventHandler(){
  JAXBErrorHandler jaxbErrorHandler=(JAXBErrorHandler)xmlBinder.getUnmarshaller().getErrorHandler();
  return jaxbErrorHandler.getValidationEventHandler();
}
Program: 67516
Project: 67516
Buggy source:
public void setSchema(Schema schema){
}

Fixed version (ground truth):
public void setSchema(Schema schema){
  this.xmlBinder.setSchema(schema);
}
Program: 67517
Project: 67517
Buggy source:
public Schema getSchema(){
  return null;
}

Fixed version (ground truth):
public Schema getSchema(){
  return this.xmlBinder.getSchema();
}
Program: 67518
Project: 67518
Buggy source:
public JAXBBinder(XMLContext xmlContext){
  this.xmlContext=xmlContext;
  this.xmlBinder=this.xmlContext.createBinder();
  this.xmlBinder.getDocumentPreservationPolicy().setNodeOrderingPolicy(new org.eclipse.persistence.oxm.documentpreservation.IgnoreNewElementsOrderingPolicy());
}

Fixed version (ground truth):
public JAXBBinder(XMLContext xmlContext){
  this.xmlContext=xmlContext;
  this.xmlBinder=this.xmlContext.createBinder();
  this.xmlBinder.getDocumentPreservationPolicy().setNodeOrderingPolicy(new org.eclipse.persistence.oxm.documentpreservation.IgnoreNewElementsOrderingPolicy());
  this.xmlBinder.getUnmarshaller().setErrorHandler(new JAXBErrorHandler(new DefaultValidationEventHandler()));
}
Program: 67519
Project: 67519
Buggy source:
public void setProperty(String propName,Object value){
}

Fixed version (ground truth):
public void setProperty(String propName,Object value) throws PropertyException {
  if (null == propName) {
    throw new IllegalArgumentException(propName);
  }
  String valueString=(value == null) ? null : value.toString();
  if (propName.equals(Marshaller.JAXB_ENCODING)) {
    this.xmlBinder.getMarshaller().setEncoding(valueString);
    return;
  }
  if (propName.equals(Marshaller.JAXB_FORMATTED_OUTPUT)) {
    this.xmlBinder.getMarshaller().setFormattedOutput(Boolean.valueOf(valueString).booleanValue());
    return;
  }
  if (propName.equals(Marshaller.JAXB_FRAGMENT)) {
    this.xmlBinder.getMarshaller().setFragment(Boolean.valueOf(valueString).booleanValue());
    return;
  }
  if (propName.equals(Marshaller.JAXB_SCHEMA_LOCATION)) {
    this.xmlBinder.getMarshaller().setSchemaLocation(valueString);
    return;
  }
  if (propName.equals(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION)) {
    this.xmlBinder.getMarshaller().setNoNamespaceSchemaLocation(valueString);
    return;
  }
  throw new PropertyException(propName);
}
Program: 67520
Project: 67520
Buggy source:
public void setEventHandler(ValidationEventHandler handler){
}

Fixed version (ground truth):
public void setEventHandler(ValidationEventHandler handler){
  if (null == handler) {
    xmlBinder.getUnmarshaller().setErrorHandler(new JAXBErrorHandler(new DefaultValidationEventHandler()));
  }
 else {
    xmlBinder.getUnmarshaller().setErrorHandler(new JAXBErrorHandler(handler));
  }
}
Program: 67521
Project: 67521
Buggy source:
public void setSchema(Schema schema){
}

Fixed version (ground truth):
public void setSchema(Schema schema){
  this.xmlMarshaller.setSchema(schema);
}
Program: 67522
Project: 67522
Buggy source:
public Schema getSchema(){
  try {
    return SchemaFactory.newInstance(XMLConstants.SCHEMA_URL).newSchema();
  }
 catch (  org.xml.sax.SAXException ex) {
  }
  return null;
}

Fixed version (ground truth):
public Schema getSchema(){
  return xmlMarshaller.getSchema();
}
Program: 67523
Project: 67523
Buggy source:
/** 
 * INTERNAL:
 */
protected synchronized void initializeConnectionData(Connection conn) throws SQLException {
  if (isConnectionDataInitialized) {
    return;
  }
  driverVersion=conn.getMetaData().getDriverVersion();
  shouldPrintCalendar=driverVersion.startsWith("String_Node_Str") || driverVersion.startsWith("String_Node_Str");
  if (Helper.compareVersions(driverVersion,"String_Node_Str") < 0) {
    isTimestampInGmt=false;
  }
 else {
    if (conn instanceof OracleConnection) {
      String timestampTzInGmtPropStr=((OracleConnection)conn).getProperties().getProperty("String_Node_Str","String_Node_Str");
      isTimestampInGmt=timestampTzInGmtPropStr.equalsIgnoreCase("String_Node_Str");
    }
 else {
      isTimestampInGmt=true;
    }
  }
  isConnectionDataInitialized=true;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
protected synchronized void initializeConnectionData(Connection conn) throws SQLException {
  if (isConnectionDataInitialized) {
    return;
  }
  driverVersion=conn.getMetaData().getDriverVersion();
  shouldPrintCalendar=Helper.compareVersions("String_Node_Str",driverVersion) <= 0 && Helper.compareVersions(driverVersion,"String_Node_Str") < 0;
  if (Helper.compareVersions(driverVersion,"String_Node_Str") < 0) {
    isTimestampInGmt=false;
  }
 else {
    if (conn instanceof OracleConnection) {
      String timestampTzInGmtPropStr=((OracleConnection)conn).getProperties().getProperty("String_Node_Str","String_Node_Str");
      isTimestampInGmt=timestampTzInGmtPropStr.equalsIgnoreCase("String_Node_Str");
    }
 else {
      isTimestampInGmt=true;
    }
  }
  isConnectionDataInitialized=true;
}
Program: 67524
Project: 67524
Buggy source:
/** 
 * PUBLIC: Connect to the database using the predefined login. During connection, attempt to auto detect the required database platform. This method can be used in systems where for ease of use developers have EclipseLink autodetect the platform. To be safe, however, the platform should be configured directly. The login must have been assigned when or after creating the session.
 */
public void loginAndDetectDatasource() throws DatabaseException {
  preConnectDatasource();
  Connection conn=null;
  try {
    conn=(Connection)getReadLogin().connectToDatasource(null,this);
    this.platform=null;
    String platformName=null;
    try {
      platformName=DBPlatformHelper.getDBPlatform(conn.getMetaData().getDatabaseProductName(),getSessionLog());
      getLogin().setPlatformClassName(platformName);
    }
 catch (    EclipseLinkException classNotFound) {
      if (platformName.indexOf("String_Node_Str") != -1) {
        getLogin().setPlatform(new OraclePlatform());
      }
 else {
        throw classNotFound;
      }
    }
  }
 catch (  SQLException ex) {
    DatabaseException dbEx=DatabaseException.errorRetrieveDbMetadataThroughJDBCConnection();
    dbEx.initCause(ex);
    throw dbEx;
  }
 finally {
    if (conn != null) {
      try {
        conn.close();
      }
 catch (      SQLException ex) {
        DatabaseException dbEx=DatabaseException.errorRetrieveDbMetadataThroughJDBCConnection();
        dbEx.initCause(ex);
        throw dbEx;
      }
    }
  }
  connect();
  postConnectDatasource();
}

Fixed version (ground truth):
/** 
 * PUBLIC: Connect to the database using the predefined login. During connection, attempt to auto detect the required database platform. This method can be used in systems where for ease of use developers have EclipseLink autodetect the platform. To be safe, however, the platform should be configured directly. The login must have been assigned when or after creating the session.
 */
public void loginAndDetectDatasource() throws DatabaseException {
  preConnectDatasource();
  Connection conn=null;
  try {
    conn=(Connection)getReadLogin().connectToDatasource(null,this);
    this.platform=null;
    String platformName=null;
    try {
      platformName=DBPlatformHelper.getDBPlatform(conn.getMetaData().getDatabaseProductName(),getSessionLog());
      getLogin().setPlatformClassName(platformName);
    }
 catch (    EclipseLinkException classNotFound) {
      if (platformName.indexOf("String_Node_Str") != -1) {
        getLogin().setPlatformClassName(OraclePlatform.class.getName());
      }
 else {
        throw classNotFound;
      }
    }
  }
 catch (  SQLException ex) {
    DatabaseException dbEx=DatabaseException.errorRetrieveDbMetadataThroughJDBCConnection();
    dbEx.initCause(ex);
    throw dbEx;
  }
 finally {
    if (conn != null) {
      try {
        conn.close();
      }
 catch (      SQLException ex) {
        DatabaseException dbEx=DatabaseException.errorRetrieveDbMetadataThroughJDBCConnection();
        dbEx.initCause(ex);
        throw dbEx;
      }
    }
  }
  connect();
  postConnectDatasource();
}
Program: 67525
Project: 67525
Buggy source:
/** 
 * INTERNAL: Compares the value from the row and from the object (or cache). Will return true if the object is newer than the row.
 */
public boolean isNewerVersion(AbstractRecord databaseRow,Object domainObject,java.util.Vector primaryKey,AbstractSession session){
  java.sql.Timestamp writeLockFieldValue;
  java.sql.Timestamp newWriteLockFieldValue=(java.sql.Timestamp)session.getDatasourcePlatform().convertObject(databaseRow.get(getWriteLockField()),ClassConstants.TIMESTAMP);
  if (isStoredInCache()) {
    writeLockFieldValue=(java.sql.Timestamp)session.getIdentityMapAccessorInstance().getWriteLockValue(primaryKey,domainObject.getClass(),getDescriptor());
  }
 else {
    writeLockFieldValue=(java.sql.Timestamp)lockValueFromObject(domainObject);
  }
  if (writeLockFieldValue == null) {
    return false;
  }
  if (newWriteLockFieldValue == null) {
    return true;
  }
  if (!(newWriteLockFieldValue.after(writeLockFieldValue))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Compares two values. Will return true if the firstLockFieldValue is newer than the secondWriteLockFieldValue.
 */
public boolean isNewerVersion(Object firstLockFieldValue,Object secondWriteLockFieldValue){
  java.sql.Timestamp firstValue=(java.sql.Timestamp)firstLockFieldValue;
  java.sql.Timestamp secondValue=(java.sql.Timestamp)secondWriteLockFieldValue;
  if (firstValue == null) {
    return false;
  }
  if (secondValue == null) {
    return true;
  }
  if (firstValue.after(secondValue)) {
    return true;
  }
  return false;
}
Program: 67526
Project: 67526
Buggy source:
/** 
 * INTERNAL: Compares the value from the row and from the object (or cache). Will return true if the object is newer than the row.
 */
public boolean isNewerVersion(AbstractRecord databaseRow,Object domainObject,java.util.Vector primaryKey,AbstractSession session){
  Number writeLockFieldValue;
  Number newWriteLockFieldValue=(Number)databaseRow.get(getWriteLockField());
  if (isStoredInCache()) {
    writeLockFieldValue=(Number)session.getIdentityMapAccessorInstance().getWriteLockValue(primaryKey,domainObject.getClass(),getDescriptor());
  }
 else {
    writeLockFieldValue=(Number)lockValueFromObject(domainObject);
  }
  if (writeLockFieldValue == null) {
    return false;
  }
  if (newWriteLockFieldValue == null) {
    return true;
  }
  if (newWriteLockFieldValue.longValue() <= writeLockFieldValue.longValue()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Compares two values. Will return true if the firstLockFieldValue is newer than the secondWriteLockFieldValue.
 */
public boolean isNewerVersion(Object firstLockFieldValue,Object secondWriteLockFieldValue){
  Number firstValue=(Number)firstLockFieldValue;
  Number secondValue=(Number)secondWriteLockFieldValue;
  if (firstValue == null) {
    return false;
  }
  if (secondValue == null) {
    return true;
  }
  if (firstValue.longValue() > secondValue.longValue()) {
    return true;
  }
  return false;
}