Program: 118111
Project: 118111
Buggy source:
/** 
 * DOC ycbai Comment method "propaHadoopCfgChanges". <P> Propagate the changes from hadoop cluster to M/R process when drag&drop hadoop subnode from repository view to M/R process. </P>
 * @param repositoryNode
 */
private void propaHadoopCfgChanges(IRepositoryNode repositoryNode){
  if (repositoryNode == null || repositoryNode.getObject() == null) {
    return;
  }
  IHadoopClusterService hadoopClusterService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
    hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
  }
  if (hadoopClusterService == null || !hadoopClusterService.isHadoopSubnode(repositoryNode)) {
    return;
  }
  IProcess process=editor.getProcess();
  if (!ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process.getComponentsType()) && !ComponentCategory.CATEGORY_4_SPARK.getName().equals(process.getComponentsType()) && !ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType())) {
    return;
  }
  if ((process instanceof IProcess2) && (((IProcess2)process).getProperty().getItem() instanceof JobletProcessItem)) {
    return;
  }
  Item subItem=repositoryNode.getObject().getProperty().getItem();
  Item hadoopClusterItem=hadoopClusterService.getHadoopClusterBySubitemId(subItem.getProperty().getId());
  String hadoopClusterId=hadoopClusterItem.getProperty().getId();
  String propertyParamName=MR_PROPERTY_PREFIX + EParameterName.PROPERTY_TYPE.getName();
  String propertyRepTypeParamName=MR_PROPERTY_PREFIX + EParameterName.REPOSITORY_PROPERTY_TYPE.getName();
  IElementParameter propertyParam=process.getElementParameter(propertyParamName);
  if (EmfComponent.REPOSITORY.equals(propertyParam.getValue())) {
    String propertyId=(String)process.getElementParameter(propertyRepTypeParamName).getValue();
    if (hadoopClusterId.equals(propertyId)) {
      return;
    }
  }
  Connection hcConnection=((ConnectionItem)hadoopClusterItem).getConnection();
  Connection connection=((ConnectionItem)subItem).getConnection();
  IElementParameter elementParameter=process.getElementParameter(propertyParamName);
  if (hadoopClusterService.hasDiffsFromClusterToProcess(subItem,process)) {
    boolean confirmUpdate=MessageDialog.openConfirm(editor.getSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    if (confirmUpdate) {
      if (ComponentCategory.CATEGORY_4_SPARK.getName().equals(process.getComponentsType()) || ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType())) {
        IElementParameter sparkLocalParam=process.getElementParameter(HadoopConstants.SPARK_LOCAL_MODE);
        IElementParameter sparkParam=process.getElementParameter(HadoopConstants.SPARK_MODE);
        if (sparkLocalParam != null && (Boolean)(sparkLocalParam.getValue())) {
          sparkLocalParam.setValue(false);
        }
        if (sparkParam != null && !HadoopConstants.SPARK_MODE_YARN_CLIENT.equals(sparkParam.getValue())) {
          sparkParam.setValue(HadoopConstants.SPARK_MODE_YARN_CLIENT);
        }
      }
      propertyParam.setValue(EmfComponent.REPOSITORY);
      ChangeValuesFromRepository command=new ChangeValuesFromRepository(process,connection,propertyRepTypeParamName,subItem.getProperty().getId());
      execCommandStack(command);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "propaHadoopCfgChanges". <P> Propagate the changes from hadoop cluster to M/R process when drag&drop hadoop subnode from repository view to M/R process. </P>
 * @param repositoryNode
 */
private void propaHadoopCfgChanges(IRepositoryNode repositoryNode){
  if (repositoryNode == null || repositoryNode.getObject() == null) {
    return;
  }
  IHadoopClusterService hadoopClusterService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
    hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
  }
  if (hadoopClusterService == null || !hadoopClusterService.isHadoopSubnode(repositoryNode)) {
    return;
  }
  IProcess process=editor.getProcess();
  if (!ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process.getComponentsType()) && !ComponentCategory.CATEGORY_4_SPARK.getName().equals(process.getComponentsType()) && !ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType())) {
    return;
  }
  if ((process instanceof IProcess2) && (((IProcess2)process).getProperty().getItem() instanceof JobletProcessItem)) {
    return;
  }
  Item subItem=repositoryNode.getObject().getProperty().getItem();
  Item hadoopClusterItem=hadoopClusterService.getHadoopClusterBySubitemId(new Project(ProjectManager.getInstance().getProject(subItem)),subItem.getProperty().getId());
  String hadoopClusterId=hadoopClusterItem.getProperty().getId();
  String propertyParamName=MR_PROPERTY_PREFIX + EParameterName.PROPERTY_TYPE.getName();
  String propertyRepTypeParamName=MR_PROPERTY_PREFIX + EParameterName.REPOSITORY_PROPERTY_TYPE.getName();
  IElementParameter propertyParam=process.getElementParameter(propertyParamName);
  if (EmfComponent.REPOSITORY.equals(propertyParam.getValue())) {
    String propertyId=(String)process.getElementParameter(propertyRepTypeParamName).getValue();
    if (hadoopClusterId.equals(propertyId)) {
      return;
    }
  }
  Connection hcConnection=((ConnectionItem)hadoopClusterItem).getConnection();
  Connection connection=((ConnectionItem)subItem).getConnection();
  IElementParameter elementParameter=process.getElementParameter(propertyParamName);
  if (hadoopClusterService.hasDiffsFromClusterToProcess(subItem,process)) {
    boolean confirmUpdate=MessageDialog.openConfirm(editor.getSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    if (confirmUpdate) {
      if (ComponentCategory.CATEGORY_4_SPARK.getName().equals(process.getComponentsType()) || ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType())) {
        IElementParameter sparkLocalParam=process.getElementParameter(HadoopConstants.SPARK_LOCAL_MODE);
        IElementParameter sparkParam=process.getElementParameter(HadoopConstants.SPARK_MODE);
        if (sparkLocalParam != null && (Boolean)(sparkLocalParam.getValue())) {
          sparkLocalParam.setValue(false);
        }
        if (sparkParam != null && !HadoopConstants.SPARK_MODE_YARN_CLIENT.equals(sparkParam.getValue())) {
          sparkParam.setValue(HadoopConstants.SPARK_MODE_YARN_CLIENT);
        }
      }
      propertyParam.setValue(EmfComponent.REPOSITORY);
      ChangeValuesFromRepository command=new ChangeValuesFromRepository(process,connection,propertyRepTypeParamName,subItem.getProperty().getId());
      execCommandStack(command);
    }
  }
}