Program: 139024
Project: 139024
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     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;
}

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());
  boolean isExistSynedElement=false;
  AnalysisType analysisType=synAnalysis.getParameters().getAnalysisType();
  if (analysisType == AnalysisType.MULTIPLE_COLUMN) {
    EList<ModelElement> meLs=synAnalysis.getContext().getAnalysedElements();
    ModelElement[] mes=new ModelElement[meLs.size()];
    System.arraycopy(meLs.toArray(),0,mes,0,meLs.size());
    synAnalysis.getContext().getAnalysedElements().clear();
    for (int i=0; i < mes.length; i++) {
      if (synEleMap.get(mes[i]) != null) {
        TdColumn newColumn=(TdColumn)synEleMap.get(mes[i]);
        synAnalysis.getContext().getAnalysedElements().add(newColumn);
        isExistSynedElement=true;
      }
    }
  }
  if (!isExistSynedElement)   synAnalysis.getContext().getAnalysedElements().clear();
  synAnalysis.getResults().getIndicators().clear();
  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));
        if (analysisType == AnalysisType.MULTIPLE_COLUMN)         synAnalysis.getResults().getIndicators().add(indicator);
 else         anaBuilder.addElementToAnalyze(synEleMap.get(me),indicator);
        isExistSynedElement=true;
      }
    }
  }
  return isExistSynedElement;
}