Program: 148793
Project: 148793
Buggy source:
public static Object getParent(Object son){
  if (!((son instanceof XSDElementDeclaration) || (son instanceof XSDParticle))) {
    return null;
  }
  XSDElementDeclaration elem=null;
  if (son instanceof XSDParticle) {
    elem=(XSDElementDeclaration)((XSDParticle)son).getContent();
  }
 else   if (son instanceof XSDElementDeclaration) {
    elem=(XSDElementDeclaration)son;
  }
  EList<XSDSchemaContent> parentList=elem.getSchema().getContents();
  ArrayList<Object> list=new ArrayList<Object>();
  for (  XSDSchemaContent top : parentList) {
    list.clear();
    if (!(top instanceof XSDElementDeclaration)) {
      continue;
    }
    XSDElementDeclaration decl=(XSDElementDeclaration)top;
    if (decl == son)     return decl;
    if (decl.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
      XSDComplexTypeDefinition type=(XSDComplexTypeDefinition)decl.getTypeDefinition();
      if (type.getContent() instanceof XSDParticle) {
        XSDParticle particle=(XSDParticle)type.getContent();
        if (particle.getTerm() instanceof XSDModelGroup) {
          XSDModelGroup group=(XSDModelGroup)particle.getTerm();
          EList<XSDParticle> elist=group.getContents();
          for (          XSDParticle pt : elist) {
            if (pt.getContent() instanceof XSDElementDeclaration)             if (((XSDElementDeclaration)pt.getContent()) == elem) {
              return decl;
            }
            XSDElementDeclaration spec=findOutSpecialSonElement((XSDElementDeclaration)pt.getContent(),elem);
            if (spec != null)             return spec;
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static Object getParent(Object son){
  if (!((son instanceof XSDElementDeclaration) || (son instanceof XSDParticle))) {
    return null;
  }
  XSDElementDeclaration elem=null;
  if (son instanceof XSDParticle) {
    elem=(XSDElementDeclaration)((XSDParticle)son).getContent();
  }
 else   if (son instanceof XSDElementDeclaration) {
    elem=(XSDElementDeclaration)son;
  }
  EList<XSDSchemaContent> parentList=elem.getSchema().getContents();
  ArrayList<Object> list=new ArrayList<Object>();
  for (  XSDSchemaContent top : parentList) {
    list.clear();
    if (!(top instanceof XSDElementDeclaration) && !(top instanceof XSDComplexTypeDefinition)) {
      continue;
    }
    if (top instanceof XSDElementDeclaration) {
      XSDElementDeclaration decl=(XSDElementDeclaration)top;
      if (decl == son)       return decl;
      if (decl.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
        XSDComplexTypeDefinition type=(XSDComplexTypeDefinition)decl.getTypeDefinition();
        if (type.getContent() instanceof XSDParticle) {
          XSDParticle particle=(XSDParticle)type.getContent();
          if (particle.getTerm() instanceof XSDModelGroup) {
            XSDModelGroup group=(XSDModelGroup)particle.getTerm();
            EList<XSDParticle> elist=group.getContents();
            for (            XSDParticle pt : elist) {
              if (pt.getContent() instanceof XSDElementDeclaration)               if (((XSDElementDeclaration)pt.getContent()) == elem) {
                return decl;
              }
              XSDElementDeclaration spec=findOutSpecialSonElement((XSDElementDeclaration)pt.getContent(),elem);
              if (spec != null)               return spec;
            }
          }
        }
      }
    }
 else {
      XSDComplexTypeDefinition type=(XSDComplexTypeDefinition)top;
      if (type.getContent() instanceof XSDParticle) {
        XSDParticle particle=(XSDParticle)type.getContent();
        if (particle.getTerm() instanceof XSDModelGroup) {
          XSDModelGroup group=(XSDModelGroup)particle.getTerm();
          EList<XSDParticle> elist=group.getContents();
          for (          XSDParticle pt : elist) {
            if (pt.getContent() instanceof XSDElementDeclaration)             if (((XSDElementDeclaration)pt.getContent()) == elem) {
              return top;
            }
            XSDElementDeclaration spec=findOutSpecialSonElement((XSDElementDeclaration)pt.getContent(),elem);
            if (spec != null)             return spec;
          }
        }
      }
    }
  }
  return null;
}