Program: 147903
Project: 147903
Buggy source:
public static ArrayList<Object> getComplexTypeDefinitionChildren(XSDComplexTypeDefinition complexTypeDefinition){
  XSDComplexTypeContent xsdComplexTypeContent=complexTypeDefinition.getContent();
  ArrayList<Object> list=new ArrayList<Object>();
  if (xsdComplexTypeContent == null) {
    XSDTypeDefinition typeDefinition=complexTypeDefinition.getBaseTypeDefinition();
    if (typeDefinition instanceof XSDSimpleTypeDefinition) {
      list.add(typeDefinition);
      return list;
    }
 else {
    }
    xsdComplexTypeContent=((XSDComplexTypeDefinition)typeDefinition).getContent();
  }
  if ("String_Node_Str".equals(complexTypeDefinition.getDerivationMethod().getName())) {
    if (complexTypeDefinition.getBaseTypeDefinition() instanceof XSDComplexTypeDefinition) {
      list.addAll(getComplexTypeDefinitionChildren((XSDComplexTypeDefinition)complexTypeDefinition.getBaseTypeDefinition()));
    }
  }
  if (complexTypeDefinition.getAttributeContents() != null)   list.addAll(complexTypeDefinition.getAttributeContents());
  if (complexTypeDefinition.getAnnotations() != null)   list.addAll(complexTypeDefinition.getAnnotations());
  if (xsdComplexTypeContent instanceof XSDSimpleTypeDefinition) {
    list.add(xsdComplexTypeContent);
    return list;
  }
  if (xsdComplexTypeContent instanceof XSDParticle) {
    if (((XSDParticle)xsdComplexTypeContent).getTerm() instanceof XSDModelGroup) {
      list.add(((XSDParticle)xsdComplexTypeContent).getTerm());
      return list;
    }
 else {
      list.add(((XSDParticle)xsdComplexTypeContent).getTerm());
      return list;
    }
  }
  list.add(xsdComplexTypeContent);
  return list;
}

Fixed version (ground truth):
public static ArrayList<Object> getComplexTypeDefinitionChildren(XSDComplexTypeDefinition complexTypeDefinition){
  XSDComplexTypeContent xsdComplexTypeContent=complexTypeDefinition.getContent();
  ArrayList<Object> list=new ArrayList<Object>();
  if (xsdComplexTypeContent == null) {
    XSDTypeDefinition typeDefinition=complexTypeDefinition.getBaseTypeDefinition();
    if (typeDefinition instanceof XSDSimpleTypeDefinition) {
      list.add(typeDefinition);
      return list;
    }
 else {
    }
    xsdComplexTypeContent=((XSDComplexTypeDefinition)typeDefinition).getContent();
  }
  if ("String_Node_Str".equals(complexTypeDefinition.getDerivationMethod().getName())) {
    if (complexTypeDefinition.getBaseTypeDefinition() instanceof XSDComplexTypeDefinition) {
      String name=((XSDComplexTypeDefinition)complexTypeDefinition.getBaseTypeDefinition()).getDerivationMethod().getName();
      if (name.equals("String_Node_Str"))       list.addAll(getComplexTypeDefinitionChildren((XSDComplexTypeDefinition)complexTypeDefinition.getBaseTypeDefinition()));
    }
  }
  if (complexTypeDefinition.getAttributeContents() != null)   list.addAll(complexTypeDefinition.getAttributeContents());
  if (complexTypeDefinition.getAnnotations() != null)   list.addAll(complexTypeDefinition.getAnnotations());
  if (xsdComplexTypeContent instanceof XSDSimpleTypeDefinition) {
    list.add(xsdComplexTypeContent);
    return list;
  }
  if (xsdComplexTypeContent instanceof XSDParticle) {
    if (((XSDParticle)xsdComplexTypeContent).getTerm() instanceof XSDModelGroup) {
      list.add(((XSDParticle)xsdComplexTypeContent).getTerm());
      return list;
    }
 else {
      list.add(((XSDParticle)xsdComplexTypeContent).getTerm());
      return list;
    }
  }
  list.add(xsdComplexTypeContent);
  return list;
}