Program: 78405
Project: 78405
Buggy source:
/** 
 * Add the particles and attributes that defined in an implicitly defined ComplexType to the node.
 * @param node
 * @param complexType
 */
private static void addParticleAndAttributeInfo(ATreeNode node,XSComplexTypeDecl complexType,ATreeNode complexTypesRoot){
  XSParticle particle=complexType.getParticle();
  if (particle != null) {
    XSObjectList list=((XSModelGroupImpl)particle.getTerm()).getParticles();
    for (int j=0; j < list.getLength(); j++) {
      ATreeNode childNode=new ATreeNode();
      childNode.setValue(((XSParticleDecl)list.item(j)).getTerm().getName());
      String dataType=((XSElementDecl)((XSParticleDecl)list.item(j)).getTerm()).getTypeDefinition().getName();
      if (dataType == null || dataType.length() == 0)       dataType=childNode.getValue().toString();
      childNode.setDataType(dataType);
      childNode.setType(ATreeNode.ELEMENT_TYPE);
      if ((!dataType.equals("String_Node_Str")) && ((XSElementDecl)((XSParticleDecl)list.item(j)).getTerm()).getTypeDefinition() instanceof XSComplexTypeDecl)       childNode.addChild(findComplexElement(complexTypesRoot,dataType).getChildren());
      node.addChild(childNode);
    }
  }
  if (!includeAttribute)   return;
  XSAttributeGroupDecl group=complexType.getAttrGrp();
  if (group != null) {
    XSObjectList list=group.getAttributeUses();
    for (int j=0; j < list.getLength(); j++) {
      ATreeNode childNode=new ATreeNode();
      childNode.setValue(((XSAttributeUseImpl)list.item(j)).getAttrDeclaration().getName());
      childNode.setType(ATreeNode.ATTRIBUTE_TYPE);
      node.addChild(childNode);
    }
  }
}

Fixed version (ground truth):
/** 
 * Add the particles and attributes that defined in an implicitly defined ComplexType to the node.
 * @param node
 * @param complexType
 */
private static void addParticleAndAttributeInfo(ATreeNode node,XSComplexTypeDecl complexType,ATreeNode complexTypesRoot){
  XSParticle particle=complexType.getParticle();
  if (particle != null) {
    XSObjectList list=((XSModelGroupImpl)particle.getTerm()).getParticles();
    for (int j=0; j < list.getLength(); j++) {
      ATreeNode childNode=new ATreeNode();
      childNode.setValue(((XSParticleDecl)list.item(j)).getTerm().getName());
      String dataType=((XSElementDecl)((XSParticleDecl)list.item(j)).getTerm()).getTypeDefinition().getName();
      if (dataType == null || dataType.length() == 0)       dataType=childNode.getValue().toString();
      childNode.setDataType(dataType);
      childNode.setType(ATreeNode.ELEMENT_TYPE);
      if ((!dataType.equals("String_Node_Str")) && ((XSElementDecl)((XSParticleDecl)list.item(j)).getTerm()).getTypeDefinition() instanceof XSComplexTypeDecl) {
        ATreeNode n=findComplexElement(complexTypesRoot,dataType);
        if (n != null) {
          childNode.addChild(n.getChildren());
        }
      }
      node.addChild(childNode);
    }
  }
  if (!includeAttribute)   return;
  XSAttributeGroupDecl group=complexType.getAttrGrp();
  if (group != null) {
    XSObjectList list=group.getAttributeUses();
    for (int j=0; j < list.getLength(); j++) {
      ATreeNode childNode=new ATreeNode();
      childNode.setValue(((XSAttributeUseImpl)list.item(j)).getAttrDeclaration().getName());
      childNode.setType(ATreeNode.ATTRIBUTE_TYPE);
      node.addChild(childNode);
    }
  }
}