Program: 139035
Project: 139035
Buggy source:
private boolean synAnalyzedElements(AnalyzedElementSynDialog anaEleSynDialog,Analysis synAnalysis,TdDataProvider oldDataProvider,TdDataProvider newDataProv){
  Map<ModelElement,ModelElement> synEleMap=anaEleSynDialog.getSynedEleMap();
  AnalysisBuilder anaBuilder=new AnalysisBuilder();
  anaBuilder.setAnalysis(synAnalysis);
  synAnalysis.getContext().setConnection(newDataProv);
  List<ModelElement> tempList=new ArrayList<ModelElement>();
  tempList.add(oldDataProvider);
  DependenciesHandler.getInstance().removeDependenciesBetweenModels(synAnalysis,tempList);
  PrvResourceFileHelper.getInstance().save(oldDataProvider);
  EList<Indicator> indcList=synAnalysis.getResults().getIndicators();
  Indicator[] copiedIndArray=new Indicator[indcList.size()];
  System.arraycopy(indcList.toArray(),0,copiedIndArray,0,indcList.size());
  synAnalysis.getContext().getAnalysedElements().clear();
  synAnalysis.getResults().getIndicators().clear();
  boolean isExistSynedElement=false;
  for (  Indicator indicator : copiedIndArray) {
    if (indicator instanceof ColumnSetMultiValueIndicator) {
      ColumnSetMultiValueIndicator compositeInd=(ColumnSetMultiValueIndicator)indicator;
      ModelElement[] mes=new ModelElement[compositeInd.getAnalyzedColumns().size()];
      ((ColumnSetMultiValueIndicator)indicator).getAnalyzedColumns().toArray(mes);
      compositeInd.getAnalyzedColumns().clear();
      for (      ModelElement me : mes) {
        if (synEleMap.get(me) != null) {
          TdColumn newColumn=(TdColumn)synEleMap.get(me);
          DataminingType dataminingType=MetadataHelper.getDataminingType((TdColumn)me);
          if (dataminingType == null) {
            dataminingType=MetadataHelper.getDefaultDataminingType(((TdColumn)me).getJavaType());
          }
          MetadataHelper.setDataminingType(dataminingType,newColumn);
          compositeInd.getAnalyzedColumns().add(newColumn);
          anaBuilder.addElementToAnalyze(newColumn,indicator);
          isExistSynedElement=true;
        }
      }
    }
 else     if (indicator instanceof ColumnsCompareIndicator) {
      ColumnsCompareIndicator compInd=(ColumnsCompareIndicator)indicator;
      if ((compInd.getColumnSetA() == null || compInd.getColumnSetA().size() == 0) || (compInd.getColumnSetB() == null || compInd.getColumnSetB().size() == 0)) {
        return false;
      }
      ModelElement[] mesA=new ModelElement[compInd.getColumnSetA().size()];
      compInd.getColumnSetA().toArray(mesA);
      compInd.getColumnSetA().clear();
      for (      ModelElement me : mesA) {
        if (synEleMap.get(me) != null) {
          TdColumn newColumn=(TdColumn)synEleMap.get(me);
          compInd.getColumnSetA().add(newColumn);
          anaBuilder.addElementToAnalyze(newColumn,indicator);
          isExistSynedElement=true;
        }
      }
      ModelElement[] mesB=new ModelElement[compInd.getColumnSetB().size()];
      compInd.getColumnSetB().toArray(mesB);
      compInd.getColumnSetB().clear();
      for (      ModelElement me : mesB) {
        if (synEleMap.get(me) != null) {
          TdColumn newColumn=(TdColumn)synEleMap.get(me);
          compInd.getColumnSetB().add(newColumn);
          anaBuilder.addElementToAnalyze(newColumn,indicator);
          isExistSynedElement=true;
        }
      }
      ModelElement oldAnaEle=compInd.getAnalyzedElement();
      compInd.setAnalyzedElement(null);
      ColumnSet oldColSetA=ColumnHelper.getColumnSetOwner((Column)mesA[0]);
      ColumnSet oldColSetB=ColumnHelper.getColumnSetOwner((Column)mesB[0]);
      if (oldColSetA == oldAnaEle) {
        if (synEleMap.get(mesA[0]) != null) {
          compInd.setAnalyzedElement(ColumnHelper.getColumnSetOwner((Column)synEleMap.get(mesA[0])));
        }
      }
      if (oldColSetB == oldAnaEle) {
        if (synEleMap.get(mesB[0]) != null) {
          compInd.setAnalyzedElement(ColumnHelper.getColumnSetOwner((Column)synEleMap.get(mesB[0])));
        }
      }
    }
 else {
      ModelElement me=indicator.getAnalyzedElement();
      if (synEleMap.get(me) != null) {
        indicator.setAnalyzedElement(synEleMap.get(me));
        anaBuilder.addElementToAnalyze(synEleMap.get(me),indicator);
        isExistSynedElement=true;
      }
    }
  }
  return isExistSynedElement;
}

Fixed version (ground truth):
private boolean synAnalyzedElements(AnalyzedElementSynDialog anaEleSynDialog,Analysis synAnalysis,TdDataProvider oldDataProvider,TdDataProvider newDataProv){
  Map<ModelElement,ModelElement> synEleMap=anaEleSynDialog.getSynedEleMap();
  AnalysisBuilder anaBuilder=new AnalysisBuilder();
  anaBuilder.setAnalysis(synAnalysis);
  synAnalysis.getContext().setConnection(newDataProv);
  List<ModelElement> tempList=new ArrayList<ModelElement>();
  tempList.add(oldDataProvider);
  DependenciesHandler.getInstance().removeDependenciesBetweenModels(synAnalysis,tempList);
  PrvResourceFileHelper.getInstance().save(oldDataProvider);
  EList<Indicator> indcList=synAnalysis.getResults().getIndicators();
  Indicator[] copiedIndArray=new Indicator[indcList.size()];
  System.arraycopy(indcList.toArray(),0,copiedIndArray,0,indcList.size());
  synAnalysis.getContext().getAnalysedElements().clear();
  synAnalysis.getResults().getIndicators().clear();
  boolean isExistSynedElement=false;
  for (  Indicator indicator : copiedIndArray) {
    if (indicator instanceof ColumnSetMultiValueIndicator) {
      ColumnSetMultiValueIndicator compositeInd=(ColumnSetMultiValueIndicator)indicator;
      ModelElement[] mes=new ModelElement[compositeInd.getAnalyzedColumns().size()];
      ((ColumnSetMultiValueIndicator)indicator).getAnalyzedColumns().toArray(mes);
      compositeInd.getAnalyzedColumns().clear();
      for (      ModelElement me : mes) {
        if (synEleMap.get(me) != null) {
          TdColumn newColumn=(TdColumn)synEleMap.get(me);
          DataminingType dataminingType=MetadataHelper.getDataminingType((TdColumn)me);
          if (dataminingType == null) {
            dataminingType=MetadataHelper.getDefaultDataminingType(((TdColumn)me).getJavaType());
          }
          MetadataHelper.setDataminingType(dataminingType,newColumn);
          compositeInd.getAnalyzedColumns().add(newColumn);
          anaBuilder.addElementToAnalyze(newColumn,indicator);
          isExistSynedElement=true;
        }
      }
    }
 else     if (indicator instanceof ColumnsCompareIndicator) {
      ColumnsCompareIndicator compInd=(ColumnsCompareIndicator)indicator;
      if ((compInd.getColumnSetA() == null || compInd.getColumnSetA().size() == 0) || (compInd.getColumnSetB() == null || compInd.getColumnSetB().size() == 0)) {
        return false;
      }
      ModelElement[] mesA=new ModelElement[compInd.getColumnSetA().size()];
      compInd.getColumnSetA().toArray(mesA);
      compInd.getColumnSetA().clear();
      for (      ModelElement me : mesA) {
        if (synEleMap.get(me) != null) {
          TdColumn newColumn=(TdColumn)synEleMap.get(me);
          compInd.getColumnSetA().add(newColumn);
          anaBuilder.addElementToAnalyze(newColumn,indicator);
          isExistSynedElement=true;
        }
      }
      ModelElement[] mesB=new ModelElement[compInd.getColumnSetB().size()];
      compInd.getColumnSetB().toArray(mesB);
      compInd.getColumnSetB().clear();
      for (      ModelElement me : mesB) {
        if (synEleMap.get(me) != null) {
          TdColumn newColumn=(TdColumn)synEleMap.get(me);
          compInd.getColumnSetB().add(newColumn);
          anaBuilder.addElementToAnalyze(newColumn,indicator);
          isExistSynedElement=true;
        }
      }
      ModelElement oldAnaEle=compInd.getAnalyzedElement();
      compInd.setAnalyzedElement(null);
      ColumnSet oldColSetA=ColumnHelper.getColumnSetOwner((Column)mesA[0]);
      ColumnSet oldColSetB=ColumnHelper.getColumnSetOwner((Column)mesB[0]);
      if (oldColSetA == oldAnaEle) {
        if (synEleMap.get(mesA[0]) != null) {
          compInd.setAnalyzedElement(ColumnHelper.getColumnSetOwner((Column)synEleMap.get(mesA[0])));
        }
      }
      if (oldColSetB == oldAnaEle) {
        if (synEleMap.get(mesB[0]) != null) {
          compInd.setAnalyzedElement(ColumnHelper.getColumnSetOwner((Column)synEleMap.get(mesB[0])));
        }
      }
    }
 else     if (indicator instanceof ColumnDependencyIndicator) {
      ColumnDependencyIndicator funDepInd=(ColumnDependencyIndicator)indicator;
      if (funDepInd.getColumnA() == null || funDepInd.getColumnB() == null) {
        return false;
      }
      if (synEleMap.get(funDepInd.getColumnA()) != null) {
        TdColumn newColumn=(TdColumn)synEleMap.get(funDepInd.getColumnA());
        funDepInd.setColumnA(newColumn);
        anaBuilder.addElementToAnalyze(newColumn,indicator);
        isExistSynedElement=true;
      }
      if (synEleMap.get(funDepInd.getColumnB()) != null) {
        TdColumn newColumn=(TdColumn)synEleMap.get(funDepInd.getColumnB());
        funDepInd.setColumnB(newColumn);
        anaBuilder.addElementToAnalyze(newColumn,indicator);
        isExistSynedElement=true;
      }
      ModelElement oldAnaEle=funDepInd.getAnalyzedElement();
      funDepInd.setAnalyzedElement(null);
      ColumnSet oldColSetA=ColumnHelper.getColumnSetOwner(funDepInd.getColumnA());
      ColumnSet oldColSetB=ColumnHelper.getColumnSetOwner(funDepInd.getColumnB());
      if (oldColSetA == oldAnaEle) {
        if (synEleMap.get(funDepInd.getColumnA()) != null) {
          funDepInd.setAnalyzedElement(ColumnHelper.getColumnSetOwner((Column)synEleMap.get(funDepInd.getColumnA())));
        }
      }
      if (oldColSetB == oldAnaEle) {
        if (synEleMap.get(funDepInd.getColumnB()) != null) {
          funDepInd.setAnalyzedElement(ColumnHelper.getColumnSetOwner((Column)synEleMap.get(funDepInd.getColumnB())));
        }
      }
    }
 else {
      ModelElement me=indicator.getAnalyzedElement();
      if (synEleMap.get(me) != null) {
        indicator.setAnalyzedElement(synEleMap.get(me));
        anaBuilder.addElementToAnalyze(synEleMap.get(me),indicator);
        isExistSynedElement=true;
      }
    }
  }
  return isExistSynedElement;
}