Program: 138232
Project: 138232
Buggy source:
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
public void saveAnalysis() throws DataprofilerCoreException {
  columnSetAnalysisHandler.setName(columnSetAnalysisHandler.getName().replace("String_Node_Str","String_Node_Str"));
  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));
  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((ModelElement)((MetadataXmlElementTypeRepositoryObject)reposObject).getTdXmlElementType());
      }
 else {
        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().size() > 0) {
      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();
    tdqAnalysisItem.getProperty().setLabel(columnSetAnalysisHandler.getName());
    this.nameText.setText(columnSetAnalysisHandler.getName());
    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 {
  columnSetAnalysisHandler.setName(columnSetAnalysisHandler.getName().replace("String_Node_Str","String_Node_Str"));
  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));
  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((ModelElement)((MetadataXmlElementTypeRepositoryObject)reposObject).getTdXmlElementType());
      }
 else {
        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) {
            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 {
    tdProvider=(Connection)analysis.getContext().getConnection();
    if (tdProvider != null && tdProvider.getSupplierDependency().size() > 0) {
      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();
    tdqAnalysisItem.getProperty().setLabel(columnSetAnalysisHandler.getName());
    this.nameText.setText(columnSetAnalysisHandler.getName());
    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);
}