Program: 137302
Project: 137302
Buggy source:
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
@Override public void saveAnalysis() throws DataprofilerCoreException {
  for (  Domain domain : this.analysis.getParameters().getDataFilter()) {
    domain.setName(this.analysis.getName());
  }
  IRepositoryViewObject reposObject=null;
  columnSetAnalysisHandler.clearAnalysis();
  simpleStatIndicator.getAnalyzedColumns().clear();
  allMatchIndicator.getAnalyzedColumns().clear();
  Analysis analysis=columnSetAnalysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  analysis.getParameters().setMaxNumberRows(Integer.valueOf(maxNumText.getText()));
  simpleStatIndicator.setMustStoreRow(drillDownCheck.getSelection());
  columnSetAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  List<IRepositoryNode> repositoryNodes=treeViewer.getColumnSetMultiValueList();
  Connection tdProvider=null;
  if (repositoryNodes != null && repositoryNodes.size() != 0) {
    ConnectionItem item=(ConnectionItem)repositoryNodes.get(0).getObject().getProperty().getItem();
    tdProvider=item.getConnection();
    if (tdProvider.eIsProxy()) {
      tdProvider=(Connection)EObjectHelper.resolveObject(tdProvider);
    }
    analysis.getContext().setConnection(tdProvider);
    List<ModelElement> columnList=new ArrayList<ModelElement>();
    for (    IRepositoryNode rd : repositoryNodes) {
      reposObject=rd.getObject();
      if (rd instanceof MDMXmlElementRepNode) {
        columnList.add(((MetadataXmlElementTypeRepositoryObject)reposObject).getTdXmlElementType());
      }
 else {
        columnList.add(((MetadataColumnRepositoryObject)reposObject).getTdColumn());
      }
    }
    simpleStatIndicator.getAnalyzedColumns().addAll(columnList);
    columnSetAnalysisHandler.addIndicator(columnList,simpleStatIndicator);
    allMatchIndicator.getCompositeRegexMatchingIndicators().clear();
    ModelElementIndicator[] modelElementIndicator=treeViewer.getModelElementIndicator();
    if (modelElementIndicator != null) {
      for (      ModelElementIndicator modelElementInd : modelElementIndicator) {
        Indicator[] inds=modelElementInd.getPatternIndicators();
        for (        Indicator ind : inds) {
          if (ind instanceof RegexpMatchingIndicator) {
            IRepositoryViewObject obj=modelElementInd.getModelElementRepositoryNode().getObject();
            ModelElement analyzedElt=obj instanceof MetadataColumnRepositoryObject ? ((MetadataColumnRepositoryObject)obj).getTdColumn() : ((MetadataXmlElementTypeRepositoryObject)obj).getModelElement();
            ind.setAnalyzedElement(analyzedElt);
            allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator)ind);
          }
        }
      }
    }
    if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
      allMatchIndicator.getAnalyzedColumns().addAll(columnList);
      columnSetAnalysisHandler.addIndicator(columnList,allMatchIndicator);
    }
  }
 else {
    deleteConnectionDependency(analysis);
  }
  this.updateAnalysisClientDependency();
  this.saveNumberOfConnectionsPerAnalysis();
  ReturnCode saved=new ReturnCode(false);
  IEditorInput editorInput=this.getEditorInput();
  if (editorInput instanceof AnalysisItemEditorInput) {
    AnalysisItemEditorInput analysisInput=(AnalysisItemEditorInput)editorInput;
    TDQAnalysisItem tdqAnalysisItem=analysisInput.getTDQAnalysisItem();
    tdqAnalysisItem.getProperty().setDisplayName(columnSetAnalysisHandler.getName());
    tdqAnalysisItem.getProperty().setLabel(WorkspaceUtils.normalize(columnSetAnalysisHandler.getName()));
    this.nameText.setText(columnSetAnalysisHandler.getName());
    saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(tdqAnalysisItem,true);
  }
  logSaved(saved);
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}

Fixed version (ground truth):
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
@Override public void saveAnalysis() throws DataprofilerCoreException {
  for (  Domain domain : this.analysis.getParameters().getDataFilter()) {
    domain.setName(this.analysis.getName());
  }
  IRepositoryViewObject reposObject=null;
  columnSetAnalysisHandler.clearAnalysis();
  simpleStatIndicator.getAnalyzedColumns().clear();
  allMatchIndicator.getAnalyzedColumns().clear();
  Analysis analysis=columnSetAnalysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  analysis.getParameters().setMaxNumberRows(Integer.valueOf(maxNumText.getText()));
  simpleStatIndicator.setMustStoreRow(drillDownCheck.getSelection());
  columnSetAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  List<IRepositoryNode> repositoryNodes=treeViewer.getColumnSetMultiValueList();
  Connection tdProvider=null;
  if (repositoryNodes != null && repositoryNodes.size() != 0) {
    ConnectionItem item=(ConnectionItem)repositoryNodes.get(0).getObject().getProperty().getItem();
    tdProvider=item.getConnection();
    if (tdProvider.eIsProxy()) {
      tdProvider=(Connection)EObjectHelper.resolveObject(tdProvider);
    }
    analysis.getContext().setConnection(tdProvider);
    List<ModelElement> columnList=new ArrayList<ModelElement>();
    for (    IRepositoryNode rd : repositoryNodes) {
      reposObject=rd.getObject();
      if (rd instanceof MDMXmlElementRepNode) {
        columnList.add(((MetadataXmlElementTypeRepositoryObject)reposObject).getTdXmlElementType());
      }
 else {
        columnList.add(((MetadataColumnRepositoryObject)reposObject).getTdColumn());
      }
    }
    simpleStatIndicator.getAnalyzedColumns().addAll(columnList);
    columnSetAnalysisHandler.addIndicator(columnList,simpleStatIndicator);
    allMatchIndicator.getCompositeRegexMatchingIndicators().clear();
    ModelElementIndicator[] modelElementIndicator=treeViewer.getModelElementIndicator();
    if (modelElementIndicator != null) {
      for (      ModelElementIndicator modelElementInd : modelElementIndicator) {
        Indicator[] inds=modelElementInd.getPatternIndicators();
        for (        Indicator ind : inds) {
          if (ind instanceof RegexpMatchingIndicator) {
            IRepositoryViewObject obj=modelElementInd.getModelElementRepositoryNode().getObject();
            ModelElement analyzedElt=obj instanceof MetadataColumnRepositoryObject ? ((MetadataColumnRepositoryObject)obj).getTdColumn() : ((MetadataXmlElementTypeRepositoryObject)obj).getModelElement();
            ind.setAnalyzedElement(analyzedElt);
            allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator)ind);
          }
        }
      }
    }
    if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
      allMatchIndicator.getAnalyzedColumns().addAll(columnList);
      columnSetAnalysisHandler.addIndicator(columnList,allMatchIndicator);
    }
  }
 else {
    analysis.getContext().setConnection(null);
  }
  this.updateAnalysisClientDependency();
  this.saveNumberOfConnectionsPerAnalysis();
  ReturnCode saved=new ReturnCode(false);
  IEditorInput editorInput=this.getEditorInput();
  if (editorInput instanceof AnalysisItemEditorInput) {
    AnalysisItemEditorInput analysisInput=(AnalysisItemEditorInput)editorInput;
    TDQAnalysisItem tdqAnalysisItem=analysisInput.getTDQAnalysisItem();
    tdqAnalysisItem.getProperty().setDisplayName(columnSetAnalysisHandler.getName());
    tdqAnalysisItem.getProperty().setLabel(WorkspaceUtils.normalize(columnSetAnalysisHandler.getName()));
    this.nameText.setText(columnSetAnalysisHandler.getName());
    saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(tdqAnalysisItem,true);
  }
  logSaved(saved);
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}