Program: 68709
Project: 68709
Buggy source:
public void addToSchemaType(ArrayList<Property> properties,TypeDefParticle compositor,ComplexType type,Schema schema){
  for (  Property next : properties) {
    if (next == null) {
      continue;
    }
    TypeDefParticle parentCompositor=compositor;
    boolean isChoice=(parentCompositor instanceof Choice);
    ComplexType parentType=type;
    if (!helper.isAnnotationPresent(next.getElement(),XmlTransient.class)) {
      if (!isChoice && helper.isAnnotationPresent(next.getElement(),XmlElementWrapper.class)) {
        XmlElementWrapper wrapper=(XmlElementWrapper)helper.getAnnotation(next.getElement(),XmlElementWrapper.class);
        Element wrapperElement=new Element();
        wrapperElement.setName(wrapper.name());
        wrapperElement.setMinOccurs("String_Node_Str");
        compositor.addElement(wrapperElement);
        ComplexType wrapperType=new ComplexType();
        Sequence wrapperSequence=new Sequence();
        wrapperType.setSequence(wrapperSequence);
        wrapperElement.setComplexType(wrapperType);
        parentType=wrapperType;
        parentCompositor=wrapperSequence;
      }
      if (helper.isAnnotationPresent(next.getElement(),XmlAttribute.class)) {
        Attribute attribute=new Attribute();
        QName attributeName=next.getSchemaName();
        attribute.setName(attributeName.getLocalPart());
        JavaClass javaType=next.getType();
        if (next.getGenericType() != null) {
          javaType=(JavaClass)next.getGenericType();
        }
        String typeName=null;
        TypeInfo info=(TypeInfo)typeInfo.get(next.getType().getQualifiedName());
        if (info != null) {
          if (!info.isComplexType()) {
            typeName=info.getSimpleType().getName();
          }
        }
 else {
          if (helper.isAnnotationPresent(next.getElement(),XmlID.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (helper.isAnnotationPresent(next.getElement(),XmlIDREF.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else {
            QName schemaType=next.getSchemaType();
            if (schemaType == null) {
              schemaType=getSchemaTypeFor(javaType);
            }
            if (schemaType != null) {
              typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str" + schemaType.getLocalPart();
            }
 else {
              typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
            }
          }
        }
        if (isCollectionType(next)) {
          SimpleType localType=new SimpleType();
          org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
          list.setItemType(typeName);
          localType.setList(list);
          attribute.setSimpleType(localType);
        }
 else {
          if (typeName != null && !typeName.contains("String_Node_Str")) {
            if (info.getSchema() == schema) {
              String prefix=getPrefixForNamespace(schema.getTargetNamespace(),schema.getNamespaceResolver());
              if (prefix != null) {
                typeName=prefix + "String_Node_Str" + typeName;
              }
            }
          }
          attribute.setType(typeName);
        }
        if (!attributeName.getNamespaceURI().equals("String_Node_Str")) {
          Schema attributeSchema=this.getSchemaForNamespace(attributeName.getNamespaceURI());
          if (attributeSchema.getTopLevelAttributes().get(attribute.getName()) == null) {
            attributeSchema.getTopLevelAttributes().put(attribute.getName(),attribute);
          }
          if (schema.getImports().get(attributeSchema.getName()) == null) {
            Import schemaImport=new Import();
            schemaImport.setNamespace(attributeSchema.getTargetNamespace());
            schemaImport.setSchemaLocation(attributeSchema.getName());
            schema.getImports().put(schemaImport.getSchemaLocation(),schemaImport);
            schema.getNamespaceResolver().put(schema.getNamespaceResolver().generatePrefix(),attributeSchema.getTargetNamespace());
          }
          Attribute reference=new Attribute();
          String prefix=getPrefixForNamespace(attributeSchema.getTargetNamespace(),schema.getNamespaceResolver());
          if (prefix == null) {
            reference.setRef(attribute.getName());
          }
 else {
            reference.setRef(prefix + "String_Node_Str" + attribute.getName());
          }
          if (parentType.getSimpleContent() != null) {
            parentType.getSimpleContent().getExtension().getOrderedAttributes().add(reference);
          }
 else {
            parentType.getOrderedAttributes().add(reference);
          }
        }
 else {
          if (parentType.getSimpleContent() != null) {
            parentType.getSimpleContent().getExtension().getOrderedAttributes().add(attribute);
          }
 else {
            parentType.getOrderedAttributes().add(attribute);
          }
        }
      }
 else       if (helper.isAnnotationPresent(next.getElement(),XmlAnyAttribute.class)) {
        AnyAttribute anyAttribute=new AnyAttribute();
        anyAttribute.setProcessContents(AnyAttribute.LAX);
        if (type.getSimpleContent() != null) {
          SimpleContent content=type.getSimpleContent();
          content.getRestriction().setAnyAttribute(anyAttribute);
        }
 else {
          type.setAnyAttribute(anyAttribute);
        }
      }
 else       if (next.isChoice()) {
        Choice choice=new Choice();
        ArrayList<Property> choiceProperties=(ArrayList<Property>)((ChoiceProperty)next).getChoiceProperties();
        addToSchemaType(choiceProperties,choice,parentType,schema);
        if (parentCompositor instanceof Sequence) {
          ((Sequence)parentCompositor).addChoice(choice);
        }
 else         if (parentCompositor instanceof Choice) {
          ((Choice)parentCompositor).addChoice(choice);
        }
      }
 else       if (next.isAny()) {
        Any any=new Any();
        AnyProperty anyProp=(AnyProperty)next;
        if (anyProp.isLax()) {
          any.setProcessContents("String_Node_Str");
        }
        if (parentCompositor instanceof Sequence) {
          ((Sequence)parentCompositor).addAny(any);
        }
 else         if (parentCompositor instanceof Choice) {
          ((Choice)parentCompositor).addAny(any);
        }
      }
 else       if (!helper.isAnnotationPresent(next.getElement(),XmlValue.class)) {
        Element element=new Element();
        element.setMinOccurs(next.isRequired() ? "String_Node_Str" : "String_Node_Str");
        QName elementName=next.getSchemaName();
        JavaClass javaType=next.getType();
        boolean isCollectionType=isCollectionType(next);
        if (isCollectionType) {
          JavaClass gType=next.getGenericType();
          if (gType != null && gType.hasActualTypeArguments()) {
            Object[] params=gType.getActualTypeArguments().toArray();
            javaType=(JavaClass)params[0];
          }
        }
        element.setName(elementName.getLocalPart());
        TypeInfo info=(TypeInfo)typeInfo.get(javaType.getQualifiedName());
        String typeName=null;
        boolean isComplexType=false;
        if (info != null) {
          if (helper.isAnnotationPresent(next.getElement(),XmlID.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (helper.isAnnotationPresent(next.getElement(),XmlIDREF.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else {
            isComplexType=info.isComplexType();
            if (info.isComplexType()) {
              typeName=info.getComplexType().getName();
            }
 else {
              typeName=info.getSimpleType().getName();
            }
          }
          if (typeName == null) {
            if (!info.hasRootElement()) {
              if (info.isComplexType()) {
                element.setComplexType(info.getComplexType());
              }
 else {
                element.setSimpleType(info.getSimpleType());
              }
            }
          }
          if (info.getSchema() != schema) {
            if (schema.getImports().get(info.getSchema().getName()) == null) {
              Import schemaImport=new Import();
              schemaImport.setSchemaLocation(info.getSchema().getName());
              schemaImport.setNamespace(info.getSchema().getTargetNamespace());
              schema.getImports().put(schemaImport.getSchemaLocation(),schemaImport);
              if (schemaImport.getNamespace() != null) {
                schema.getNamespaceResolver().put(schema.getNamespaceResolver().generatePrefix(),schemaImport.getNamespace());
              }
              String prefix=getPrefixForNamespace(info.getSchema().getTargetNamespace(),schema.getNamespaceResolver());
              if (prefix != null && !typeName.equals("String_Node_Str")) {
                typeName=prefix + "String_Node_Str" + typeName;
              }
            }
          }
        }
 else {
          QName schemaType=next.getSchemaType();
          if (schemaType == null) {
            schemaType=getSchemaTypeFor(javaType);
          }
          if (schemaType != null) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str" + schemaType.getLocalPart();
          }
        }
        if (typeName != null && !typeName.contains("String_Node_Str")) {
          if (info.getSchema() == schema) {
            String prefix=getPrefixForNamespace(schema.getTargetNamespace(),schema.getNamespaceResolver());
            if (prefix != null) {
              typeName=prefix + "String_Node_Str" + typeName;
            }
          }
        }
        if (isCollectionType) {
          if (helper.isAnnotationPresent(next.getElement(),XmlList.class)) {
            if (isComplexType) {
            }
            SimpleType localSimpleType=new SimpleType();
            org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
            list.setItemType(typeName);
            localSimpleType.setList(list);
            element.setSimpleType(localSimpleType);
          }
 else {
            element.setMaxOccurs("String_Node_Str");
            element.setType(typeName);
          }
        }
 else {
          element.setType(typeName);
        }
        if (!elementName.getNamespaceURI().equals("String_Node_Str")) {
          Element reference=new Element();
          reference.setMinOccurs(element.getMinOccurs());
          reference.setMaxOccurs(element.getMaxOccurs());
          Schema attributeSchema=this.getSchemaForNamespace(elementName.getNamespaceURI());
          if (attributeSchema.getTopLevelElements().get(element.getName()) == null) {
            element.setMinOccurs(null);
            element.setMaxOccurs(null);
            attributeSchema.getTopLevelElements().put(element.getName(),element);
          }
          if (attributeSchema != schema && schema.getImports().get(attributeSchema.getName()) == null) {
            Import schemaImport=new Import();
            schemaImport.setNamespace(attributeSchema.getTargetNamespace());
            schemaImport.setSchemaLocation(attributeSchema.getName());
            schema.getImports().put(schemaImport.getSchemaLocation(),schemaImport);
            schema.getNamespaceResolver().put(schema.getNamespaceResolver().generatePrefix(),attributeSchema.getTargetNamespace());
          }
          String prefix=getPrefixForNamespace(attributeSchema.getTargetNamespace(),schema.getNamespaceResolver());
          if (prefix == null) {
            reference.setRef(element.getName());
          }
 else {
            reference.setRef(prefix + "String_Node_Str" + element.getName());
          }
          parentCompositor.addElement(reference);
        }
 else {
          parentCompositor.addElement(element);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void addToSchemaType(ArrayList<Property> properties,TypeDefParticle compositor,ComplexType type,Schema schema){
  for (  Property next : properties) {
    if (next == null) {
      continue;
    }
    TypeDefParticle parentCompositor=compositor;
    boolean isChoice=(parentCompositor instanceof Choice);
    ComplexType parentType=type;
    if (!helper.isAnnotationPresent(next.getElement(),XmlTransient.class)) {
      if (!isChoice && helper.isAnnotationPresent(next.getElement(),XmlElementWrapper.class)) {
        XmlElementWrapper wrapper=(XmlElementWrapper)helper.getAnnotation(next.getElement(),XmlElementWrapper.class);
        Element wrapperElement=new Element();
        wrapperElement.setName(wrapper.name());
        wrapperElement.setMinOccurs("String_Node_Str");
        compositor.addElement(wrapperElement);
        ComplexType wrapperType=new ComplexType();
        Sequence wrapperSequence=new Sequence();
        wrapperType.setSequence(wrapperSequence);
        wrapperElement.setComplexType(wrapperType);
        parentType=wrapperType;
        parentCompositor=wrapperSequence;
      }
      if (helper.isAnnotationPresent(next.getElement(),XmlAttribute.class)) {
        Attribute attribute=new Attribute();
        QName attributeName=next.getSchemaName();
        attribute.setName(attributeName.getLocalPart());
        JavaClass javaType=next.getType();
        if (next.getGenericType() != null) {
          javaType=(JavaClass)next.getGenericType();
        }
        String typeName=null;
        TypeInfo info=(TypeInfo)typeInfo.get(next.getType().getQualifiedName());
        if (info != null) {
          if (!info.isComplexType()) {
            typeName=info.getSimpleType().getName();
          }
        }
 else {
          if (helper.isAnnotationPresent(next.getElement(),XmlID.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (helper.isAnnotationPresent(next.getElement(),XmlIDREF.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else {
            QName schemaType=next.getSchemaType();
            if (schemaType == null) {
              schemaType=getSchemaTypeFor(javaType);
            }
            if (schemaType != null) {
              typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str" + schemaType.getLocalPart();
            }
 else {
              typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
            }
          }
        }
        if (isCollectionType(next)) {
          SimpleType localType=new SimpleType();
          org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
          list.setItemType(typeName);
          localType.setList(list);
          attribute.setSimpleType(localType);
        }
 else {
          if (typeName != null && !typeName.contains("String_Node_Str")) {
            if (info.getSchema() == schema) {
              String prefix=getPrefixForNamespace(schema.getTargetNamespace(),schema.getNamespaceResolver());
              if (prefix != null) {
                typeName=prefix + "String_Node_Str" + typeName;
              }
            }
          }
          attribute.setType(typeName);
        }
        if (!attributeName.getNamespaceURI().equals("String_Node_Str")) {
          Schema attributeSchema=this.getSchemaForNamespace(attributeName.getNamespaceURI());
          if (attributeSchema.getTopLevelAttributes().get(attribute.getName()) == null) {
            attributeSchema.getTopLevelAttributes().put(attribute.getName(),attribute);
          }
          if (!importExists(schema,attributeSchema.getName())) {
            Import schemaImport=new Import();
            schemaImport.setNamespace(attributeSchema.getTargetNamespace());
            schemaImport.setSchemaLocation(attributeSchema.getName());
            schema.getImports().add(schemaImport);
            schema.getNamespaceResolver().put(schema.getNamespaceResolver().generatePrefix(),attributeSchema.getTargetNamespace());
          }
          Attribute reference=new Attribute();
          String prefix=getPrefixForNamespace(attributeSchema.getTargetNamespace(),schema.getNamespaceResolver());
          if (prefix == null) {
            reference.setRef(attribute.getName());
          }
 else {
            reference.setRef(prefix + "String_Node_Str" + attribute.getName());
          }
          if (parentType.getSimpleContent() != null) {
            parentType.getSimpleContent().getExtension().getOrderedAttributes().add(reference);
          }
 else {
            parentType.getOrderedAttributes().add(reference);
          }
        }
 else {
          if (parentType.getSimpleContent() != null) {
            parentType.getSimpleContent().getExtension().getOrderedAttributes().add(attribute);
          }
 else {
            parentType.getOrderedAttributes().add(attribute);
          }
        }
      }
 else       if (helper.isAnnotationPresent(next.getElement(),XmlAnyAttribute.class)) {
        AnyAttribute anyAttribute=new AnyAttribute();
        anyAttribute.setProcessContents(AnyAttribute.LAX);
        if (type.getSimpleContent() != null) {
          SimpleContent content=type.getSimpleContent();
          content.getRestriction().setAnyAttribute(anyAttribute);
        }
 else {
          type.setAnyAttribute(anyAttribute);
        }
      }
 else       if (next.isChoice()) {
        Choice choice=new Choice();
        ArrayList<Property> choiceProperties=(ArrayList<Property>)((ChoiceProperty)next).getChoiceProperties();
        addToSchemaType(choiceProperties,choice,parentType,schema);
        if (parentCompositor instanceof Sequence) {
          ((Sequence)parentCompositor).addChoice(choice);
        }
 else         if (parentCompositor instanceof Choice) {
          ((Choice)parentCompositor).addChoice(choice);
        }
      }
 else       if (next.isAny()) {
        Any any=new Any();
        AnyProperty anyProp=(AnyProperty)next;
        if (anyProp.isLax()) {
          any.setProcessContents("String_Node_Str");
        }
        if (parentCompositor instanceof Sequence) {
          ((Sequence)parentCompositor).addAny(any);
        }
 else         if (parentCompositor instanceof Choice) {
          ((Choice)parentCompositor).addAny(any);
        }
      }
 else       if (!helper.isAnnotationPresent(next.getElement(),XmlValue.class)) {
        Element element=new Element();
        element.setMinOccurs(next.isRequired() ? "String_Node_Str" : "String_Node_Str");
        QName elementName=next.getSchemaName();
        JavaClass javaType=next.getType();
        boolean isCollectionType=isCollectionType(next);
        if (isCollectionType) {
          JavaClass gType=next.getGenericType();
          if (gType != null && gType.hasActualTypeArguments()) {
            Object[] params=gType.getActualTypeArguments().toArray();
            javaType=(JavaClass)params[0];
          }
        }
        element.setName(elementName.getLocalPart());
        TypeInfo info=(TypeInfo)typeInfo.get(javaType.getQualifiedName());
        String typeName=null;
        boolean isComplexType=false;
        if (info != null) {
          if (helper.isAnnotationPresent(next.getElement(),XmlID.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else           if (helper.isAnnotationPresent(next.getElement(),XmlIDREF.class)) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str";
          }
 else {
            isComplexType=info.isComplexType();
            if (info.isComplexType()) {
              typeName=info.getComplexType().getName();
            }
 else {
              typeName=info.getSimpleType().getName();
            }
          }
          if (typeName == null) {
            if (!info.hasRootElement()) {
              if (info.isComplexType()) {
                element.setComplexType(info.getComplexType());
              }
 else {
                element.setSimpleType(info.getSimpleType());
              }
            }
          }
          if (info.getSchema() != schema) {
            if (!importExists(schema,info.getSchema().getName())) {
              Import schemaImport=new Import();
              schemaImport.setSchemaLocation(info.getSchema().getName());
              schemaImport.setNamespace(info.getSchema().getTargetNamespace());
              schema.getImports().add(schemaImport);
              if (schemaImport.getNamespace() != null) {
                schema.getNamespaceResolver().put(schema.getNamespaceResolver().generatePrefix(),schemaImport.getNamespace());
              }
              String prefix=getPrefixForNamespace(info.getSchema().getTargetNamespace(),schema.getNamespaceResolver());
              if (prefix != null && !typeName.equals("String_Node_Str")) {
                typeName=prefix + "String_Node_Str" + typeName;
              }
            }
          }
        }
 else {
          QName schemaType=next.getSchemaType();
          if (schemaType == null) {
            schemaType=getSchemaTypeFor(javaType);
          }
          if (schemaType != null) {
            typeName=XMLConstants.SCHEMA_PREFIX + "String_Node_Str" + schemaType.getLocalPart();
          }
        }
        if (typeName != null && !typeName.contains("String_Node_Str")) {
          if (info.getSchema() == schema) {
            String prefix=getPrefixForNamespace(schema.getTargetNamespace(),schema.getNamespaceResolver());
            if (prefix != null) {
              typeName=prefix + "String_Node_Str" + typeName;
            }
          }
        }
        if (isCollectionType) {
          if (helper.isAnnotationPresent(next.getElement(),XmlList.class)) {
            if (isComplexType) {
            }
            SimpleType localSimpleType=new SimpleType();
            org.eclipse.persistence.internal.oxm.schema.model.List list=new org.eclipse.persistence.internal.oxm.schema.model.List();
            list.setItemType(typeName);
            localSimpleType.setList(list);
            element.setSimpleType(localSimpleType);
          }
 else {
            element.setMaxOccurs("String_Node_Str");
            element.setType(typeName);
          }
        }
 else {
          element.setType(typeName);
        }
        if (!elementName.getNamespaceURI().equals("String_Node_Str")) {
          Element reference=new Element();
          reference.setMinOccurs(element.getMinOccurs());
          reference.setMaxOccurs(element.getMaxOccurs());
          Schema attributeSchema=this.getSchemaForNamespace(elementName.getNamespaceURI());
          if (attributeSchema.getTopLevelElements().get(element.getName()) == null) {
            element.setMinOccurs(null);
            element.setMaxOccurs(null);
            attributeSchema.getTopLevelElements().put(element.getName(),element);
          }
          if (attributeSchema != schema && (!importExists(schema,attributeSchema.getName()))) {
            Import schemaImport=new Import();
            schemaImport.setNamespace(attributeSchema.getTargetNamespace());
            schemaImport.setSchemaLocation(attributeSchema.getName());
            schema.getImports().add(schemaImport);
            schema.getNamespaceResolver().put(schema.getNamespaceResolver().generatePrefix(),attributeSchema.getTargetNamespace());
          }
          String prefix=getPrefixForNamespace(attributeSchema.getTargetNamespace(),schema.getNamespaceResolver());
          if (prefix == null) {
            reference.setRef(element.getName());
          }
 else {
            reference.setRef(prefix + "String_Node_Str" + element.getName());
          }
          parentCompositor.addElement(reference);
        }
 else {
          parentCompositor.addElement(element);
        }
      }
    }
  }
}