Program: 137310
Project: 137310
Buggy source:
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
@Override public void saveAnalysis() throws DataprofilerCoreException {
  Analysis ana=analysisItem.getAnalysis();
  for (  Domain domain : ana.getParameters().getDataFilter()) {
    domain.setName(ana.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(analysisItem);
  }
  this.saveNumberOfConnectionsPerAnalysis();
  ReturnCode saved=new ReturnCode(false);
  this.nameText.setText(columnSetAnalysisHandler.getName());
  saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(analysisItem,true);
  logSaved(saved);
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}

Fixed version (ground truth):
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
@Override public void saveAnalysis() throws DataprofilerCoreException {
  Analysis ana=analysisItem.getAnalysis();
  for (  Domain domain : ana.getParameters().getDataFilter()) {
    domain.setName(ana.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.saveNumberOfConnectionsPerAnalysis();
  ReturnCode saved=new ReturnCode(false);
  this.nameText.setText(columnSetAnalysisHandler.getName());
  saved=ElementWriterFactory.getInstance().createAnalysisWrite().save(analysisItem,true);
  logSaved(saved);
  treeViewer.setDirty(false);
  dataFilterComp.setDirty(false);
}