Program: 126656
Project: 126656
Buggy source:
/** 
 * DOC ycbai Comment method "applyMigrationTasks".
 * @param itemRecord
 * @param monitor
 */
private void applyMigrationTasks(ItemRecord itemRecord,IProgressMonitor monitor){
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IMigrationToolService.class)) {
    IMigrationToolService migrationService=(IMigrationToolService)GlobalServiceRegister.getDefault().getService(IMigrationToolService.class);
    Context ctx=CoreRuntimePlugin.getInstance().getContext();
    RepositoryContext repositoryContext=(RepositoryContext)ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
    org.talend.core.model.general.Project project=repositoryContext.getProject();
    ERepositoryObjectType repositoryType=itemRecord.getRepositoryType();
    Item item=null;
    try {
      List<IRepositoryViewObject> allVersion=ProxyRepositoryFactory.getInstance().getAllVersion(ProjectManager.getInstance().getCurrentProject(),itemRecord.getItemId(),itemRecord.getImportPath(),repositoryType);
      for (      IRepositoryViewObject repositoryObject : allVersion) {
        if (repositoryObject.getProperty().getVersion().equals(itemRecord.getItemVersion())) {
          item=repositoryObject.getProperty().getItem();
        }
      }
      if (item == null) {
        return;
      }
      migrationService.executeMigrationTasksForImport(project,item,itemRecord.getMigrationTasksToApply(),monitor);
      itemRecord.setExistingItemWithSameId(null);
      itemRecord.clear();
      itemRecord.setProperty(item.getProperty());
    }
 catch (    Exception e) {
      logError(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "applyMigrationTasks".
 * @param itemRecord
 * @param monitor
 */
protected void applyMigrationTasks(ItemRecord itemRecord,IProgressMonitor monitor){
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IMigrationToolService.class)) {
    IMigrationToolService migrationService=(IMigrationToolService)GlobalServiceRegister.getDefault().getService(IMigrationToolService.class);
    Context ctx=CoreRuntimePlugin.getInstance().getContext();
    RepositoryContext repositoryContext=(RepositoryContext)ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
    org.talend.core.model.general.Project project=repositoryContext.getProject();
    ERepositoryObjectType repositoryType=itemRecord.getRepositoryType();
    Item item=null;
    try {
      List<IRepositoryViewObject> allVersion=ProxyRepositoryFactory.getInstance().getAllVersion(ProjectManager.getInstance().getCurrentProject(),itemRecord.getItemId(),itemRecord.getImportPath(),repositoryType);
      for (      IRepositoryViewObject repositoryObject : allVersion) {
        if (repositoryObject.getProperty().getVersion().equals(itemRecord.getItemVersion())) {
          item=repositoryObject.getProperty().getItem();
        }
      }
      if (item == null) {
        return;
      }
      migrationService.executeMigrationTasksForImport(project,item,itemRecord.getMigrationTasksToApply(),monitor);
      itemRecord.setExistingItemWithSameId(null);
      itemRecord.clear();
      itemRecord.setProperty(item.getProperty());
    }
 catch (    Exception e) {
      logError(e);
    }
  }
}