nus-yam/ex-repair huggingface dataset:
Program: 68693
Project: 68693
Buggy source:
/** 
 * INTERNAL:
 */
public BasicCollectionAccessor(MetadataAccessibleObject accessibleObject,ClassAccessor classAccessor){
  super(accessibleObject,classAccessor);
  BasicCollection basicCollection=getAnnotation(BasicCollection.class);
  if (basicCollection != null) {
    m_valueColumn=new ColumnMetadata(basicCollection.valueColumn(),getAttributeName());
    setFetch(basicCollection.fetch());
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public BasicCollectionAccessor(MetadataAccessibleObject accessibleObject,ClassAccessor classAccessor){
  super(accessibleObject,classAccessor);
  Object basicCollection=getAnnotation(BasicCollection.class);
  if (basicCollection != null) {
    m_valueColumn=new ColumnMetadata(invokeMethod("String_Node_Str",basicCollection,(Object[])null),getAttributeName());
    setFetch((Enum)invokeMethod("String_Node_Str",basicCollection,(Object[])null));
  }
}
Program: 68694
Project: 68694
Buggy source:
/** 
 * INTERNAL: Process a MetadataCollectionTable.
 */
protected void processCollectionTable(DirectCollectionMapping mapping){
  CollectionTableMetadata collectionTable;
  if (m_collectionTable == null) {
    CollectionTable table=getAnnotation(CollectionTable.class);
    collectionTable=new CollectionTableMetadata(table,getAnnotatedElementName());
  }
 else {
    collectionTable=m_collectionTable;
  }
  processTable(collectionTable,getDefaultCollectionTableName());
  mapping.setReferenceTable(collectionTable.getDatabaseTable());
  for (  PrimaryKeyJoinColumnMetadata primaryKeyJoinColumn : processPrimaryKeyJoinColumns(new PrimaryKeyJoinColumnsMetadata(collectionTable.getPrimaryKeyJoinColumns()))) {
    DatabaseField pkField=primaryKeyJoinColumn.getPrimaryKeyField();
    pkField.setName(getName(pkField,getDescriptor().getPrimaryKeyFieldName(),MetadataLogger.PK_COLUMN));
    pkField.setTable(getDescriptor().getPrimaryTable());
    DatabaseField fkField=primaryKeyJoinColumn.getForeignKeyField();
    fkField.setName(getName(fkField,getDescriptor().getPrimaryKeyFieldName(),MetadataLogger.FK_COLUMN));
    fkField.setTable(collectionTable.getDatabaseTable());
    mapping.addReferenceKeyField(fkField,pkField);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Process a MetadataCollectionTable.
 */
protected void processCollectionTable(DirectCollectionMapping mapping){
  CollectionTableMetadata collectionTable;
  if (m_collectionTable == null) {
    Object table=getAnnotation(CollectionTable.class);
    collectionTable=new CollectionTableMetadata(table,getAnnotatedElementName());
  }
 else {
    collectionTable=m_collectionTable;
  }
  processTable(collectionTable,getDefaultCollectionTableName());
  mapping.setReferenceTable(collectionTable.getDatabaseTable());
  for (  PrimaryKeyJoinColumnMetadata primaryKeyJoinColumn : processPrimaryKeyJoinColumns(new PrimaryKeyJoinColumnsMetadata(collectionTable.getPrimaryKeyJoinColumns()))) {
    DatabaseField pkField=primaryKeyJoinColumn.getPrimaryKeyField();
    pkField.setName(getName(pkField,getDescriptor().getPrimaryKeyFieldName(),MetadataLogger.PK_COLUMN));
    pkField.setTable(getDescriptor().getPrimaryTable());
    DatabaseField fkField=primaryKeyJoinColumn.getForeignKeyField();
    fkField.setName(getName(fkField,getDescriptor().getPrimaryKeyFieldName(),MetadataLogger.FK_COLUMN));
    fkField.setTable(collectionTable.getDatabaseTable());
    mapping.addReferenceKeyField(fkField,pkField);
  }
}
Program: 68695
Project: 68695
Buggy source:
/** 
 * INTERNAL:
 */
public BasicMapAccessor(MetadataAccessibleObject accessibleObject,ClassAccessor classAccessor){
  super(accessibleObject,classAccessor);
  BasicMap basicMap=getAnnotation(BasicMap.class);
  m_keyColumn=new ColumnMetadata(basicMap.keyColumn(),getAttributeName());
  m_keyConverter=basicMap.keyConverter().value();
  m_valueConverter=basicMap.valueConverter().value();
  setValueColumn(new ColumnMetadata(basicMap.valueColumn(),getAttributeName()));
  setFetch(basicMap.fetch());
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public BasicMapAccessor(MetadataAccessibleObject accessibleObject,ClassAccessor classAccessor){
  super(accessibleObject,classAccessor);
  Object basicMap=getAnnotation(BasicMap.class);
  m_keyColumn=new ColumnMetadata(invokeMethod("String_Node_Str",basicMap,(Object[])null),getAttributeName());
  Object keyConvert=invokeMethod("String_Node_Str",basicMap,(Object[])null);
  m_keyConverter=(String)invokeMethod("String_Node_Str",keyConvert,(Object[])null);
  Object valueConvert=invokeMethod("String_Node_Str",basicMap,(Object[])null);
  m_valueConverter=(String)invokeMethod("String_Node_Str",valueConvert,(Object[])null);
  setValueColumn(new ColumnMetadata(invokeMethod("String_Node_Str",basicMap,(Object[])null),getAttributeName()));
  setFetch((Enum)invokeMethod("String_Node_Str",basicMap,(Object[])null));
}
Program: 68696
Project: 68696
Buggy source:
/** 
 * INTERNAL:
 */
public CascadeTypes(CascadeType[] cascadeTypes){
  m_types=new ArrayList<CascadeType>();
  for (  CascadeType cascadeType : cascadeTypes) {
    m_types.add(cascadeType);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public CascadeTypes(Enum[] cascadeTypes){
  m_types=new ArrayList<Enum>();
  for (  Enum cascadeType : cascadeTypes) {
    m_types.add(cascadeType);
  }
}
Program: 68697
Project: 68697
Buggy source:
/** 
 * INTERNAL:
 */
public List<CascadeType> getTypes(){
  if (m_types == null) {
    m_types=new ArrayList<CascadeType>();
    if (isCascadeAll()) {
      m_types.add(CascadeType.ALL);
    }
    if (isCascadePersist()) {
      m_types.add(CascadeType.PERSIST);
    }
    if (isCascadeMerge()) {
      m_types.add(CascadeType.MERGE);
    }
    if (isCascadeRemove()) {
      m_types.add(CascadeType.REMOVE);
    }
    if (isCascadeRefresh()) {
      m_types.add(CascadeType.REFRESH);
    }
  }
  return m_types;
}

Fixed version (ground truth):
/** 
 * INTERNAL:
 */
public List<Enum> getTypes(){
  if (m_types == null) {
    m_types=new ArrayList<Enum>();
    if (isCascadeAll()) {
      m_types.add(CascadeType.ALL);
    }
    if (isCascadePersist()) {
      m_types.add(CascadeType.PERSIST);
    }
    if (isCascadeMerge()) {
      m_types.add(CascadeType.MERGE);
    }
    if (isCascadeRemove()) {
      m_types.add(CascadeType.REMOVE);
    }
    if (isCascadeRefresh()) {
      m_types.add(CascadeType.REFRESH);
    }
  }
  return m_types;
}
Program: 68698
Project: 68698
Buggy source:
public ValueStore copy(){
  POJOValueStore anOriginalValueStore=getInstance(((SDODataObject)dataObject)._getHelperContext());
  anOriginalValueStore.setDataObject(dataObject);
  anOriginalValueStore.setObject(object);
  HashMap aHashMap=new HashMap();
  aHashMap.putAll(properties);
  anOriginalValueStore.properties=aHashMap;
  return anOriginalValueStore;
}

Fixed version (ground truth):
public ValueStore copy(){
  POJOValueStore anOriginalValueStore=getInstance(((SDOType)dataObject.getType()).getHelperContext());
  anOriginalValueStore.setDataObject(dataObject);
  anOriginalValueStore.setObject(object);
  HashMap aHashMap=new HashMap();
  aHashMap.putAll(properties);
  anOriginalValueStore.properties=aHashMap;
  return anOriginalValueStore;
}
Program: 68703
Project: 68703
Buggy source:
/** 
 * Sets the value of the instance variable in the object to the value.
 */
public void setAttributeValueInObject(Object domainObject,Object attributeValue) throws DescriptorException {
  ((SDODataObject)domainObject).set(property,attributeValue,false);
}

Fixed version (ground truth):
/** 
 * Sets the value of the instance variable in the object to the value.
 */
public void setAttributeValueInObject(Object domainObject,Object attributeValue) throws DescriptorException {
  ((SDODataObject)domainObject).setInternal(property,attributeValue,false);
}
Program: 68704
Project: 68704
Buggy source:
private boolean isAllowedInSequence(Property property){
  if (null == property) {
    return false;
  }
  if (property.isReadOnly()) {
    return false;
  }
  if (dataObject._getHelperContext().getXSDHelper().isAttribute(property)) {
    throw SDOException.sequenceAttributePropertyNotSupported(property.getName());
  }
  if (property.isOpenContent() && !dataObject.getType().isOpen()) {
    return false;
  }
  if (property.isMany()) {
    return true;
  }
  if (dataObject.isSet(property)) {
    throw SDOException.sequenceDuplicateSettingNotSupportedForComplexSingleObject(getIndexForProperty(property),property.getName());
  }
  return true;
}

Fixed version (ground truth):
private boolean isAllowedInSequence(Property property){
  if (null == property) {
    return false;
  }
  if (property.isReadOnly()) {
    return false;
  }
  if (((SDOType)dataObject.getType()).getHelperContext().getXSDHelper().isAttribute(property)) {
    throw SDOException.sequenceAttributePropertyNotSupported(property.getName());
  }
  if (property.isOpenContent() && !dataObject.getType().isOpen()) {
    return false;
  }
  if (property.isMany()) {
    return true;
  }
  if (dataObject.isSet(property)) {
    throw SDOException.sequenceDuplicateSettingNotSupportedForComplexSingleObject(getIndexForProperty(property),property.getName());
  }
  return true;
}
Program: 68714
Project: 68714
Buggy source:
private void processIncludes(Map includes){
  if ((includes == null) || (includes.size() == 0) || !isProcessImports()) {
    return;
  }
  Iterator keysIter=includes.keySet().iterator();
  while (keysIter.hasNext()) {
    String key=(String)keysIter.next();
    Include nextInclude=(Include)includes.get(key);
    processInclude(nextInclude);
  }
}

Fixed version (ground truth):
private void processIncludes(java.util.List includes){
  if ((includes == null) || (includes.size() == 0) || !isProcessImports()) {
    return;
  }
  Iterator iter=includes.iterator();
  while (iter.hasNext()) {
    Include nextInclude=(Include)iter.next();
    processInclude(nextInclude);
  }
}
Program: 68715
Project: 68715
Buggy source:
private void processImports(Map imports){
  if ((imports == null) || (imports.size() == 0) || !isProcessImports()) {
    return;
  }
  Iterator keysIter=imports.keySet().iterator();
  while (keysIter.hasNext()) {
    String key=(String)keysIter.next();
    Import nextImport=(Import)imports.get(key);
    processImport(nextImport);
  }
}

Fixed version (ground truth):
private void processImports(java.util.List imports){
  if ((imports == null) || (imports.size() == 0) || !isProcessImports()) {
    return;
  }
  Iterator iter=imports.iterator();
  while (iter.hasNext()) {
    Import nextImport=(Import)iter.next();
    processImport(nextImport);
  }
}
Program: 68718
Project: 68718
Buggy source:
public Schema(){
  namespaceResolver=new NamespaceResolver();
  imports=new HashMap();
  includes=new HashMap();
  topLevelSimpleTypes=new HashMap();
  topLevelComplexTypes=new HashMap();
  topLevelElements=new HashMap();
  topLevelAttributes=new HashMap();
  attributesMap=new HashMap();
  attributeGroups=new HashMap();
  groups=new HashMap();
}

Fixed version (ground truth):
public Schema(){
  namespaceResolver=new NamespaceResolver();
  imports=new ArrayList();
  includes=new ArrayList();
  topLevelSimpleTypes=new HashMap();
  topLevelComplexTypes=new HashMap();
  topLevelElements=new HashMap();
  topLevelAttributes=new HashMap();
  attributesMap=new HashMap();
  attributeGroups=new HashMap();
  groups=new HashMap();
}
Program: 68719
Project: 68719
Buggy source:
public Map getImports(){
  return imports;
}

Fixed version (ground truth):
public java.util.List getImports(){
  return imports;
}
Program: 68720
Project: 68720
Buggy source:
public void setImports(Map imports){
  this.imports=imports;
}

Fixed version (ground truth):
public void setImports(java.util.List imports){
  this.imports=imports;
}
Program: 68721
Project: 68721
Buggy source:
protected Group getGroupFromReferencedSchemas(String uri,String localName){
  Group globalGroup=null;
  Iterator iter=getIncludes().values().iterator();
  while (iter.hasNext() && (globalGroup == null)) {
    Schema includedSchema=((Include)iter.next()).getSchema();
    globalGroup=includedSchema.getGroup(uri,localName);
  }
  if (globalGroup == null) {
    iter=getImports().values().iterator();
    while (iter.hasNext() && (globalGroup == null)) {
      Schema importedSchema=((Import)iter.next()).getSchema();
      globalGroup=importedSchema.getGroup(uri,localName);
    }
  }
  return globalGroup;
}

Fixed version (ground truth):
protected Group getGroupFromReferencedSchemas(String uri,String localName){
  Group globalGroup=null;
  Iterator iter=getIncludes().iterator();
  while (iter.hasNext() && (globalGroup == null)) {
    Schema includedSchema=((Include)iter.next()).getSchema();
    globalGroup=includedSchema.getGroup(uri,localName);
  }
  if (globalGroup == null) {
    iter=getImports().iterator();
    while (iter.hasNext() && (globalGroup == null)) {
      Schema importedSchema=((Import)iter.next()).getSchema();
      globalGroup=importedSchema.getGroup(uri,localName);
    }
  }
  return globalGroup;
}
Program: 68722
Project: 68722
Buggy source:
protected AttributeGroup getAttributeGroupFromReferencedSchemas(String uri,String localName){
  AttributeGroup globalAttributeGroup=null;
  Iterator iter=getIncludes().values().iterator();
  while (iter.hasNext() && (globalAttributeGroup == null)) {
    Schema includedSchema=((Include)iter.next()).getSchema();
    globalAttributeGroup=includedSchema.getAttributeGroup(uri,localName);
  }
  if (globalAttributeGroup == null) {
    iter=getImports().values().iterator();
    while (iter.hasNext() && (globalAttributeGroup == null)) {
      Schema importedSchema=((Import)iter.next()).getSchema();
      globalAttributeGroup=importedSchema.getAttributeGroup(uri,localName);
    }
  }
  return globalAttributeGroup;
}

Fixed version (ground truth):
protected AttributeGroup getAttributeGroupFromReferencedSchemas(String uri,String localName){
  AttributeGroup globalAttributeGroup=null;
  Iterator iter=getIncludes().iterator();
  while (iter.hasNext() && (globalAttributeGroup == null)) {
    Schema includedSchema=((Include)iter.next()).getSchema();
    globalAttributeGroup=includedSchema.getAttributeGroup(uri,localName);
  }
  if (globalAttributeGroup == null) {
    iter=getImports().iterator();
    while (iter.hasNext() && (globalAttributeGroup == null)) {
      Schema importedSchema=((Import)iter.next()).getSchema();
      globalAttributeGroup=importedSchema.getAttributeGroup(uri,localName);
    }
  }
  return globalAttributeGroup;
}
Program: 68723
Project: 68723
Buggy source:
public Map getIncludes(){
  return includes;
}

Fixed version (ground truth):
public java.util.List getIncludes(){
  return includes;
}
Program: 68724
Project: 68724
Buggy source:
public void setIncludes(Map includes){
  this.includes=includes;
}

Fixed version (ground truth):
public void setIncludes(java.util.List includes){
  this.includes=includes;
}
Program: 68725
Project: 68725
Buggy source:
/** 
 * Return the namespace prefix associated with a namespace URI.
 * @param uri A namespace URI.
 * @return The prefix associated with the namespace URI.
 */
public String resolveNamespaceURI(String uri){
  Enumeration keys=namespaces.keys();
  String prefix;
  while (keys.hasMoreElements()) {
    prefix=(String)keys.nextElement();
    if (namespaces.getProperty(prefix).equals(uri)) {
      return prefix;
    }
  }
  if (uri != null) {
    if (uri.equalsIgnoreCase(XMLConstants.XMLNS_URL)) {
      return XMLConstants.XMLNS;
    }
 else     if (uri.equalsIgnoreCase(XMLConstants.XML_NAMESPACE_URL)) {
      return XMLConstants.XML_NAMESPACE_PREFIX;
    }
  }
  return null;
}

Fixed version (ground truth):
private String resolveNamespaceURI(Node node,String uri){
  if (null == node) {
    return null;
  }
  if (uri.equals(node.getNamespaceURI())) {
    return node.getPrefix();
  }
  NamedNodeMap namedNodeMap=node.getAttributes();
  if (null != namedNodeMap) {
    int namedNodeMapSize=namedNodeMap.getLength();
    for (int x=0; x < namedNodeMapSize; x++) {
      Node attr=namedNodeMap.item(x);
      if (XMLConstants.XMLNS_URL.equals(attr.getNamespaceURI())) {
        if (uri.equals(attr.getNodeValue())) {
          return attr.getLocalName();
        }
      }
    }
  }
  return resolveNamespaceURI(node.getParentNode(),uri);
}
Program: 68726
Project: 68726
Buggy source:
private String getNextPrefix(){
  return "String_Node_Str" + prefixCounter++;
}

Fixed version (ground truth):
private String getNextPrefix(){
  return BASE_PREFIX + prefixCounter++;
}
Program: 68729
Project: 68729
Buggy source:
/** 
 * INTERNAL: Like ObjectToXML but is may also return a document fragment instead of a document in the case of a non-root object.
 */
protected Node objectToXMLNode(Object object,XMLDescriptor descriptor,boolean isXMLRoot) throws XMLMarshalException {
  AbstractSession session=xmlContext.getSession(descriptor);
  if ((session != null) && xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument()) {
    XMLRecord xmlRow=null;
    if (!isXMLRoot) {
      xmlRow=(XMLRecord)((XMLObjectBuilder)descriptor.getObjectBuilder()).createRecordFor(object,xmlContext.getDocumentPreservationPolicy(session));
      xmlRow.setMarshaller(this);
      if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) {
        addDescriptorNamespacesToXMLRecord(descriptor,xmlRow);
      }
    }
    Document doc=objectToXML(object,descriptor,xmlRow,isXMLRoot);
    if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
      return xmlRow.getDOM();
    }
 else {
      return doc;
    }
  }
 else {
    MarshalRecord marshalRecord=new NodeRecord();
    marshalRecord.setMarshaller(this);
    marshal(object,marshalRecord,descriptor,isXMLRoot);
    return marshalRecord.getDocument();
  }
}

Fixed version (ground truth):
protected Node objectToXMLNode(Object object,Node rootNode,XMLDescriptor descriptor,boolean isXMLRoot) throws XMLMarshalException {
  AbstractSession session=xmlContext.getSession(descriptor);
  if ((session != null) && xmlContext.getDocumentPreservationPolicy(session).shouldPreserveDocument()) {
    XMLRecord xmlRow=null;
    if (!isXMLRoot) {
      xmlRow=(XMLRecord)((XMLObjectBuilder)descriptor.getObjectBuilder()).createRecordFor(object,xmlContext.getDocumentPreservationPolicy(session));
      xmlRow.setMarshaller(this);
      if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) {
        addDescriptorNamespacesToXMLRecord(descriptor,xmlRow);
      }
    }
    Document doc=objectToXML(object,rootNode,descriptor,xmlRow,isXMLRoot);
    if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
      return xmlRow.getDOM();
    }
 else {
      return doc;
    }
  }
 else {
    MarshalRecord marshalRecord=new NodeRecord();
    marshalRecord.setMarshaller(this);
    marshalRecord.getNamespaceResolver().setDOM(rootNode);
    marshal(object,marshalRecord,descriptor,isXMLRoot);
    return marshalRecord.getDocument();
  }
}
Program: 68730
Project: 68730
Buggy source:
public void setDOM(Element element){
  this.dom=element;
}

Fixed version (ground truth):
public void setDOM(Element element){
  this.dom=element;
  this.getNamespaceResolver().setDOM(element);
}
Program: 68732
Project: 68732
Buggy source:
/** 
 * Set the Node that the object will be marshalled to.
 * @param writer The marshal target.
 */
public void setDOM(Node dom){
  nodes=new Stack();
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    document=(Document)dom;
  }
 else   if ((dom.getNodeType() == Node.ELEMENT_NODE) || (dom.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
    document=dom.getOwnerDocument();
    nodes.push(dom);
  }
 else {
    throw XMLMarshalException.marshalException(null);
  }
}

Fixed version (ground truth):
/** 
 * Set the Node that the object will be marshalled to.
 * @param writer The marshal target.
 */
public void setDOM(Node dom){
  nodes=new Stack();
  if (dom.getNodeType() == Node.DOCUMENT_NODE) {
    document=(Document)dom;
  }
 else   if ((dom.getNodeType() == Node.ELEMENT_NODE) || (dom.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
    document=dom.getOwnerDocument();
    nodes.push(dom);
    getNamespaceResolver().setDOM(dom);
  }
 else {
    throw XMLMarshalException.marshalException(null);
  }
}
Program: 68733
Project: 68733
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(XMLRootComplexTestCases.class);
  suite.addTestSuite(XMLRootComplexDifferentPrefixWithDRTestCases.class);
  suite.addTestSuite(XMLRootComplexNoPrefixTestCases.class);
  suite.addTestSuite(XMLRootComplexNoNamespaceResolverTestCases.class);
  suite.addTestSuite(XMLRootComplexNullUriTestCases.class);
  suite.addTestSuite(XMLRootComplexNoNRWithPrefixTestCases.class);
  suite.addTestSuite(XMLRootComplexDifferentPrefixTestCases.class);
  suite.addTestSuite(XMLRootSimpleTestCases.class);
  suite.addTestSuite(XMLRootNoPrefixTestCases.class);
  suite.addTestSuite(XMLRootNullUriTestCases.class);
  suite.addTestSuite(XMLRootNullSchemaReferenceTestCases.class);
  suite.addTestSuite(XMLRootMultipleMarshalTestCases.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(MarshalToNodeTestCases.class);
  suite.addTestSuite(XMLRootComplexTestCases.class);
  suite.addTestSuite(XMLRootComplexDifferentPrefixWithDRTestCases.class);
  suite.addTestSuite(XMLRootComplexNoPrefixTestCases.class);
  suite.addTestSuite(XMLRootComplexNoNamespaceResolverTestCases.class);
  suite.addTestSuite(XMLRootComplexNullUriTestCases.class);
  suite.addTestSuite(XMLRootComplexNoNRWithPrefixTestCases.class);
  suite.addTestSuite(XMLRootComplexDifferentPrefixTestCases.class);
  suite.addTestSuite(XMLRootSimpleTestCases.class);
  suite.addTestSuite(XMLRootNoPrefixTestCases.class);
  suite.addTestSuite(XMLRootNullUriTestCases.class);
  suite.addTestSuite(XMLRootNullSchemaReferenceTestCases.class);
  suite.addTestSuite(XMLRootMultipleMarshalTestCases.class);
  return suite;
}
Program: 68737
Project: 68737
Buggy source:
protected void buildExpectedResults() throws Exception {
  ExpressionBuilder builder=new ExpressionBuilder();
  Vector employees=getSession().readAllObjects(Employee.class);
  for (Enumeration e=employees.elements(); e.hasMoreElements(); ) {
    Employee emp=(Employee)e.nextElement();
    Object[] result=new Object[2];
    result[0]=emp.getId();
    if (getSession().getPlatform().isOracle()) {
      result[1]=new java.math.BigDecimal(3);
    }
 else     if (getSession().getPlatform().isMySQL()) {
      result[1]=new java.lang.Long(3);
    }
 else {
      result[1]=new java.lang.Integer(3);
    }
    addResult(result,null);
  }
}

Fixed version (ground truth):
protected void buildExpectedResults() throws Exception {
  ExpressionBuilder builder=new ExpressionBuilder();
  Vector employees=getSession().readAllObjects(Employee.class);
  for (Enumeration e=employees.elements(); e.hasMoreElements(); ) {
    Employee emp=(Employee)e.nextElement();
    Object[] result=new Object[2];
    result[0]=emp.getId();
    if (getSession().getPlatform().isOracle() || getSession().getPlatform().isTimesTen7()) {
      result[1]=new java.math.BigDecimal(3);
    }
 else     if (getSession().getPlatform().isMySQL()) {
      result[1]=new java.lang.Long(3);
    }
 else {
      result[1]=new java.lang.Integer(3);
    }
    addResult(result,null);
  }
}
Program: 68738
Project: 68738
Buggy source:
private String getXPathForProperty(SDOProperty prop){
  if ((prop).getXmlMapping() != null) {
    return prop.getXmlMapping().getField().getName();
  }
 else {
    String name=prop.getName();
    if (prop.isOpenContent()) {
      String uri=prop.getUri();
      if (uri != null) {
        String prefix=((SDOTypeHelper)typeHelper).getNamespaceResolver().resolveNamespaceURI(uri);
        if ((prefix != null) && !prefix.equals(SDOConstants.EMPTY_STRING)) {
          return prefix + "String_Node_Str" + name;
        }
      }
    }
    return name;
  }
}

Fixed version (ground truth):
private String getXPathForProperty(SDOProperty prop,boolean removeText){
  if ((prop).getXmlMapping() != null) {
    String xpath=prop.getXmlMapping().getField().getName();
    if (removeText && xpath.endsWith("String_Node_Str")) {
      xpath=xpath.substring(0,xpath.length() - 7);
    }
    return xpath;
  }
 else {
    String name=prop.getName();
    if (prop.isOpenContent()) {
      String uri=prop.getUri();
      if (uri != null) {
        String prefix=((SDOTypeHelper)typeHelper).getNamespaceResolver().resolveNamespaceURI(uri);
        if ((prefix != null) && !prefix.equals(SDOConstants.EMPTY_STRING)) {
          return prefix + "String_Node_Str" + name;
        }
      }
    }
    return name;
  }
}
Program: 68741
Project: 68741
Buggy source:
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object collection=unmarshalRecord.getContainerInstance(this);
  if (null != unmarshalRecord.getChildRecord()) {
    if (!xmlAnyCollectionMapping.usesXMLRoot()) {
      unmarshalRecord.addAttributeValue(this,unmarshalRecord.getChildRecord().getCurrentObject());
    }
    if (xmlAnyCollectionMapping.usesXMLRoot()) {
      Object childObject=unmarshalRecord.getChildRecord().getCurrentObject();
      if (workingDescriptor != null) {
        String prefix=xPathFragment.getPrefix();
        if ((prefix == null) && (xPathFragment.getNamespaceURI() != null)) {
          prefix=unmarshalRecord.resolveNamespaceUri(xPathFragment.getNamespaceURI());
        }
        childObject=workingDescriptor.wrapObjectInXMLRoot(childObject,xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),prefix,false);
        unmarshalRecord.addAttributeValue(this,childObject);
      }
    }
    unmarshalRecord.setChildRecord(null);
    workingDescriptor=null;
  }
 else {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    if (builder.getNodes().size() != 0) {
      unmarshalRecord.addAttributeValue(this,builder.getNodes().pop());
    }
 else {
      endElementProcessText(unmarshalRecord,collection,xPathFragment);
    }
  }
}

Fixed version (ground truth):
public void endElement(XPathFragment xPathFragment,UnmarshalRecord unmarshalRecord){
  Object collection=unmarshalRecord.getContainerInstance(this);
  if (null != unmarshalRecord.getChildRecord()) {
    if (!xmlAnyCollectionMapping.usesXMLRoot()) {
      unmarshalRecord.addAttributeValue(this,unmarshalRecord.getChildRecord().getCurrentObject());
    }
    if (xmlAnyCollectionMapping.usesXMLRoot()) {
      Object childObject=unmarshalRecord.getChildRecord().getCurrentObject();
      if (workingDescriptor != null) {
        String prefix=xPathFragment.getPrefix();
        if ((prefix == null) && (xPathFragment.getNamespaceURI() != null)) {
          prefix=unmarshalRecord.resolveNamespaceUri(xPathFragment.getNamespaceURI());
        }
        childObject=workingDescriptor.wrapObjectInXMLRoot(childObject,xPathFragment.getNamespaceURI(),xPathFragment.getLocalName(),prefix,false);
        unmarshalRecord.addAttributeValue(this,childObject);
      }
    }
    unmarshalRecord.setChildRecord(null);
    workingDescriptor=null;
  }
 else {
    SAXFragmentBuilder builder=unmarshalRecord.getFragmentBuilder();
    UnmarshalKeepAsElementPolicy keepAsElementPolicy=xmlAnyCollectionMapping.getKeepAsElementPolicy();
    if ((((keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT) || (keepAsElementPolicy == UnmarshalKeepAsElementPolicy.KEEP_ALL_AS_ELEMENT))) && (builder.getNodes().size() != 0)) {
      unmarshalRecord.addAttributeValue(this,builder.getNodes().pop());
    }
 else {
      endElementProcessText(unmarshalRecord,collection,xPathFragment);
    }
  }
}
Program: 68743
Project: 68743
Buggy source:
public UnmappedContentHandlerWrapper(UnmappedContentHandler unmappedContentHandler,XMLUnmarshaller unmarshaller,XMLReader reader){
  super(null);
  this.depth=0;
  this.unmappedContentHandler=unmappedContentHandler;
  setUnmarshaller(unmarshaller);
  setXMLReader(reader);
  unmappedContentHandler.setUnmarshalRecord(this);
}

Fixed version (ground truth):
public UnmappedContentHandlerWrapper(UnmappedContentHandler unmappedContentHandler,SAXUnmarshallerHandler saxUnmarshallerHandler){
  super(null);
  this.depth=0;
  this.unmappedContentHandler=unmappedContentHandler;
  setUnmarshaller(saxUnmarshallerHandler.getUnmarshaller());
  setXMLReader(saxUnmarshallerHandler.getXMLReader());
  setUriToPrefixMap(saxUnmarshallerHandler.getUriToPrefixMap());
  setNamespaceMap(saxUnmarshallerHandler.getNamespaceMap());
  unmappedContentHandler.setUnmarshalRecord(this);
}
Program: 68744
Project: 68744
Buggy source:
public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException {
  levelIndex++;
  StartElementEvent event=new StartElementEvent(uri,localName,qName,atts);
  events.add(event);
  if (startOccurred) {
    processComplexElement();
    return;
  }
  startOccurred=true;
}

Fixed version (ground truth):
public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException {
  levelIndex++;
  Attributes copiedAttrs=buildAttributeList(atts);
  StartElementEvent event=new StartElementEvent(uri,localName,qName,copiedAttrs);
  events.add(event);
  if (startOccurred) {
    processComplexElement();
    return;
  }
  startOccurred=true;
}
Program: 68745
Project: 68745
Buggy source:
/** 
 * For bug 3107049 test a potential infinite loop on constantExp.equal(constantExp).
 */
private void addConstantEqualConstantTest(){
  ExpressionBuilder builder=new ExpressionBuilder();
  Expression expression=builder.value(1).equal(1);
  expression=expression.and(builder.value(1).equal(builder.value(1)));
  expression=expression.and(builder.value(1).equal(builder.getParameter("String_Node_Str")));
  ReadAllQuery query=new ReadAllQuery(Employee.class,expression);
  query.addArgument("String_Node_Str");
  ReadAllExpressionTest test=new ReadAllExpressionTest(Employee.class,12);
  test.setExpression(expression);
  test.setQuery(query);
  test.getArguments().add(new Integer(1));
  test.setName("String_Node_Str");
  test.setDescription("String_Node_Str");
  test.addUnsupportedPlatform(org.eclipse.persistence.platform.database.DB2Platform.class);
  addTest(test);
}

Fixed version (ground truth):
/** 
 * For bug 3107049 test a potential infinite loop on constantExp.equal(constantExp).
 */
private void addConstantEqualConstantTest(){
  ExpressionBuilder builder=new ExpressionBuilder();
  Expression expression=builder.value(1).equal(1);
  expression=expression.and(builder.value(1).equal(builder.value(1)));
  expression=expression.and(builder.value(1).equal(builder.getParameter("String_Node_Str")));
  ReadAllQuery query=new ReadAllQuery(Employee.class,expression);
  query.addArgument("String_Node_Str",Integer.class);
  ReadAllExpressionTest test=new ReadAllExpressionTest(Employee.class,12);
  test.setExpression(expression);
  test.setQuery(query);
  test.getArguments().add(new Integer(1));
  test.setName("String_Node_Str");
  test.setDescription("String_Node_Str");
  test.addUnsupportedPlatform(org.eclipse.persistence.platform.database.DB2Platform.class);
  addTest(test);
}
Program: 68746
Project: 68746
Buggy source:
public void setup(){
  if (getSession().getLogin().getDatasourcePlatform().isDB2() && (getEjbqlString() == "String_Node_Str")) {
    throw new TestWarningException("String_Node_Str");
  }
  if (!hasArguments()) {
    setArgumentsForTestUsing(getSomeEmployees());
  }
  ReadAllQuery raq=new ReadAllQuery();
  raq.setReferenceClass(Employee.class);
  raq.setSelectionCriteria(getOriginalObjectExpression());
  Enumeration enumtr=getExpressionParameters().elements();
  while (enumtr.hasMoreElements()) {
    raq.addArgument((String)enumtr.nextElement());
  }
  setOriginalOject(getSession().executeQuery(raq,getArguments()));
  super.setup();
}

Fixed version (ground truth):
public void setup(){
  if ((getSession().getLogin().getDatasourcePlatform().isDB2() || getSession().getLogin().getDatasourcePlatform().isTimesTen()) && (getEjbqlString() == "String_Node_Str")) {
    throw new TestWarningException("String_Node_Str");
  }
  if (!hasArguments()) {
    setArgumentsForTestUsing(getSomeEmployees());
  }
  ReadAllQuery raq=new ReadAllQuery();
  raq.setReferenceClass(Employee.class);
  raq.setSelectionCriteria(getOriginalObjectExpression());
  Enumeration enumtr=getExpressionParameters().elements();
  while (enumtr.hasMoreElements()) {
    raq.addArgument((String)enumtr.nextElement());
  }
  setOriginalOject(getSession().executeQuery(raq,getArguments()));
  super.setup();
}
Program: 68748
Project: 68748
Buggy source:
public void test() throws Exception {
  if (getSession().getPlatform().isDB2() || getSession().getPlatform().isAccess() || getSession().getPlatform().isSybase()) {
    throw new TestWarningException("String_Node_Str");
  }
  if ((getSession().getPlatform().isMySQL() || getSession().getPlatform().isTimesTen()) && lockMode == org.eclipse.persistence.queries.ObjectLevelReadQuery.LOCK_NOWAIT) {
    throw new TestWarningException("String_Node_Str");
  }
  ReadObjectQuery query=new ReadObjectQuery(Address.class);
  uow=getSession().acquireUnitOfWork();
  Address address=(Address)uow.executeQuery(query);
  String oldCity=address.getCountry();
  address.setCity("String_Node_Str");
  query.setShouldRefreshIdentityMapResult(true);
  query.setSelectionObject(address);
  Address newAddress=(Address)uow.executeQuery(query);
  strongAssert(!newAddress.getCity().equals("String_Node_Str"),"String_Node_Str");
  uow.release();
  uow=getSession().acquireUnitOfWork();
  query=new ReadObjectQuery(Address.class);
  query.dontAcquireLocks();
  address=(Address)uow.executeQuery(query);
  address.setCity("String_Node_Str");
  query=new ReadObjectQuery(Address.class);
  query.setSelectionObject(address);
  newAddress=(Address)uow.executeQuery(query);
  strongAssert(!newAddress.getCity().equals("String_Node_Str"),"String_Node_Str");
}

Fixed version (ground truth):
public void test() throws Exception {
  if (getSession().getPlatform().isDB2() || getSession().getPlatform().isAccess() || getSession().getPlatform().isSybase()) {
    throw new TestWarningException("String_Node_Str");
  }
  if ((getSession().getPlatform().isMySQL()) && lockMode == org.eclipse.persistence.queries.ObjectLevelReadQuery.LOCK_NOWAIT) {
    throw new TestWarningException("String_Node_Str");
  }
  ReadObjectQuery query=new ReadObjectQuery(Address.class);
  uow=getSession().acquireUnitOfWork();
  Address address=(Address)uow.executeQuery(query);
  String oldCity=address.getCountry();
  address.setCity("String_Node_Str");
  query.setShouldRefreshIdentityMapResult(true);
  query.setSelectionObject(address);
  Address newAddress=(Address)uow.executeQuery(query);
  strongAssert(!newAddress.getCity().equals("String_Node_Str"),"String_Node_Str");
  uow.release();
  uow=getSession().acquireUnitOfWork();
  query=new ReadObjectQuery(Address.class);
  query.dontAcquireLocks();
  address=(Address)uow.executeQuery(query);
  address.setCity("String_Node_Str");
  query=new ReadObjectQuery(Address.class);
  query.setSelectionObject(address);
  newAddress=(Address)uow.executeQuery(query);
  strongAssert(!newAddress.getCity().equals("String_Node_Str"),"String_Node_Str");
}
Program: 68750
Project: 68750
Buggy source:
/** 
 * INTERNAL: Get the attribute value for the given field value. If we're mapping to a Document, we need to check if we should return the Oracle DOM or build a new one.
 */
public Object getAttributeValue(Object fieldValue,AbstractSession session) throws DescriptorException {
  Object attributeValue=fieldValue;
  try {
    if (attributeValue != null) {
      if (getAttributeClassification() == ClassConstants.STRING) {
        if (session.getPlatform().isXDBDocument(attributeValue)) {
          return attributeValue.toString();
        }
 else {
          Document doc=(Document)attributeValue;
          StringWriter writer=new StringWriter();
          StreamResult result=new StreamResult(writer);
          xmlTransformer.transform(doc,result);
          return writer.getBuffer().toString();
        }
      }
    }
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(fieldValue,getAttributeClassification(),ex);
  }
  return attributeValue;
}

Fixed version (ground truth):
/** 
 * INTERNAL: Get the attribute value for the given field value. If we're mapping to a Document, we need to check if we should return the Oracle DOM or build a new one.
 */
public Object getAttributeValue(Object fieldValue,AbstractSession session) throws DescriptorException {
  Object attributeValue=fieldValue;
  try {
    if (attributeValue != null) {
      if (getAttributeClassification() != ClassConstants.STRING) {
        String xml=(String)attributeValue;
        java.io.StringReader reader=new java.io.StringReader(xml);
        return xmlParser.parse(reader);
      }
    }
  }
 catch (  Exception ex) {
    throw ConversionException.couldNotBeConverted(fieldValue,getAttributeClassification(),ex);
  }
  return attributeValue;
}
Program: 68751
Project: 68751
Buggy source:
public DirectToXMLTypeMapping(){
  super();
  xmlTransformer=XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  xmlTransformer.setFormattedOutput(false);
  xmlComparer=new XMLComparer();
}

Fixed version (ground truth):
public DirectToXMLTypeMapping(){
  super();
  xmlTransformer=XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  xmlTransformer.setFormattedOutput(false);
  xmlParser=XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
  xmlComparer=new XMLComparer();
}
Program: 68753
Project: 68753
Buggy source:
/** 
 * Common implementor for createSequence and replaceSequence
 */
protected void createOrReplaceSequences(boolean create,boolean drop) throws EclipseLinkException {
  Sequencing sequencing=getSession().getSequencing();
  if ((sequencing == null) || (sequencing.whenShouldAcquireValueForAll() == Sequencing.AFTER_INSERT)) {
    return;
  }
  HashMap tableDefinitions=new HashMap();
  HashSet sequenceDefinitions=new HashSet();
  HashSet processedSequenceNames=new HashSet();
  buildTableAndSequenceDefinitions(sequenceDefinitions,processedSequenceNames,tableDefinitions);
  processTableDefinitions(tableDefinitions,create);
  processSequenceDefinitions(sequenceDefinitions,drop);
}

Fixed version (ground truth):
/** 
 * Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects
 * @param createSequenceTables - true to create the sequences tables, false to replace them (dropped then create)
 * @param createSequenceObjects - true to create the sequences objects, false to replace them (dropped then create)
 */
protected void createOrReplaceSequences(boolean createSequenceTables,boolean createSequenceObjects) throws EclipseLinkException {
  boolean fast=FAST_TABLE_CREATOR;
  if (fast) {
    return;
  }
  Sequencing sequencing=getSession().getSequencing();
  if ((sequencing == null) || (sequencing.whenShouldAcquireValueForAll() == Sequencing.AFTER_INSERT)) {
    return;
  }
  HashMap tableDefinitions=new HashMap();
  HashSet sequenceDefinitions=new HashSet();
  HashSet processedSequenceNames=new HashSet();
  buildTableAndSequenceDefinitions(sequenceDefinitions,processedSequenceNames,tableDefinitions);
  processTableDefinitions(tableDefinitions,createSequenceTables);
  processSequenceDefinitions(sequenceDefinitions,createSequenceObjects);
}
Program: 68754
Project: 68754
Buggy source:
private void processTableDefinitions(final HashMap tableDefinitions,final boolean create) throws EclipseLinkException {
  Iterator itTableDefinitions=tableDefinitions.values().iterator();
  while (itTableDefinitions.hasNext()) {
    TableDefinition tableDefinition=(TableDefinition)itTableDefinitions.next();
    boolean shouldLogExceptionStackTrace=session.getSessionLog().shouldLogExceptionStackTrace();
    if (shouldLogExceptionStackTrace) {
      session.getSessionLog().setShouldLogExceptionStackTrace(false);
    }
    if (create) {
      try {
        createObject(tableDefinition);
      }
 catch (      DatabaseException exception) {
      }
 finally {
        if (shouldLogExceptionStackTrace) {
          session.getSessionLog().setShouldLogExceptionStackTrace(true);
        }
      }
    }
 else {
      try {
        dropObject(tableDefinition);
      }
 catch (      DatabaseException exception) {
      }
 finally {
        if (shouldLogExceptionStackTrace) {
          session.getSessionLog().setShouldLogExceptionStackTrace(true);
        }
      }
      createObject(tableDefinition);
    }
  }
}

Fixed version (ground truth):
/** 
 * Method creates database sequence tables.  If create is true, it will attempt to create the sequence tables and silently  ignore exceptions.  If create is false, it will drop the tables ignoring any exceptions, then create it.  
 * @param tableDefinitions - HashMap of Sequence table definitions
 * @param create - true if tables should be created, false if they should be replaced (dropped then created)
 * @throws TopLinkException
 */
private void processTableDefinitions(final HashMap tableDefinitions,final boolean create) throws EclipseLinkException {
  Iterator itTableDefinitions=tableDefinitions.values().iterator();
  boolean shouldLogExceptionStackTrace=session.getSessionLog().shouldLogExceptionStackTrace();
  while (itTableDefinitions.hasNext()) {
    TableDefinition tableDefinition=(TableDefinition)itTableDefinitions.next();
    processDatabaseObjectDefinition(tableDefinition,create,shouldLogExceptionStackTrace);
  }
}
Program: 68755
Project: 68755
Buggy source:
private void processSequenceDefinitions(final HashSet sequenceDefinitions,final boolean create) throws EclipseLinkException {
  Iterator itSequenceDefinitions=sequenceDefinitions.iterator();
  while (itSequenceDefinitions.hasNext()) {
    SequenceDefinition sequenceDefinition=(SequenceDefinition)itSequenceDefinitions.next();
    if (!create) {
      try {
        dropObject(sequenceDefinition);
      }
 catch (      DatabaseException exception) {
      }
    }
    createObject(sequenceDefinition);
  }
}

Fixed version (ground truth):
/** 
 * Method creates database sequence objects.  If create is true, it will attempt to create the sequence and silently ignore exceptions.  If create is false, it will drop the sequence ignoring any exceptions, then create it.  
 * @param sequenceDefinitions - HashSet of Sequence object definitions
 * @param create - true if sequenceDefinitions should be created, false if they should be replaced (dropped then created)
 * @throws TopLinkException
 */
private void processSequenceDefinitions(final HashSet sequenceDefinitions,final boolean create) throws EclipseLinkException {
  boolean shouldLogExceptionStackTrace=session.getSessionLog().shouldLogExceptionStackTrace();
  Iterator itSequenceDefinitions=sequenceDefinitions.iterator();
  while (itSequenceDefinitions.hasNext()) {
    SequenceDefinition sequenceDefinition=(SequenceDefinition)itSequenceDefinitions.next();
    processDatabaseObjectDefinition(sequenceDefinition,create,shouldLogExceptionStackTrace);
  }
}
Program: 68756
Project: 68756
Buggy source:
/** 
 * INTERNAL:
 */
public void createOnDatabase(AbstractSession session) throws EclipseLinkException {
  if (checkIfExist(session)) {
    alterOnDatabase(session);
  }
 else {
    super.createOnDatabase(session);
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Creates this sequence definition on the database.  If it already exists, the method will attempt to alter it based on what the platform supports.  
 */
public void createOnDatabase(AbstractSession session) throws EclipseLinkException {
  if (checkIfExist(session)) {
    if (this.isAlterSupported(session)) {
      alterOnDatabase(session);
    }
  }
 else {
    super.createOnDatabase(session);
  }
}
Program: 68757
Project: 68757
Buggy source:
private void processGlobalElement(String targetNamespace,String defaultNamespace,Element element){
  boolean addedNR=addNextNamespaceResolver(element.getAttributesMap());
  if (element.getName() != null) {
    QName qname=new QName(targetNamespace,element.getName());
    Object processed=processedElements.get(qname);
    if (processed == null) {
      processElement(targetNamespace,defaultNamespace,null,null,element,true,false);
      processedElements.put(qname,element);
    }
  }
 else {
    startGlobalElement(targetNamespace,defaultNamespace,element);
    processElement(targetNamespace,defaultNamespace,null,null,element,true,false);
  }
  if (addedNR) {
    namespaceResolvers.remove(namespaceResolvers.size() - 1);
  }
}

Fixed version (ground truth):
private void processGlobalElement(String targetNamespace,String defaultNamespace,Element element){
  if (element.getName() != null) {
    QName qname=new QName(targetNamespace,element.getName());
    Object processed=processedElements.get(qname);
    if (processed == null) {
      processElement(targetNamespace,defaultNamespace,null,null,element,true,false);
      processedElements.put(qname,element);
    }
  }
 else {
    startGlobalElement(targetNamespace,defaultNamespace,element);
    processElement(targetNamespace,defaultNamespace,null,null,element,true,false);
  }
}
Program: 68758
Project: 68758
Buggy source:
protected void processElement(String targetNamespace,String defaultNamespace,String ownerName,TypeDefParticle typeDefParticle,Element element,boolean isGlobal,boolean isMany){
  ComplexType complexType=element.getComplexType();
  boolean qualified=true;
  if (!isGlobal) {
    qualified=rootSchema.isElementFormDefault();
  }
  if (!isMany && maxOccursGreaterThanOne(element.getMaxOccurs())) {
    isMany=true;
  }
  if (complexType != null) {
    processComplexType(targetNamespace,defaultNamespace,element.getName(),complexType);
    processSimpleElement(targetNamespace,defaultNamespace,ownerName,typeDefParticle,element,qualified,isGlobal,isMany);
  }
 else   if (element.getSimpleType() != null) {
    processSimpleType(targetNamespace,defaultNamespace,element.getName(),element.getSimpleType());
    processSimpleElement(targetNamespace,defaultNamespace,ownerName,typeDefParticle,element,qualified,isGlobal,isMany);
  }
 else {
    processSimpleElement(targetNamespace,defaultNamespace,ownerName,typeDefParticle,element,qualified,isGlobal,isMany);
  }
}

Fixed version (ground truth):
protected void processElement(String targetNamespace,String defaultNamespace,String ownerName,TypeDefParticle typeDefParticle,Element element,boolean isGlobal,boolean isMany){
  boolean addedNR=addNextNamespaceResolver(element.getAttributesMap());
  ComplexType complexType=element.getComplexType();
  boolean qualified=true;
  if (!isGlobal) {
    qualified=rootSchema.isElementFormDefault();
  }
  if (!isMany && maxOccursGreaterThanOne(element.getMaxOccurs())) {
    isMany=true;
  }
  if (complexType != null) {
    processComplexType(targetNamespace,defaultNamespace,element.getName(),complexType);
    processSimpleElement(targetNamespace,defaultNamespace,ownerName,typeDefParticle,element,qualified,isGlobal,isMany);
  }
 else   if (element.getSimpleType() != null) {
    processSimpleType(targetNamespace,defaultNamespace,element.getName(),element.getSimpleType());
    processSimpleElement(targetNamespace,defaultNamespace,ownerName,typeDefParticle,element,qualified,isGlobal,isMany);
  }
 else {
    processSimpleElement(targetNamespace,defaultNamespace,ownerName,typeDefParticle,element,qualified,isGlobal,isMany);
  }
  if (addedNR) {
    namespaceResolvers.remove(namespaceResolvers.size() - 1);
  }
}