Program: 138495
Project: 138495
Buggy source:
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
public void saveAnalysis() throws DataprofilerCoreException {
  IRepositoryViewObject reposObject=null;
  columnSetAnalysisHandler.clearAnalysis();
  simpleStatIndicator.getAnalyzedColumns().clear();
  allMatchIndicator.getAnalyzedColumns().clear();
  Analysis analysis=columnSetAnalysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  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();
      columnList.add((ModelElement)((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) {
            ind.setAnalyzedElement(((MetadataColumnRepositoryObject)modelElementInd.getModelElementRepositoryNode().getObject()).getTdColumn());
            allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator)ind);
          }
        }
      }
    }
    if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
      allMatchIndicator.getAnalyzedColumns().addAll(columnList);
      columnSetAnalysisHandler.addIndicator(columnList,allMatchIndicator);
    }
  }
 else {
    tdProvider=(Connection)analysis.getContext().getConnection();
    if (tdProvider != null) {
      tdProvider.getSupplierDependency().get(0).getClient().remove(analysis);
      analysis.getContext().setConnection(null);
      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()) {
    RepositoryNode node=RepositoryNodeHelper.recursiveFind(tdProvider);
    if (node != null) {
      ElementWriterFactory.getInstance().createDataProviderWriter().save(node.getObject().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;
  columnSetAnalysisHandler.clearAnalysis();
  simpleStatIndicator.getAnalyzedColumns().clear();
  allMatchIndicator.getAnalyzedColumns().clear();
  Analysis analysis=columnSetAnalysisHandler.getAnalysis();
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  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<MetadataColumn> columnList=new ArrayList<MetadataColumn>();
    for (    IRepositoryNode rd : repositoryNodes) {
      reposObject=rd.getObject();
      columnList.add((MetadataColumn)((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) {
            ind.setAnalyzedElement(((MetadataColumnRepositoryObject)modelElementInd.getModelElementRepositoryNode().getObject()).getTdColumn());
            allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator)ind);
          }
        }
      }
    }
    if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
      allMatchIndicator.getAnalyzedColumns().addAll(columnList);
      columnSetAnalysisHandler.addIndicator(columnList,allMatchIndicator);
    }
  }
 else {
    tdProvider=(Connection)analysis.getContext().getConnection();
    if (tdProvider != null) {
      tdProvider.getSupplierDependency().get(0).getClient().remove(analysis);
      analysis.getContext().setConnection(null);
      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()) {
    RepositoryNode node=RepositoryNodeHelper.recursiveFind(tdProvider);
    if (node != null) {
      ElementWriterFactory.getInstance().createDataProviderWriter().save(node.getObject().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);
}