nus-yam/ex-repair huggingface dataset:
Program: 67060
Project: 67060
Buggy source:
/** 
 * Build a valid Integer instance from a String or another Number instance.
 * @caught exception    The Integer(String) constructor throws aNumberFormatException if the String does not contain a parsable integer.
 */
protected Integer convertObjectToInteger(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToInteger(((String)sourceObject).substring(1));
  }
  return super.convertObjectToInteger(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid Integer instance from a String or another Number instance.
 * @caught exception    The Integer(String) constructor throws aNumberFormatException if the String does not contain a parsable integer.
 */
protected Integer convertObjectToInteger(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToInteger(((String)sourceObject).substring(1));
  }
  return super.convertObjectToInteger(sourceObject);
}
Program: 67061
Project: 67061
Buggy source:
/** 
 * INTERNAL: Build a valid Short instance from a String or another Number instance.
 * @caught exception    The Short(String) constructor throws aNumberFormatException if the String does not contain a parsable short.
 */
protected Short convertObjectToShort(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToShort(((String)sourceObject).substring(1));
  }
  return super.convertObjectToShort(sourceObject);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Build a valid Short instance from a String or another Number instance.
 * @caught exception    The Short(String) constructor throws aNumberFormatException if the String does not contain a parsable short.
 */
protected Short convertObjectToShort(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToShort(((String)sourceObject).substring(1));
  }
  return super.convertObjectToShort(sourceObject);
}
Program: 67062
Project: 67062
Buggy source:
/** 
 * Build a valid instance of BigDecimal from the given sourceObject
 * @param sourceObject    Valid instance of String, BigInteger, any Number
 */
protected BigDecimal convertObjectToBigDecimal(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToBigDecimal(((String)sourceObject).substring(1));
  }
  return super.convertObjectToBigDecimal(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid instance of BigDecimal from the given sourceObject
 * @param sourceObject    Valid instance of String, BigInteger, any Number
 */
protected BigDecimal convertObjectToBigDecimal(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToBigDecimal(((String)sourceObject).substring(1));
  }
  return super.convertObjectToBigDecimal(sourceObject);
}
Program: 67063
Project: 67063
Buggy source:
/** 
 * Build a valid instance of Byte from the provided sourceObject
 * @param sourceObject    Valid instance of String or any Number
 * @caught exception        The Byte(String) constructor throws aNumberFormatException if the String does not contain a parsable byte.
 */
protected Byte convertObjectToByte(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToByte(((String)sourceObject).substring(1));
  }
  return super.convertObjectToByte(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid instance of Byte from the provided sourceObject
 * @param sourceObject    Valid instance of String or any Number
 * @caught exception        The Byte(String) constructor throws aNumberFormatException if the String does not contain a parsable byte.
 */
protected Byte convertObjectToByte(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToByte(((String)sourceObject).substring(1));
  }
  return super.convertObjectToByte(sourceObject);
}
Program: 67064
Project: 67064
Buggy source:
/** 
 * Build a valid Long instance from a String or another Number instance.
 * @caught exception    The Long(String) constructor throws aNumberFormatException if the String does not contain a parsable long.
 */
protected Long convertObjectToLong(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToLong(((String)sourceObject).substring(1));
  }
  return super.convertObjectToLong(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid Long instance from a String or another Number instance.
 * @caught exception    The Long(String) constructor throws aNumberFormatException if the String does not contain a parsable long.
 */
protected Long convertObjectToLong(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToLong(((String)sourceObject).substring(1));
  }
  return super.convertObjectToLong(sourceObject);
}
Program: 67065
Project: 67065
Buggy source:
/** 
 * Build a valid instance of BigInteger from the provided sourceObject.
 * @param sourceObject    Valid instance of String, BigDecimal, or any Number
 */
protected BigInteger convertObjectToBigInteger(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToBigInteger(((String)sourceObject).substring(1));
  }
  return super.convertObjectToBigInteger(sourceObject);
}

Fixed version (ground truth):
/** 
 * Build a valid instance of BigInteger from the provided sourceObject.
 * @param sourceObject    Valid instance of String, BigDecimal, or any Number
 */
protected BigInteger convertObjectToBigInteger(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToBigInteger(((String)sourceObject).substring(1));
  }
  return super.convertObjectToBigInteger(sourceObject);
}
Program: 67066
Project: 67066
Buggy source:
/** 
 * INTERNAL: Build a valid BigDecimal instance from a String or another Number instance.  BigDecimal is the most general type so is must be returned when an object is converted to a number.
 * @caught exception    The BigDecimal(String) constructor throws aNumberFormatException if the String does not contain a parsable BigDecimal.
 */
protected BigDecimal convertObjectToNumber(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).startsWith(PLUS)) {
    return super.convertObjectToNumber(((String)sourceObject).substring(1));
  }
  return super.convertObjectToNumber(sourceObject);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Build a valid BigDecimal instance from a String or another Number instance.  BigDecimal is the most general type so is must be returned when an object is converted to a number.
 * @caught exception    The BigDecimal(String) constructor throws aNumberFormatException if the String does not contain a parsable BigDecimal.
 */
protected BigDecimal convertObjectToNumber(Object sourceObject) throws ConversionException {
  if (sourceObject instanceof String && ((String)sourceObject).length() > 0 && ((String)sourceObject).charAt(0) == PLUS) {
    return super.convertObjectToNumber(((String)sourceObject).substring(1));
  }
  return super.convertObjectToNumber(sourceObject);
}
Program: 67067
Project: 67067
Buggy source:
public void setXPath(String xpathString){
  xpath=xpathString;
  if ((xpath.indexOf('[') != -1) && (xpath.indexOf(']') == -1)) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  if (xpath.indexOf("String_Node_Str") != -1) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  shortName=xpathString;
  int attrindex=xpathString.indexOf(XMLConstants.ATTRIBUTE);
  if (attrindex == 0) {
    hasAttribute=true;
    shortName=xpathString.substring(attrindex + 1);
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.startsWith("String_Node_Str")) {
    setShouldExecuteSelectNodes(true);
    shortName=xpathString;
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.equals(XMLConstants.TEXT)) {
    nameIsText=true;
    shortName=xpathString;
    return;
  }
 else {
    nameIsText=false;
  }
  if (xpathString.equals("String_Node_Str")) {
    isSelfFragment=true;
    shortName=xpathString;
    return;
  }
  indexValue=hasIndex(xpathString);
  setupNamespaceInformation(shortName);
}

Fixed version (ground truth):
public void setXPath(String xpathString){
  xpath=xpathString;
  if (xpathString.length() == 0) {
    return;
  }
  if ((xpath.indexOf('[') != -1) && (xpath.indexOf(']') == -1)) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  if (xpath.indexOf("String_Node_Str") != -1) {
    setShouldExecuteSelectNodes(true);
    return;
  }
  shortName=xpathString;
  if (xpathString.charAt(0) == '@') {
    hasAttribute=true;
    shortName=xpathString.substring(1);
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.charAt(0) == '/') {
    setShouldExecuteSelectNodes(true);
    shortName=xpathString;
    indexValue=hasIndex(xpathString);
    setupNamespaceInformation(shortName);
    return;
  }
  if (xpathString.equals(XMLConstants.TEXT)) {
    nameIsText=true;
    shortName=xpathString;
    return;
  }
 else {
    nameIsText=false;
  }
  if (xpathString.equals(SELF_XPATH)) {
    isSelfFragment=true;
    shortName=xpathString;
    return;
  }
  indexValue=hasIndex(xpathString);
  setupNamespaceInformation(shortName);
}
Program: 67069
Project: 67069
Buggy source:
/** 
 * Return the qualified XML Schema type for a given class
 * @param javaClass The class to use as a key in the lookup
 * @return QName The qualified XML Schema type, if no corresponding match found returns null
 */
public QName getXMLType(Class javaClass){
  if (userJavaTypes != null) {
    if (userJavaTypes.containsKey(javaClass)) {
      return (QName)userJavaTypes.get(javaClass);
    }
  }
  return (QName)XMLConversionManager.getDefaultJavaTypes().get(javaClass);
}

Fixed version (ground truth):
/** 
 * Return the qualified XML Schema type for a given class
 * @param javaClass The class to use as a key in the lookup
 * @return QName The qualified XML Schema type, if no corresponding match found returns null
 */
public QName getXMLType(Class javaClass){
  if (userJavaTypes != null) {
    QName theQName=(QName)userJavaTypes.get(javaClass);
    if (theQName != null) {
      return theQName;
    }
  }
  return (QName)XMLConversionManager.getDefaultJavaTypes().get(javaClass);
}
Program: 67070
Project: 67070
Buggy source:
/** 
 * Return the class for a given qualified XML Schema type
 * @param qname The qualified name of the XML Schema type to use as a key in the lookup
 * @return The class corresponding to the specified schema type, if no corresponding match found returns null
 */
public Class getJavaClass(QName qname){
  if (userXMLTypes != null) {
    if (userXMLTypes.containsKey(qname)) {
      return (Class)userXMLTypes.get(qname);
    }
  }
  return (Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
}

Fixed version (ground truth):
/** 
 * Return the class for a given qualified XML Schema type
 * @param qname The qualified name of the XML Schema type to use as a key in the lookup
 * @return The class corresponding to the specified schema type, if no corresponding match found returns null
 */
public Class getJavaClass(QName qname){
  if (userXMLTypes != null) {
    Class theClass=(Class)userXMLTypes.get(qname);
    if (theClass != null) {
      return theClass;
    }
  }
  return (Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
}
Program: 67071
Project: 67071
Buggy source:
/** 
 * Default constructor, create a new XMLField based on the specified xPath
 * @param xPath The xPath statement for this field
 */
public XMLField(String xPath){
  super();
  isTypedTextField=false;
  setXPath(xPath);
}

Fixed version (ground truth):
/** 
 * Default constructor, create a new XMLField based on the specified xPath
 * @param xPath The xPath statement for this field
 */
public XMLField(String xPath){
  super(xPath,new DatabaseTable());
  isTypedTextField=false;
}
Program: 67072
Project: 67072
Buggy source:
/** 
 * Return the class for a given qualified XML Schema type. If the class is a primitive the corresponding wrapper class is returned
 * @param qname The qualified name of the XML Schema type to use as a key in the lookup
 * @return The class associated with the specified schema type, if no corresponding match found returns null
 */
public Class getJavaClass(QName qname){
  if (userXMLTypes != null) {
    if (userXMLTypes.containsKey(qname)) {
      return (Class)userXMLTypes.get(qname);
    }
  }
  Class javaClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
  return XMLConversionManager.getObjectClass(javaClass);
}

Fixed version (ground truth):
/** 
 * Return the class for a given qualified XML Schema type. If the class is a primitive the corresponding wrapper class is returned
 * @param qname The qualified name of the XML Schema type to use as a key in the lookup
 * @return The class associated with the specified schema type, if no corresponding match found returns null
 */
public Class getJavaClass(QName qname){
  if (userXMLTypes != null) {
    Class theClass=(Class)userXMLTypes.get(qname);
    if (theClass != null) {
      return theClass;
    }
  }
  Class javaClass=(Class)XMLConversionManager.getDefaultXMLTypes().get(qname);
  return XMLConversionManager.getObjectClass(javaClass);
}
Program: 67073
Project: 67073
Buggy source:
/** 
 * INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete.
 * @param record
 * @param xmlField
 * @param object
 * @param session
 * @return
 */
public void buildReference(UnmarshalRecord record,XMLField xmlField,Object object,AbstractSession session){
  ReferenceResolver resolver=ReferenceResolver.getInstance(session);
  if (resolver == null) {
    return;
  }
  Object srcObject=record.getCurrentObject();
  Reference reference=resolver.getReference(this,srcObject);
  if (reference == null) {
    reference=new Reference(this,srcObject,getReferenceClass(),new HashMap());
    resolver.addReference(reference);
  }
  XMLField tgtFld=(XMLField)getSourceToTargetKeyFieldAssociations().get(xmlField);
  String tgtXPath=tgtFld.getXPath();
  Vector pks;
  HashMap primaryKeyMap=reference.getPrimaryKeyMap();
  if (primaryKeyMap.containsKey(tgtXPath)) {
    pks=(Vector)primaryKeyMap.get(tgtXPath);
  }
 else {
    pks=new Vector();
    primaryKeyMap.put(tgtXPath,pks);
  }
  ClassDescriptor descriptor=session.getClassDescriptor(getReferenceClass());
  Class type=descriptor.getTypedField(tgtFld).getType();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
  for (StringTokenizer stok=new StringTokenizer((String)object); stok.hasMoreTokens(); ) {
    Object value=xmlConversionManager.convertObject(stok.nextToken(),type);
    if (value != null) {
      pks.add(value);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete.
 * @param record
 * @param xmlField
 * @param object
 * @param session
 * @return
 */
public void buildReference(UnmarshalRecord record,XMLField xmlField,Object object,AbstractSession session){
  ReferenceResolver resolver=ReferenceResolver.getInstance(session);
  if (resolver == null) {
    return;
  }
  Object srcObject=record.getCurrentObject();
  Reference reference=resolver.getReference(this,srcObject);
  if (reference == null) {
    reference=new Reference(this,srcObject,getReferenceClass(),new HashMap());
    resolver.addReference(reference);
  }
  XMLField tgtFld=(XMLField)getSourceToTargetKeyFieldAssociations().get(xmlField);
  String tgtXPath=tgtFld.getXPath();
  HashMap primaryKeyMap=reference.getPrimaryKeyMap();
  Vector pks=(Vector)primaryKeyMap.get(tgtXPath);
  if (pks == null) {
    pks=new Vector();
    primaryKeyMap.put(tgtXPath,pks);
  }
  ClassDescriptor descriptor=session.getClassDescriptor(getReferenceClass());
  Class type=descriptor.getTypedField(tgtFld).getType();
  XMLConversionManager xmlConversionManager=(XMLConversionManager)session.getDatasourcePlatform().getConversionManager();
  for (StringTokenizer stok=new StringTokenizer((String)object); stok.hasMoreTokens(); ) {
    Object value=xmlConversionManager.convertObject(stok.nextToken(),type);
    if (value != null) {
      pks.add(value);
    }
  }
}
Program: 67074
Project: 67074
Buggy source:
public SAXFragmentBuilder getFragmentBuilder(){
  return this.fragmentBuilder;
}

Fixed version (ground truth):
public SAXFragmentBuilder getFragmentBuilder(){
  if (this.fragmentBuilder == null) {
    fragmentBuilder=new SAXFragmentBuilder(this);
  }
  return fragmentBuilder;
}
Program: 67075
Project: 67075
Buggy source:
public String resolveNamespacePrefix(String prefix){
  String namespaceURI=unmarshalNamespaceResolver.getNamespaceURI(prefix);
  if (null == namespaceURI && null != getParentRecord()) {
    namespaceURI=getParentRecord().resolveNamespacePrefix(prefix);
  }
  return namespaceURI;
}

Fixed version (ground truth):
public String resolveNamespacePrefix(String prefix){
  String namespaceURI=getUnmarshalNamespaceResolver().getNamespaceURI(prefix);
  if (null == namespaceURI && null != getParentRecord()) {
    namespaceURI=getParentRecord().resolveNamespacePrefix(prefix);
  }
  return namespaceURI;
}
Program: 67076
Project: 67076
Buggy source:
public String resolveNamespaceUri(String uri){
  String prefix=unmarshalNamespaceResolver.getPrefix(uri);
  if (null == prefix) {
    if (null != getParentRecord()) {
      prefix=getParentRecord().resolveNamespaceUri(uri);
    }
  }
  return prefix;
}

Fixed version (ground truth):
public String resolveNamespaceUri(String uri){
  String prefix=getUnmarshalNamespaceResolver().getPrefix(uri);
  if (null == prefix) {
    if (null != getParentRecord()) {
      prefix=getParentRecord().resolveNamespaceUri(uri);
    }
  }
  return prefix;
}
Program: 67077
Project: 67077
Buggy source:
public void characters(char[] ch,int start,int length) throws SAXException {
  try {
    if (null != selfRecords) {
      for (int x=0, selfRecordsSize=selfRecords.size(); x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=selfRecords.get(x);
        if (selfRecord != null) {
          selfRecord.characters(ch,start,length);
        }
 else {
          getFragmentBuilder().characters(ch,start,length);
        }
      }
    }
    XPathNode textNode=xPathNode.getTextNode();
    if (null == textNode && xPathNode.getNonAttributeChildrenMap() != null) {
      textNode=(XPathNode)xPathNode.getNonAttributeChildrenMap().get(XPathFragment.ANY_FRAGMENT);
      if (textNode != null) {
        if (0 == length) {
          return;
        }
        String tmpString=new String(ch,start,length);
        if (tmpString.trim().length() == 0 && !textNode.isWhitespaceAware()) {
          return;
        }
      }
    }
    if (null != textNode) {
      xPathNode=textNode;
      unmarshalContext.characters(this);
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      getStringBuffer().append(ch,start,length);
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}

Fixed version (ground truth):
public void characters(char[] ch,int start,int length) throws SAXException {
  try {
    if (null != selfRecords) {
      for (int x=0, selfRecordsSize=selfRecords.size(); x < selfRecordsSize; x++) {
        UnmarshalRecord selfRecord=selfRecords.get(x);
        if (selfRecord != null) {
          selfRecord.characters(ch,start,length);
        }
 else {
          getFragmentBuilder().characters(ch,start,length);
        }
      }
    }
    XPathNode textNode=xPathNode.getTextNode();
    if (null == textNode && xPathNode.getNonAttributeChildrenMap() != null) {
      textNode=(XPathNode)xPathNode.getNonAttributeChildrenMap().get(XPathFragment.ANY_FRAGMENT);
      if (textNode != null) {
        if (0 == length) {
          return;
        }
        String tmpString=new String(ch,start,length);
        if (!textNode.isWhitespaceAware() && tmpString.trim().length() == 0) {
          return;
        }
      }
    }
    if (null != textNode) {
      xPathNode=textNode;
      unmarshalContext.characters(this);
    }
    if (null != xPathNode.getUnmarshalNodeValue()) {
      getStringBuffer().append(ch,start,length);
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}
Program: 67078
Project: 67078
Buggy source:
public void setChildRecord(UnmarshalRecord childRecord){
  this.childRecord=childRecord;
  if (null != childRecord) {
    childRecord.setParentRecord(this);
    childRecord.session=this.session;
    childRecord.xmlReader=this.xmlReader;
    childRecord.setFragmentBuilder(this.getFragmentBuilder());
    childRecord.setUnmarshalNamespaceResolver(this.getUnmarshalNamespaceResolver());
  }
}

Fixed version (ground truth):
public void setChildRecord(UnmarshalRecord childRecord){
  this.childRecord=childRecord;
  if (null != childRecord) {
    childRecord.setParentRecord(this);
    childRecord.session=this.session;
    childRecord.xmlReader=this.xmlReader;
    childRecord.setFragmentBuilder(fragmentBuilder);
    childRecord.setUnmarshalNamespaceResolver(this.getUnmarshalNamespaceResolver());
  }
}
Program: 67079
Project: 67079
Buggy source:
public UnmarshalRecord(TreeObjectBuilder treeObjectBuilder){
  super();
  this.levelIndex=0;
  this.xPathFragment=new XPathFragment();
  this.isBufferCDATA=false;
  this.treeObjectBuilder=treeObjectBuilder;
  if (null != treeObjectBuilder) {
    this.xPathNode=treeObjectBuilder.getRootXPathNode();
    if (null != treeObjectBuilder.getNullCapableValues()) {
      this.nullCapableValues=new ArrayList<NullCapableValue>(treeObjectBuilder.getNullCapableValues());
    }
  }
  fragmentBuilder=new SAXFragmentBuilder(this);
  isSelfRecord=false;
}

Fixed version (ground truth):
public UnmarshalRecord(TreeObjectBuilder treeObjectBuilder){
  super();
  this.levelIndex=0;
  this.xPathFragment=new XPathFragment();
  this.isBufferCDATA=false;
  this.treeObjectBuilder=treeObjectBuilder;
  if (null != treeObjectBuilder) {
    this.xPathNode=treeObjectBuilder.getRootXPathNode();
    if (null != treeObjectBuilder.getNullCapableValues()) {
      this.nullCapableValues=new ArrayList<NullCapableValue>(treeObjectBuilder.getNullCapableValues());
    }
  }
  isSelfRecord=false;
}
Program: 67080
Project: 67080
Buggy source:
/** 
 * This method is intended for use by service implementations only. Undoes all changes in the log to restore the tree of DataObjects to its original state when logging began. isLogging() is unchanged.  The log is cleared.
 * @see #beginLogging
 * @see #endLogging
 * @see #isLogging
 */
public void undoChanges(){
  Property oldProp=getOldContainmentProperty(rootDataObject);
  String oldName=null;
  if (oldProp != null) {
    oldName=oldProp.getName();
  }
  rootDataObject.undoChanges(true,this,(SDODataObject)getOldContainer(rootDataObject),oldName);
  resetChanges();
  rootDataObject.resetChanges();
}

Fixed version (ground truth):
/** 
 * This method is intended for use by service implementations only. Undoes all changes in the log to restore the tree of DataObjects to its original state when logging began. isLogging() is unchanged.  The log is cleared.
 * @see #beginLogging
 * @see #endLogging
 * @see #isLogging
 */
public void undoChanges(){
  Property oldProp=getOldContainmentProperty(rootDataObject);
  String oldName=null;
  if (oldProp != null) {
    oldName=oldProp.getName();
  }
  rootDataObject.undoChanges(true,this,getOldContainer(rootDataObject),oldName);
  resetChanges();
  rootDataObject.resetChanges();
}
Program: 67081
Project: 67081
Buggy source:
private void getModified(SDODataObject sdoDataObject,List modifiedList){
  if (null == sdoDataObject) {
    return;
  }
  if (isModified(sdoDataObject)) {
    modifiedList.add(sdoDataObject);
  }
  List<Property> properties=(List<Property>)sdoDataObject.getInstanceProperties();
  for (int x=0; x < properties.size(); x++) {
    Property property=properties.get(x);
    if (property.isContainment()) {
      if (property.isMany()) {
        List<SDODataObject> dataObjects=(List<SDODataObject>)sdoDataObject.getList(property);
        for (int y=0; y < dataObjects.size(); y++) {
          getModified(dataObjects.get(y),modifiedList);
        }
      }
 else {
        if ((property.getType() != null) && !(((SDOType)property.getType()).isChangeSummaryType())) {
          getModified(sdoDataObject.getDataObject(property),modifiedList);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void getModified(SDODataObject sdoDataObject,List modifiedList){
  if (null == sdoDataObject) {
    return;
  }
  if (isModified(sdoDataObject)) {
    modifiedList.add(sdoDataObject);
  }
  List<Property> properties=sdoDataObject.getInstanceProperties();
  for (int x=0; x < properties.size(); x++) {
    Property property=properties.get(x);
    if (property.isContainment()) {
      if (property.isMany()) {
        List<SDODataObject> dataObjects=sdoDataObject.getList(property);
        for (int y=0; y < dataObjects.size(); y++) {
          getModified(dataObjects.get(y),modifiedList);
        }
      }
 else {
        if ((property.getType() != null) && !(((SDOType)property.getType()).isChangeSummaryType())) {
          getModified(sdoDataObject.getDataObject(property),modifiedList);
        }
      }
    }
  }
}
Program: 67083
Project: 67083
Buggy source:
/** 
 * Returns a   {@link ChangeSummary.Setting setting} for the specified propertyrepresenting the property value of the given <code>dataObject</code> at the point when logging  {@link #beginLogging() began}. <p>Returns null if the property was not modified and has not been   {@link #isDeleted(DataObject) deleted}.
 * @param dataObject the object in question.
 * @param property the property of the object.
 * @return the Setting for the specified property.
 * @see #getChangedDataObjects
 */
public SDOChangeSummary.Setting getOldValue(DataObject dataObject,Property property){
  if ((dataObject == null) || (!isDeleted(dataObject) && ((dataObject.getChangeSummary() != null) && (dataObject.getChangeSummary() != this)))) {
    return null;
  }
  if (!isCreated(dataObject) && isDirty(dataObject)) {
    return getOldValueForChangedDataObject(dataObject,(SDOProperty)property);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a   {@link ChangeSummary.Setting setting} for the specified propertyrepresenting the property value of the given <code>dataObject</code> at the point when logging  {@link #beginLogging() began}. <p>Returns null if the property was not modified and has not been   {@link #isDeleted(DataObject) deleted}.
 * @param dataObject the object in question.
 * @param property the property of the object.
 * @return the Setting for the specified property.
 * @see #getChangedDataObjects
 */
public SDOChangeSummary.Setting getOldValue(DataObject dataObject,Property property){
  if ((dataObject == null) || (!isDeleted(dataObject) && ((((SDODataObject)dataObject).getChangeSummary() != null) && (((SDODataObject)dataObject).getChangeSummary() != this)))) {
    return null;
  }
  if (!isCreated(dataObject) && isDirty(dataObject)) {
    return getOldValueForChangedDataObject(dataObject,(SDOProperty)property);
  }
  return null;
}
Program: 67085
Project: 67085
Buggy source:
/** 
 * INTERNAL: Remove the open content property (property) from all 3 data structures. Add the property to the unset map. We restore this OC property in undoChanges
 * @param property
 */
public void removeOpenContentProperty(Property property){
  if (isLogging()) {
    getChangeSummary().setUnsetOCProperty(this,property);
  }
  _getOpenContentProperties().remove(property);
  _getOpenContentPropertiesAttributes().remove(property);
  getInstanceProperties().remove(property);
  for (int i=0, size=property.getAliasNames().size(); i < size; i++) {
    _getOpenContentAliasNamesMap().remove(property.getAliasNames().get(i));
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Remove the open content property (property) from all 3 data structures. Add the property to the unset map. We restore this OC property in undoChanges
 * @param property
 */
public void removeOpenContentProperty(Property property){
  if (isLogging()) {
    getChangeSummary().setUnsetOCProperty(this,property);
  }
  _getOpenContentProperties().remove(property);
  _getOpenContentPropertiesAttributes().remove(property);
  getInstanceProperties().remove(property);
  for (int i=0, size=((SDOProperty)property).getAliasNames().size(); i < size; i++) {
    _getOpenContentAliasNamesMap().remove(((SDOProperty)property).getAliasNames().get(i));
  }
}
Program: 67086
Project: 67086
Buggy source:
/** 
 * INTERNAL: Return whether the current dataObject(this) is was part of the passed in dataGraph. Typically this is used to determine whether to treat !isContainment dataObjects as containment while inside a dataGraph. The dataGraph input is used when the current DataGraph pointer has already been cleared
 * @param aDataGraph
 * @param aProperty
 * @return
 */
private boolean isContainedByDataGraph(DataGraph aDataGraph,Property aProperty){
  return (null != aDataGraph) && (null != aProperty.getType()) && !aProperty.getType().isDataType();
}

Fixed version (ground truth):
/** 
 * INTERNAL: Return whether the current dataObject(this) is was part of the passed in dataGraph. Typically this is used to determine whether to treat !isContainment dataObjects as containment while inside a dataGraph. The dataGraph input is used when the current DataGraph pointer has already been cleared
 * @param aDataGraph
 * @param aProperty
 * @return
 */
private boolean isContainedByDataGraph(DataGraph aDataGraph,SDOProperty aProperty){
  return (null != aDataGraph) && (null != aProperty.getType()) && !aProperty.getType().isDataType();
}
Program: 67088
Project: 67088
Buggy source:
/** 
 * INTERNAL: Return a Sequence object when the conditions of many=false and dataType=false are met. Throw an UnsupportedOperationException in all other cases.
 */
private Sequence getSequencePrivate(Property aProperty){
  if ((aProperty != null) && aProperty.getType().isSequenced() && isSet(aProperty)&& !aProperty.getType().isDataType()&& !aProperty.isMany()) {
    return ((DataObject)get(aProperty)).getSequence();
  }
 else {
    throw SDOException.sequenceNotSupportedForProperty(aProperty.getName());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Return a Sequence object when the conditions of many=false and dataType=false are met. Throw an UnsupportedOperationException in all other cases.
 */
private Sequence getSequencePrivate(Property aProperty){
  if ((aProperty != null) && ((SDOProperty)aProperty).getType().isSequenced() && isSet(aProperty)&& !((SDOProperty)aProperty).getType().isDataType()&& !aProperty.isMany()) {
    return ((DataObject)get(aProperty)).getSequence();
  }
 else {
    throw SDOException.sequenceNotSupportedForProperty(aProperty.getName());
  }
}
Program: 67089
Project: 67089
Buggy source:
public SDOChangeSummary getChangeSummary(){
  return (SDOChangeSummary)changeSummary;
}

Fixed version (ground truth):
public SDOChangeSummary getChangeSummary(){
  return changeSummary;
}
Program: 67090
Project: 67090
Buggy source:
/** 
 * INTERNAL: Set flag deleted value.
 * @param deleted   flag deleted's new value.
 */
private void _setDeleted(boolean deleted){
  if (changeSummary != null) {
    boolean wasDeleted=((SDOChangeSummary)changeSummary).setDeleted(this,deleted);
    if (wasDeleted && isLogging()) {
      updateChangeSummaryWithOriginalValues();
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Set flag deleted value.
 * @param deleted   flag deleted's new value.
 */
private void _setDeleted(boolean deleted){
  if (changeSummary != null) {
    boolean wasDeleted=changeSummary.setDeleted(this,deleted);
    if (wasDeleted && isLogging()) {
      updateChangeSummaryWithOriginalValues();
    }
  }
}
Program: 67092
Project: 67092
Buggy source:
/** 
 * INTERNAL:
 * @param value
 * @return
 */
public boolean parentContains(Object value){
  if ((value == null) || (!(value instanceof DataObject))) {
    return false;
  }
  if ((getContainer() != null) && (getContainmentProperty() != null)) {
    if (value.equals(getContainer())) {
      return true;
    }
    return ((SDODataObject)getContainer()).parentContains(value);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 * @param value
 * @return
 */
public boolean parentContains(Object value){
  if ((value == null) || (!(value instanceof DataObject))) {
    return false;
  }
  if ((getContainer() != null) && (getContainmentProperty() != null)) {
    if (value.equals(getContainer())) {
      return true;
    }
    return getContainer().parentContains(value);
  }
  return false;
}
Program: 67094
Project: 67094
Buggy source:
/** 
 * INTERNAL: Unset the specified property on this DataObject. The fromDelete parameter specifies whether we are from a delete or unset/detach operation. The updateSequence parameter is used internally to stop a bidirectional update in the SDOSequence when originally called from this Sequence.
 * @param property
 * @param fromDelete
 * @param updateSequence
 */
public void unset(Property property,boolean fromDelete,boolean updateSequence){
  if (null == property) {
    throw SDOException.cannotPerformOperationOnNullArgument("String_Node_Str");
  }
  if (property.isReadOnly()) {
    throw new UnsupportedOperationException("String_Node_Str" + property.getName() + "String_Node_Str"+ getType().getName());
  }
  boolean wasSet=isSet(property);
  if (wasSet) {
    if (!fromDelete) {
      _setModified(true);
    }
  }
 else {
    return;
  }
  if (property.isContainment() || isContainedByDataGraph(property)) {
    Object oldValue=get(property);
    if (oldValue != null) {
      if (property.isMany()) {
        for (int itemIndex=0, size=((List)oldValue).size(); itemIndex < size; itemIndex++) {
          SDODataObject manyItem=(SDODataObject)((List)oldValue).get(itemIndex);
          if (manyItem != null) {
            manyItem.detachOrDelete(fromDelete);
          }
        }
      }
 else {
        ((SDODataObject)oldValue).detachOrDelete(fromDelete);
      }
    }
  }
  if (wasSet) {
    unsetInternal(property,updateSequence);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Unset the specified property on this DataObject. The fromDelete parameter specifies whether we are from a delete or unset/detach operation. The updateSequence parameter is used internally to stop a bidirectional update in the SDOSequence when originally called from this Sequence.
 * @param property
 * @param fromDelete
 * @param updateSequence
 */
public void unset(Property property,boolean fromDelete,boolean updateSequence){
  if (null == property) {
    throw SDOException.cannotPerformOperationOnNullArgument("String_Node_Str");
  }
  if (((SDOProperty)property).isReadOnly()) {
    throw new UnsupportedOperationException("String_Node_Str" + property.getName() + "String_Node_Str"+ getType().getName());
  }
  boolean wasSet=isSet(property);
  if (wasSet) {
    if (!fromDelete) {
      _setModified(true);
    }
  }
 else {
    return;
  }
  if (property.isContainment() || isContainedByDataGraph(property)) {
    Object oldValue=get(property);
    if (oldValue != null) {
      if (property.isMany()) {
        for (int itemIndex=0, size=((List)oldValue).size(); itemIndex < size; itemIndex++) {
          SDODataObject manyItem=(SDODataObject)((List)oldValue).get(itemIndex);
          if (manyItem != null) {
            manyItem.detachOrDelete(fromDelete);
          }
        }
      }
 else {
        ((SDODataObject)oldValue).detachOrDelete(fromDelete);
      }
    }
  }
  if (wasSet) {
    unsetInternal(property,updateSequence);
  }
}
Program: 67096
Project: 67096
Buggy source:
/** 
 * INTERNAL: Set flag created value.
 * @param created   flag created's new value.
 */
public void _setCreated(boolean created){
  if (changeSummary != null) {
    ((SDOChangeSummary)changeSummary).setCreated(this,created);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Set flag created value.
 * @param created   flag created's new value.
 */
public void _setCreated(boolean created){
  if (changeSummary != null) {
    changeSummary.setCreated(this,created);
  }
}
Program: 67097
Project: 67097
Buggy source:
/** 
 * INTERNAL: Return the SDO Path from the root to the current internal node Prereq: We know that the targetObject will always have a parent as called from getPath() Matching conditions: Iterate up the tree return a non-null string for the XPath at when we reach the root node Function is partially based on SDOCopyHelper.copy(DataObject dataObject) Performance: This function is O(log n) where n=# of children in the tree
 * @param currentPath
 * @param targetObject
 * @param aSeparator (XPath separator is written only between elements not for the first call)
 * @return String (representing the XPath)
 */
private String getPathPrivate(String currentPath,SDODataObject targetObject,String aSeparator){
  SDODataObject aParent=(SDODataObject)targetObject.getContainer();
  if (aParent == null) {
    return currentPath;
  }
  String aContainmentPropertyName=targetObject._getContainmentPropertyName();
  SDOProperty aChild=aParent.getInstanceProperty(aContainmentPropertyName);
  if (aChild.isMany()) {
    int index=(aParent.getList(aChild)).indexOf(targetObject);
    return getPathPrivate(aContainmentPropertyName + SDOConstants.SDO_XPATH_LIST_INDEX_OPEN_BRACKET + (1 + index)+ SDOConstants.SDO_XPATH_LIST_INDEX_CLOSE_BRACKET+ aSeparator+ currentPath,aParent,SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT);
  }
  return getPathPrivate(aContainmentPropertyName + aSeparator + currentPath,aParent,SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT);
}

Fixed version (ground truth):
/** 
 * INTERNAL: Return the SDO Path from the root to the current internal node Prereq: We know that the targetObject will always have a parent as called from getPath() Matching conditions: Iterate up the tree return a non-null string for the XPath at when we reach the root node Function is partially based on SDOCopyHelper.copy(DataObject dataObject) Performance: This function is O(log n) where n=# of children in the tree
 * @param currentPath
 * @param targetObject
 * @param aSeparator (XPath separator is written only between elements not for the first call)
 * @return String (representing the XPath)
 */
private String getPathPrivate(String currentPath,SDODataObject targetObject,String aSeparator){
  SDODataObject aParent=targetObject.getContainer();
  if (aParent == null) {
    return currentPath;
  }
  String aContainmentPropertyName=targetObject._getContainmentPropertyName();
  SDOProperty aChild=aParent.getInstanceProperty(aContainmentPropertyName);
  if (aChild.isMany()) {
    int index=(aParent.getList(aChild)).indexOf(targetObject);
    return getPathPrivate(aContainmentPropertyName + SDOConstants.SDO_XPATH_LIST_INDEX_OPEN_BRACKET + (1 + index)+ SDOConstants.SDO_XPATH_LIST_INDEX_CLOSE_BRACKET+ aSeparator+ currentPath,aParent,SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT);
  }
  return getPathPrivate(aContainmentPropertyName + aSeparator + currentPath,aParent,SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT);
}
Program: 67098
Project: 67098
Buggy source:
/** 
 * INTERNAL: Unset the property on the ValueStore interface and update the sequence if it exists. Used by implementers that require
 * @param property
 * @param updateSequence
 */
private void unsetInternal(Property property,boolean updateSequence){
  if (property.isMany()) {
    getList(property).clear();
    if (property.isOpenContent()) {
      removeOpenContentProperty(property);
    }
 else {
      _getCurrentValueStore().unsetDeclaredProperty(((SDOProperty)property).getIndexInType());
    }
  }
 else {
    if (property.isOpenContent()) {
      _getCurrentValueStore().unsetOpenContentProperty(property);
      removeOpenContentProperty(property);
    }
 else {
      _getCurrentValueStore().unsetDeclaredProperty(((SDOProperty)property).getIndexInType());
    }
  }
  if (type.isSequenced() && (sequence != null) && updateSequence&& aHelperContext.getXSDHelper().isElement(property)) {
    ((SDOSequence)sequence).removeSettingWithoutModifyingDataObject(property);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Unset the property on the ValueStore interface and update the sequence if it exists. Used by implementers that require
 * @param property
 * @param updateSequence
 */
private void unsetInternal(Property property,boolean updateSequence){
  if (property.isMany()) {
    getList(property).clear();
    if (property.isOpenContent()) {
      removeOpenContentProperty(property);
    }
 else {
      _getCurrentValueStore().unsetDeclaredProperty(((SDOProperty)property).getIndexInType());
    }
  }
 else {
    if (property.isOpenContent()) {
      _getCurrentValueStore().unsetOpenContentProperty(property);
      removeOpenContentProperty(property);
    }
 else {
      _getCurrentValueStore().unsetDeclaredProperty(((SDOProperty)property).getIndexInType());
    }
  }
  if (type.isSequenced() && (sequence != null) && updateSequence&& aHelperContext.getXSDHelper().isElement(property)) {
    sequence.removeSettingWithoutModifyingDataObject(property);
  }
}
Program: 67099
Project: 67099
Buggy source:
/** 
 * INTERNAL: Add the open content property into all 3 data structures. Remove the property from the unset map.
 * @param property
 */
public void addOpenContentProperty(Property property){
  List theList=null;
  if (aHelperContext.getXSDHelper().isAttribute(property)) {
    theList=_getOpenContentPropertiesAttributes();
  }
 else {
    theList=_getOpenContentProperties();
  }
  if (!theList.contains(property)) {
    if (isLogging()) {
      getChangeSummary().removeUnsetOCProperty(this,property);
    }
    theList.add(property);
    getInstanceProperties().add(property);
    for (int i=0, size=property.getAliasNames().size(); i < size; i++) {
      _getOpenContentAliasNamesMap().put((String)property.getAliasNames().get(i),property);
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Add the open content property into all 3 data structures. Remove the property from the unset map.
 * @param property
 */
public void addOpenContentProperty(Property property){
  List theList=null;
  if (aHelperContext.getXSDHelper().isAttribute(property)) {
    theList=_getOpenContentPropertiesAttributes();
  }
 else {
    theList=_getOpenContentProperties();
  }
  if (!theList.contains(property)) {
    if (isLogging()) {
      getChangeSummary().removeUnsetOCProperty(this,property);
    }
    theList.add(property);
    getInstanceProperties().add(property);
    for (int i=0, size=((SDOProperty)property).getAliasNames().size(); i < size; i++) {
      _getOpenContentAliasNamesMap().put((String)((SDOProperty)property).getAliasNames().get(i),property);
    }
  }
}
Program: 67100
Project: 67100
Buggy source:
/** 
 * INTERNAL: Removes this DataObject from its container, if any. Same as getContainer().getList(getContainmentProperty()).remove(this) or getContainer().unset(getContainmentProperty()) depending on getContainmentProperty().isMany() respectively.
 * @param fromDelete (true = delete action, false = detach/unset)
 * @param updateSequence
 */
private void detach(boolean fromDelete,boolean updateSequence){
  Property containmentProperty=getContainmentProperty();
  if ((containmentProperty != null) && containmentProperty.isReadOnly()) {
    throw new UnsupportedOperationException("String_Node_Str" + containmentProperty.getName() + "String_Node_Str"+ getType().getName());
  }
  if (containmentProperty != null) {
    if (getContainmentProperty().isMany()) {
      List oldList=getContainer().getList(containmentProperty);
      ((ListWrapper)oldList).remove(this,fromDelete,updateSequence);
    }
 else {
      getContainer().unset(containmentProperty,fromDelete,updateSequence);
    }
  }
 else {
    _setDeleted(true);
    detachOrDelete(fromDelete);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Removes this DataObject from its container, if any. Same as getContainer().getList(getContainmentProperty()).remove(this) or getContainer().unset(getContainmentProperty()) depending on getContainmentProperty().isMany() respectively.
 * @param fromDelete (true = delete action, false = detach/unset)
 * @param updateSequence
 */
private void detach(boolean fromDelete,boolean updateSequence){
  SDOProperty containmentProperty=getContainmentProperty();
  if ((containmentProperty != null) && containmentProperty.isReadOnly()) {
    throw new UnsupportedOperationException("String_Node_Str" + containmentProperty.getName() + "String_Node_Str"+ getType().getName());
  }
  if (containmentProperty != null) {
    if (getContainmentProperty().isMany()) {
      List oldList=getContainer().getList(containmentProperty);
      ((ListWrapper)oldList).remove(this,fromDelete,updateSequence);
    }
 else {
      getContainer().unset(containmentProperty,fromDelete,updateSequence);
    }
  }
 else {
    _setDeleted(true);
    detachOrDelete(fromDelete);
  }
}
Program: 67102
Project: 67102
Buggy source:
private DatabaseMapping buildXMLChoiceObjectMapping(String mappingUri){
  XMLChoiceObjectMapping mapping=new XMLChoiceObjectMapping();
  mapping.setAttributeName(getName());
  String xPath=getQualifiedXPath(mappingUri,getType().isDataType());
  mapping.addChoiceElement(xPath,getType().getImplClass());
  Iterator<SDOProperty> properties=this.getSubstitutableElements().iterator();
  while (properties.hasNext()) {
    SDOProperty nextProp=properties.next();
    xPath=nextProp.getQualifiedXPath(mappingUri,nextProp.getType().isDataType(),(SDOType)getContainingType());
    mapping.addChoiceElement(xPath,nextProp.getType().getImplClass());
  }
  return mapping;
}

Fixed version (ground truth):
private DatabaseMapping buildXMLChoiceObjectMapping(String mappingUri){
  XMLChoiceObjectMapping mapping=new XMLChoiceObjectMapping();
  mapping.setAttributeName(getName());
  String xPath=getQualifiedXPath(mappingUri,getType().isDataType());
  mapping.addChoiceElement(xPath,getType().getImplClass());
  Iterator<SDOProperty> properties=this.getSubstitutableElements().iterator();
  while (properties.hasNext()) {
    SDOProperty nextProp=properties.next();
    xPath=nextProp.getQualifiedXPath(mappingUri,nextProp.getType().isDataType(),getContainingType());
    mapping.addChoiceElement(xPath,nextProp.getType().getImplClass());
  }
  return mapping;
}