Program: 138311
Project: 138311
Buggy source:
/** 
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
public void saveAnalysis() throws DataprofilerCoreException {
  IRepositoryViewObject reposObject=null;
  analysisHandler.clearAnalysis();
  ModelElementIndicator[] modelElementIndicators=treeViewer.getModelElementIndicator();
  Connection tdProvider=null;
  Analysis analysis=analysisHandler.getAnalysis();
  this.analysis.setName(this.analysis.getName().replace("String_Node_Str","String_Node_Str"));
  for (  Domain domain : this.analysis.getParameters().getDataFilter()) {
    domain.setName(this.analysis.getName());
  }
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  if (ExecutionLanguage.JAVA.equals(ExecutionLanguage.get(execLang))) {
    analysis.getParameters().setMaxNumberRows(Integer.parseInt(maxNumText.getText()));
    analysis.getParameters().setStoreData(drillDownCheck.getSelection());
  }
  if (modelElementIndicators != null && modelElementIndicators.length != 0) {
    tdProvider=ModelElementIndicatorHelper.getTdDataProvider(modelElementIndicators[0]);
    if (tdProvider.eIsProxy()) {
      tdProvider=(Connection)EObjectHelper.resolveObject(tdProvider);
    }
    analysis.getContext().setConnection(tdProvider);
    for (    ModelElementIndicator modelElementIndicator : modelElementIndicators) {
      reposObject=modelElementIndicator.getModelElementRepositoryNode().getObject();
      ModelElement modelEle=null;
      if (reposObject instanceof MetadataColumnRepositoryObject) {
        modelEle=((MetadataColumnRepositoryObject)reposObject).getTdColumn();
      }
 else       if (reposObject instanceof MetadataXmlElementTypeRepositoryObject) {
        modelEle=((MetadataXmlElementTypeRepositoryObject)reposObject).getTdXmlElementType();
      }
      analysisHandler.addIndicator(modelEle,modelElementIndicator.getIndicators());
      DataminingType type=MetadataHelper.getDataminingType(modelEle);
      if (type == null) {
        type=MetadataHelper.getDefaultDataminingType(modelElementIndicator.getJavaType());
      }
      analysisHandler.setDatamingType(type.getLiteral(),modelEle);
    }
  }
 else {
    tdProvider=(Connection)analysis.getContext().getConnection();
    if (tdProvider != null && tdProvider.getSupplierDependency().size() > 0) {
      if (tdProvider.getSupplierDependency().size() > 0) {
        tdProvider.getSupplierDependency().get(0).getClient().remove(analysis);
      }
      analysis.getContext().setConnection(null);
      analysis.getClientDependency().clear();
    }
  }
  analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  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(analysisHandler.getName());
    this.nameText.setText(analysisHandler.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 {
  IRepositoryViewObject reposObject=null;
  analysisHandler.clearAnalysis();
  ModelElementIndicator[] modelElementIndicators=treeViewer.getModelElementIndicator();
  Connection tdProvider=null;
  Analysis analysis=analysisHandler.getAnalysis();
  this.analysis.setName(this.analysis.getName().replace("String_Node_Str","String_Node_Str"));
  for (  Domain domain : this.analysis.getParameters().getDataFilter()) {
    domain.setName(this.analysis.getName());
  }
  analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
  if (ExecutionLanguage.JAVA.equals(ExecutionLanguage.get(execLang))) {
    analysis.getParameters().setMaxNumberRows(Integer.parseInt(maxNumText.getText()));
    analysis.getParameters().setStoreData(drillDownCheck.getSelection());
  }
  if (modelElementIndicators != null && modelElementIndicators.length != 0) {
    tdProvider=ModelElementIndicatorHelper.getTdDataProvider(modelElementIndicators[0]);
    if (tdProvider.eIsProxy()) {
      tdProvider=(Connection)EObjectHelper.resolveObject(tdProvider);
    }
    analysis.getContext().setConnection(tdProvider);
    for (    ModelElementIndicator modelElementIndicator : modelElementIndicators) {
      reposObject=modelElementIndicator.getModelElementRepositoryNode().getObject();
      ModelElement modelEle=null;
      if (reposObject instanceof MetadataColumnRepositoryObject) {
        modelEle=((MetadataColumnRepositoryObject)reposObject).getTdColumn();
      }
 else       if (reposObject instanceof MetadataXmlElementTypeRepositoryObject) {
        modelEle=((MetadataXmlElementTypeRepositoryObject)reposObject).getTdXmlElementType();
      }
      analysisHandler.addIndicator(modelEle,modelElementIndicator.getIndicators());
      DataminingType type=MetadataHelper.getDataminingType(modelEle);
      if (type == null) {
        type=MetadataHelper.getDefaultDataminingType(modelElementIndicator.getJavaType());
      }
      analysisHandler.setDatamingType(type.getLiteral(),modelEle);
    }
  }
 else {
    tdProvider=(Connection)analysis.getContext().getConnection();
    if (tdProvider != null && tdProvider.getSupplierDependency().size() > 0) {
      if (tdProvider.getSupplierDependency().size() > 0) {
        tdProvider.getSupplierDependency().get(0).getClient().remove(analysis);
      }
      analysis.getContext().setConnection(null);
      analysis.getClientDependency().clear();
    }
  }
  analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
  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();
    if (tdqAnalysisItem.eIsProxy()) {
      tdqAnalysisItem=(TDQAnalysisItem)EObjectHelper.resolveObject(tdqAnalysisItem);
    }
    tdqAnalysisItem.getProperty().setLabel(analysisHandler.getName());
    this.nameText.setText(analysisHandler.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);
}