Program: 148337
Project: 148337
Buggy source:
public Object[] getChildren(Object parent){
  if (parent == null) {
    System.out.println("String_Node_Str");
  }
  if (parent instanceof XSDSchema) {
    EList xsdElementDeclarations=xsdSchema.getTypeDefinitions();
    List<XSDTypeDefinition> list=new ArrayList<XSDTypeDefinition>();
    for (    XSDTypeDefinition el : (XSDTypeDefinition[])xsdElementDeclarations.toArray(new XSDTypeDefinition[xsdElementDeclarations.size()])) {
      boolean exist=false;
      for (      XSDTypeDefinition type : list) {
        if (type.getName().equals(el.getName()) && type.getTargetNamespace() != null && el.getTargetNamespace() != null && type.getTargetNamespace().equals(el.getTargetNamespace())) {
          exist=true;
          break;
        }
 else         if (type.getName().equals(el.getName()) && type.getTargetNamespace() == null && el.getTargetNamespace() == null) {
          exist=true;
          break;
        }
      }
      if (!exist && (el.getTargetNamespace() != null && !el.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) || el.getTargetNamespace() == null) {
        list.add(el);
      }
    }
    return list.toArray(new XSDTypeDefinition[list.size()]);
  }
  if (parent instanceof XSDAttributeGroupDefinition) {
    XSDAttributeGroupDefinition attributeGroupDefinition=(XSDAttributeGroupDefinition)parent;
    if (attributeGroupDefinition.getContents().size() == 0)     attributeGroupDefinition=attributeGroupDefinition.getResolvedAttributeGroupDefinition();
    return attributeGroupDefinition.getContents().toArray(new Object[attributeGroupDefinition.getContents().size()]);
  }
  if (parent instanceof XSDParticle) {
    XSDParticle xsdParticle=(XSDParticle)parent;
    return getXSDParticleChildren(xsdParticle);
  }
  if (parent instanceof XSDTypeDefinition) {
    if (parent instanceof XSDSimpleTypeDefinition) {
      XSDSimpleTypeDefinition std=(XSDSimpleTypeDefinition)parent;
      if (std.getVariety().equals(XSDVariety.ATOMIC_LITERAL)) {
        ArrayList list=new ArrayList();
        if (std != null && std.getSchema() != null && std.getSchema().getSchemaForSchema() != null)         if (!std.getSchema().getSchemaForSchema().getTypeDefinitions().contains(std))         list.add(std.getBaseTypeDefinition());
        list.addAll(std.getFacetContents());
        return list.toArray(new Object[list.size()]);
      }
      if (std.getVariety().equals(XSDVariety.LIST_LITERAL)) {
        return new XSDSimpleTypeDefinition[]{std.getBaseTypeDefinition()};
      }
      if (std.getVariety().equals(XSDVariety.UNION_LITERAL))       return (XSDSimpleTypeDefinition[])(std.getMemberTypeDefinitions().toArray(new XSDSimpleTypeDefinition[std.getMemberTypeDefinitions().size()]));
    }
    if (parent instanceof XSDComplexTypeDefinition) {
      XSDComplexTypeContent xsdComplexTypeContent=((XSDComplexTypeDefinition)parent).getContent();
      ArrayList<Object> list=new ArrayList<Object>();
      list.addAll(((XSDComplexTypeDefinition)parent).getAttributeContents());
      if (xsdComplexTypeContent == null) {
        XSDComplexTypeDefinition ctd=(XSDComplexTypeDefinition)parent;
        list.add(ctd.getBaseTypeDefinition());
        return list.toArray(new Object[list.size()]);
      }
 else {
        if (xsdComplexTypeContent instanceof XSDSimpleTypeDefinition) {
          list.add(xsdComplexTypeContent);
          return list.toArray(new Object[list.size()]);
        }
        if (xsdComplexTypeContent instanceof XSDParticle)         return getXSDParticleChildren((XSDParticle)xsdComplexTypeContent);
        list.add(((XSDComplexTypeDefinition)parent).getContent());
        return list.toArray(new Object[list.size()]);
      }
    }
  }
  if (parent instanceof XSDModelGroup) {
    XSDModelGroup modelGroup=((XSDModelGroup)parent);
    EList list=modelGroup.getContents();
    List<XSDParticle> ls=new ArrayList<XSDParticle>();
    if (filter != null && !filter.isAll()) {
      for (      XSDParticle el : (XSDParticle[])list.toArray(new XSDParticle[list.size()])) {
        XSDTerm tm=el.getTerm();
        if (tm instanceof XSDElementDeclaration) {
          XSDAnnotation annotation=((XSDElementDeclaration)tm).getAnnotation();
          if (isInclude(annotation)) {
            ls.add(el);
          }
        }
      }
      return ls.toArray(new XSDParticle[ls.size()]);
    }
    return list.toArray(new Object[list.size()]);
  }
  if (parent instanceof XSDSimpleTypeDefinition) {
    XSDSimpleTypeDefinition std=(XSDSimpleTypeDefinition)parent;
    if (std.getVariety().equals(XSDVariety.ATOMIC_LITERAL)) {
      ArrayList list=new ArrayList();
      if (!std.getSchema().getSchemaForSchema().getTypeDefinitions().contains(std))       list.add(std.getBaseTypeDefinition());
      list.addAll(std.getFacetContents());
      return list.toArray(new Object[list.size()]);
    }
    if (std.getVariety().equals(XSDVariety.LIST_LITERAL)) {
      return new XSDSimpleTypeDefinition[]{std.getBaseTypeDefinition()};
    }
    if (std.getVariety().equals(XSDVariety.UNION_LITERAL))     return std.getMemberTypeDefinitions().toArray(new XSDSimpleTypeDefinition[std.getMemberTypeDefinitions().size()]);
  }
  if (parent instanceof XSDIdentityConstraintDefinition) {
    ArrayList list=new ArrayList();
    if (filter != null && !filter.isAll()) {
    }
 else {
      list.add(((XSDIdentityConstraintDefinition)parent).getSelector());
      list.addAll(((XSDIdentityConstraintDefinition)parent).getFields());
    }
    return list.toArray(new Object[list.size()]);
  }
  if (parent instanceof XSDAnnotation) {
    ArrayList list=new ArrayList();
    if (filter != null && !filter.isAll()) {
    }
 else {
      XSDAnnotation annotation=(XSDAnnotation)parent;
      list.addAll(annotation.getUserInformation());
      list.addAll(annotation.getApplicationInformation());
    }
    return list.size() == 0 ? new Object[0] : list.toArray(new Object[list.size()]);
  }
  if (parent instanceof Element) {
    return new Object[0];
  }
  return new Object[0];
}

Fixed version (ground truth):
public Object[] getChildren(Object parent){
  if (parent == null) {
    log.info("String_Node_Str");
  }
  if (parent instanceof XSDSchema) {
    EList xsdElementDeclarations=xsdSchema.getTypeDefinitions();
    List<XSDTypeDefinition> list=new ArrayList<XSDTypeDefinition>();
    for (    XSDTypeDefinition el : (XSDTypeDefinition[])xsdElementDeclarations.toArray(new XSDTypeDefinition[xsdElementDeclarations.size()])) {
      boolean exist=false;
      for (      XSDTypeDefinition type : list) {
        if (type.getName().equals(el.getName()) && type.getTargetNamespace() != null && el.getTargetNamespace() != null && type.getTargetNamespace().equals(el.getTargetNamespace())) {
          exist=true;
          break;
        }
 else         if (type.getName().equals(el.getName()) && type.getTargetNamespace() == null && el.getTargetNamespace() == null) {
          exist=true;
          break;
        }
      }
      if (!exist && (el.getTargetNamespace() != null && !el.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) || el.getTargetNamespace() == null) {
        list.add(el);
      }
    }
    return list.toArray(new XSDTypeDefinition[list.size()]);
  }
  if (parent instanceof XSDAttributeGroupDefinition) {
    XSDAttributeGroupDefinition attributeGroupDefinition=(XSDAttributeGroupDefinition)parent;
    if (attributeGroupDefinition.getContents().size() == 0)     attributeGroupDefinition=attributeGroupDefinition.getResolvedAttributeGroupDefinition();
    return attributeGroupDefinition.getContents().toArray(new Object[attributeGroupDefinition.getContents().size()]);
  }
  if (parent instanceof XSDParticle) {
    XSDParticle xsdParticle=(XSDParticle)parent;
    return getXSDParticleChildren(xsdParticle);
  }
  if (parent instanceof XSDTypeDefinition) {
    if (parent instanceof XSDSimpleTypeDefinition) {
      XSDSimpleTypeDefinition std=(XSDSimpleTypeDefinition)parent;
      if (std.getVariety().equals(XSDVariety.ATOMIC_LITERAL)) {
        ArrayList list=new ArrayList();
        if (std != null && std.getSchema() != null && std.getSchema().getSchemaForSchema() != null)         if (!std.getSchema().getSchemaForSchema().getTypeDefinitions().contains(std))         list.add(std.getBaseTypeDefinition());
        list.addAll(std.getFacetContents());
        return list.toArray(new Object[list.size()]);
      }
      if (std.getVariety().equals(XSDVariety.LIST_LITERAL)) {
        return new XSDSimpleTypeDefinition[]{std.getBaseTypeDefinition()};
      }
      if (std.getVariety().equals(XSDVariety.UNION_LITERAL))       return (XSDSimpleTypeDefinition[])(std.getMemberTypeDefinitions().toArray(new XSDSimpleTypeDefinition[std.getMemberTypeDefinitions().size()]));
    }
    if (parent instanceof XSDComplexTypeDefinition) {
      XSDComplexTypeContent xsdComplexTypeContent=((XSDComplexTypeDefinition)parent).getContent();
      ArrayList<Object> list=new ArrayList<Object>();
      list.addAll(((XSDComplexTypeDefinition)parent).getAttributeContents());
      if (xsdComplexTypeContent == null) {
        XSDComplexTypeDefinition ctd=(XSDComplexTypeDefinition)parent;
        list.add(ctd.getBaseTypeDefinition());
        return list.toArray(new Object[list.size()]);
      }
 else {
        if (xsdComplexTypeContent instanceof XSDSimpleTypeDefinition) {
          list.add(xsdComplexTypeContent);
          return list.toArray(new Object[list.size()]);
        }
        if (xsdComplexTypeContent instanceof XSDParticle)         return getXSDParticleChildren((XSDParticle)xsdComplexTypeContent);
        list.add(((XSDComplexTypeDefinition)parent).getContent());
        return list.toArray(new Object[list.size()]);
      }
    }
  }
  if (parent instanceof XSDModelGroup) {
    XSDModelGroup modelGroup=((XSDModelGroup)parent);
    EList list=modelGroup.getContents();
    List<XSDParticle> ls=new ArrayList<XSDParticle>();
    if (filter != null && !filter.isAll()) {
      for (      XSDParticle el : (XSDParticle[])list.toArray(new XSDParticle[list.size()])) {
        XSDTerm tm=el.getTerm();
        if (tm instanceof XSDElementDeclaration) {
          XSDAnnotation annotation=((XSDElementDeclaration)tm).getAnnotation();
          if (isInclude(annotation)) {
            ls.add(el);
          }
        }
      }
      return ls.toArray(new XSDParticle[ls.size()]);
    }
    return list.toArray(new Object[list.size()]);
  }
  if (parent instanceof XSDSimpleTypeDefinition) {
    XSDSimpleTypeDefinition std=(XSDSimpleTypeDefinition)parent;
    if (std.getVariety().equals(XSDVariety.ATOMIC_LITERAL)) {
      ArrayList list=new ArrayList();
      if (!std.getSchema().getSchemaForSchema().getTypeDefinitions().contains(std))       list.add(std.getBaseTypeDefinition());
      list.addAll(std.getFacetContents());
      return list.toArray(new Object[list.size()]);
    }
    if (std.getVariety().equals(XSDVariety.LIST_LITERAL)) {
      return new XSDSimpleTypeDefinition[]{std.getBaseTypeDefinition()};
    }
    if (std.getVariety().equals(XSDVariety.UNION_LITERAL))     return std.getMemberTypeDefinitions().toArray(new XSDSimpleTypeDefinition[std.getMemberTypeDefinitions().size()]);
  }
  if (parent instanceof XSDIdentityConstraintDefinition) {
    ArrayList list=new ArrayList();
    if (filter != null && !filter.isAll()) {
    }
 else {
      list.add(((XSDIdentityConstraintDefinition)parent).getSelector());
      list.addAll(((XSDIdentityConstraintDefinition)parent).getFields());
    }
    return list.toArray(new Object[list.size()]);
  }
  if (parent instanceof XSDAnnotation) {
    ArrayList list=new ArrayList();
    if (filter != null && !filter.isAll()) {
    }
 else {
      XSDAnnotation annotation=(XSDAnnotation)parent;
      list.addAll(annotation.getUserInformation());
      list.addAll(annotation.getApplicationInformation());
    }
    return list.size() == 0 ? new Object[0] : list.toArray(new Object[list.size()]);
  }
  if (parent instanceof Element) {
    return new Object[0];
  }
  return new Object[0];
}