Program: 138578
Project: 138578
Buggy source:
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
public void saveAnalysis() throws DataprofilerCoreException {
  IRepositoryViewObject reposObject=null;
  correlationAnalysisHandler.clearAnalysis();
  columnSetMultiIndicator.getAnalyzedColumns().clear();
  Analysis analysis=correlationAnalysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  correlationAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  List<RepositoryNode> repositoryNodeList=treeViewer.getColumnSetMultiValueList();
  if (repositoryNodeList != null && repositoryNodeList.size() != 0) {
    reposObject=repositoryNodeList.get(0).getObject();
    Connection tdProvider=((ConnectionItem)reposObject.getProperty().getItem()).getConnection();
    analysis.getContext().setConnection(tdProvider);
    List<TdColumn> columnLst=new ArrayList<TdColumn>();
    for (    RepositoryNode repNode : repositoryNodeList) {
      columnLst.add((TdColumn)((MetadataColumnRepositoryObject)repNode.getObject()).getTdColumn());
    }
    columnSetMultiIndicator.getAnalyzedColumns().addAll(columnLst);
    correlationAnalysisHandler.addIndicator(columnLst,columnSetMultiIndicator);
  }
 else {
    analysis.getContext().setConnection(null);
    analysis.getResults().getIndicators().clear();
    ColumnsetFactory columnsetFactory=ColumnsetFactory.eINSTANCE;
    ColumnSetMultiValueIndicator columnSetMultiValueIndicator=null;
    if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass()) {
      columnSetMultiValueIndicator=columnsetFactory.createCountAvgNullIndicator();
    }
    if (ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
      columnSetMultiValueIndicator=columnsetFactory.createMinMaxDateIndicator();
    }
    if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
      columnSetMultiValueIndicator=columnsetFactory.createWeakCorrelationIndicator();
    }
    fillSimpleIndicators(columnSetMultiValueIndicator);
    analysis.getResults().getIndicators().add(columnSetMultiValueIndicator);
    analysis.getClientDependency().clear();
  }
  String urlString=analysis.eResource() != null ? analysis.eResource().getURI().toFileString() : PluginConstant.EMPTY_STRING;
  this.updateAnalysisClientDependency();
  ReturnCode saved=new ReturnCode(false);
  IEditorInput editorInput=this.getEditorInput();
  if (editorInput instanceof AnalysisItemEditorInput) {
    AnalysisItemEditorInput analysisInput=(AnalysisItemEditorInput)editorInput;
    TDQAnalysisItem tdqAnalysisItem=analysisInput.getTDQAnalysisItem();
    saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(tdqAnalysisItem);
  }
  if (saved.isOk()) {
    if (reposObject != null) {
      ElementWriterFactory.getInstance().createDataProviderWriter().save(reposObject.getProperty().getItem());
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + urlString + "String_Node_Str");
    }
  }
 else {
    throw new DataprofilerCoreException(DefaultMessagesImpl.getString("String_Node_Str",analysis.getName(),urlString,saved.getMessage()));
  }
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}

Fixed version (ground truth):
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
public void saveAnalysis() throws DataprofilerCoreException {
  IRepositoryViewObject reposObject=null;
  Connection tdProvider=null;
  correlationAnalysisHandler.clearAnalysis();
  columnSetMultiIndicator.getAnalyzedColumns().clear();
  Analysis analysis=correlationAnalysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  correlationAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  List<RepositoryNode> repositoryNodeList=treeViewer.getColumnSetMultiValueList();
  if (repositoryNodeList != null && repositoryNodeList.size() != 0) {
    reposObject=repositoryNodeList.get(0).getObject();
    tdProvider=((ConnectionItem)reposObject.getProperty().getItem()).getConnection();
    analysis.getContext().setConnection(tdProvider);
    List<TdColumn> columnLst=new ArrayList<TdColumn>();
    for (    RepositoryNode repNode : repositoryNodeList) {
      columnLst.add((TdColumn)((MetadataColumnRepositoryObject)repNode.getObject()).getTdColumn());
    }
    columnSetMultiIndicator.getAnalyzedColumns().addAll(columnLst);
    correlationAnalysisHandler.addIndicator(columnLst,columnSetMultiIndicator);
  }
 else {
    tdProvider=(Connection)analysis.getContext().getConnection();
    tdProvider.getSupplierDependency().get(0).getClient().remove(analysis);
    analysis.getContext().setConnection(null);
    analysis.getResults().getIndicators().clear();
    ColumnsetFactory columnsetFactory=ColumnsetFactory.eINSTANCE;
    ColumnSetMultiValueIndicator columnSetMultiValueIndicator=null;
    if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass()) {
      columnSetMultiValueIndicator=columnsetFactory.createCountAvgNullIndicator();
    }
    if (ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
      columnSetMultiValueIndicator=columnsetFactory.createMinMaxDateIndicator();
    }
    if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
      columnSetMultiValueIndicator=columnsetFactory.createWeakCorrelationIndicator();
    }
    fillSimpleIndicators(columnSetMultiValueIndicator);
    analysis.getResults().getIndicators().add(columnSetMultiValueIndicator);
    analysis.getClientDependency().clear();
  }
  String urlString=analysis.eResource() != null ? analysis.eResource().getURI().toFileString() : PluginConstant.EMPTY_STRING;
  this.updateAnalysisClientDependency();
  ReturnCode saved=new ReturnCode(false);
  IEditorInput editorInput=this.getEditorInput();
  if (editorInput instanceof AnalysisItemEditorInput) {
    AnalysisItemEditorInput analysisInput=(AnalysisItemEditorInput)editorInput;
    TDQAnalysisItem tdqAnalysisItem=analysisInput.getTDQAnalysisItem();
    saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(tdqAnalysisItem);
  }
  if (saved.isOk()) {
    reposObject=RepositoryNodeHelper.recursiveFind(tdProvider).getObject();
    if (reposObject != null) {
      ElementWriterFactory.getInstance().createDataProviderWriter().save(reposObject.getProperty().getItem());
    }
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + urlString + "String_Node_Str");
    }
  }
 else {
    throw new DataprofilerCoreException(DefaultMessagesImpl.getString("String_Node_Str",analysis.getName(),urlString,saved.getMessage()));
  }
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}