Program: 119514
Project: 119514
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())) {
    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();
  if (hadoopClusterService.hasDiffsFromClusterToProcess(((ConnectionItem)hadoopClusterItem).getConnection(),process)) {
    boolean confirmUpdate=MessageDialog.openConfirm(editor.getSite().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    if (confirmUpdate) {
      propertyParam.setValue(EmfComponent.REPOSITORY);
      ChangeValuesFromRepository command=new ChangeValuesFromRepository(process,connection,propertyRepTypeParamName,hadoopClusterId);
      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())) {
    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) {
      propertyParam.setValue(EmfComponent.REPOSITORY);
      ChangeValuesFromRepository command=new ChangeValuesFromRepository(process,connection,propertyRepTypeParamName,subItem.getProperty().getId());
      execCommandStack(command);
    }
  }
}