Program: 148895
Project: 148895
Buggy source:
public void addAnnotationForXSDElementDeclaration(XSDElementDeclaration fromElem,XSDElementDeclaration toElem){
  if (fromElem.getAnnotation() != null) {
    XSDAnnotationsStructure struc=new XSDAnnotationsStructure(toElem);
    addAnnotion(struc,fromElem.getAnnotation());
  }
  if (fromElem.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
    XSDComplexTypeContent fromcomplexType=((XSDComplexTypeDefinition)fromElem.getTypeDefinition()).getContent();
    if (this.typeList.containsKey(toElem.getTypeDefinition().getName()))     this.copyTypeSet.add(this.typeList.get(toElem.getTypeDefinition().getName()));
    if (toElem.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
      XSDComplexTypeContent tocomplexType=((XSDComplexTypeDefinition)toElem.getTypeDefinition()).getContent();
      if (fromcomplexType instanceof XSDParticle) {
        XSDParticle fromxsdParticle=(XSDParticle)fromcomplexType;
        XSDParticle toxsdParticle=(XSDParticle)tocomplexType;
        if (((XSDParticle)fromxsdParticle).getTerm() instanceof XSDModelGroup) {
          XSDModelGroup frommodelGroup=((XSDModelGroup)fromxsdParticle.getTerm());
          XSDModelGroup tomodelGroup=((XSDModelGroup)toxsdParticle.getTerm());
          EList fromlist=frommodelGroup.getContents();
          EList tolist=tomodelGroup.getContents();
          Iterator toIt=tolist.iterator();
          for (          XSDParticle fromel : (XSDParticle[])fromlist.toArray(new XSDParticle[fromlist.size()])) {
            XSDParticle toel=(XSDParticle)toIt.next();
            XSDTerm totm=toel.getTerm();
            XSDTerm fromtm=fromel.getTerm();
            if (fromtm instanceof XSDElementDeclaration) {
              XSDAnnotation fromannotation=((XSDElementDeclaration)fromtm).getAnnotation();
              if (fromannotation != null) {
                XSDAnnotationsStructure struc=new XSDAnnotationsStructure(totm);
                if (((XSDElementDeclaration)totm).getType() != null) {
                  addAnnotion(struc,fromannotation);
                }
 else {
                  MessageDialog.openInformation(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + fromElem.getName() + "String_Node_Str");
                  return;
                }
              }
              if (((XSDElementDeclaration)totm).getType() != null && this.typeList.containsKey(((XSDElementDeclaration)totm).getType().getName()))               this.copyTypeSet.add(this.typeList.get(((XSDElementDeclaration)totm).getType().getName()));
              addAnnotationForXSDElementDeclaration((XSDElementDeclaration)fromtm,(XSDElementDeclaration)totm);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void addAnnotationForXSDElementDeclaration(XSDElementDeclaration fromElem,XSDElementDeclaration toElem){
  if (fromElem.getAnnotation() != null) {
    XSDAnnotationsStructure struc=new XSDAnnotationsStructure(toElem);
    addAnnotion(struc,fromElem.getAnnotation());
  }
  if (fromElem.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
    XSDComplexTypeContent fromcomplexType=((XSDComplexTypeDefinition)fromElem.getTypeDefinition()).getContent();
    if (this.typeList.containsKey(toElem.getTypeDefinition().getName()))     this.copyTypeSet.add(this.typeList.get(toElem.getTypeDefinition().getName()));
    if (toElem.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
      XSDComplexTypeContent tocomplexType=((XSDComplexTypeDefinition)toElem.getTypeDefinition()).getContent();
      if (fromcomplexType instanceof XSDParticle) {
        XSDParticle fromxsdParticle=(XSDParticle)fromcomplexType;
        XSDParticle toxsdParticle=(XSDParticle)tocomplexType;
        if (((XSDParticle)fromxsdParticle).getTerm() instanceof XSDModelGroup) {
          XSDModelGroup frommodelGroup=((XSDModelGroup)fromxsdParticle.getTerm());
          XSDModelGroup tomodelGroup=((XSDModelGroup)toxsdParticle.getTerm());
          EList fromlist=frommodelGroup.getContents();
          EList tolist=tomodelGroup.getContents();
          Iterator toIt=tolist.iterator();
          for (          XSDParticle fromel : (XSDParticle[])fromlist.toArray(new XSDParticle[fromlist.size()])) {
            XSDParticle toel=(XSDParticle)toIt.next();
            XSDTerm totm=toel.getTerm();
            XSDTerm fromtm=fromel.getTerm();
            if (fromtm instanceof XSDElementDeclaration) {
              XSDAnnotation fromannotation=((XSDElementDeclaration)fromtm).getAnnotation();
              if (fromannotation != null) {
                XSDAnnotationsStructure struc=new XSDAnnotationsStructure(totm);
                if (((XSDElementDeclaration)totm).getType() != null) {
                  addAnnotion(struc,fromannotation);
                }
 else {
                  MessageDialog.openInformation(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + fromElem.getName() + "String_Node_Str");
                  return;
                }
              }
              if (((XSDElementDeclaration)totm).getType() != null && this.typeList.containsKey(((XSDElementDeclaration)totm).getType().getName()))               this.copyTypeSet.add(this.typeList.get(((XSDElementDeclaration)totm).getType().getName()));
              addAnnotationForXSDElementDeclaration((XSDElementDeclaration)fromtm,(XSDElementDeclaration)totm);
            }
          }
        }
      }
    }
  }
 else {
    String simpleType=fromElem.getTypeDefinition().getName();
    if (this.typeList.containsKey(simpleType))     this.copyTypeSet.add(fromElem.getTypeDefinition());
  }
}