Program: 118152
Project: 118152
Buggy source:
@Override public void performRequest(Request req){
  Node node=(Node)getModel();
  IExternalData oldExternalData=node.getExternalData();
  if (req.getType().equals(RequestConstants.REQ_OPEN)) {
    IExternalNode externalNode=null;
    if (node.isExternalNode()) {
      IElementParameter externalParam=node.getElementParameterFromField(EParameterFieldType.EXTERNAL);
      if (externalParam != null && externalParam.isShow(node.getElementParameters())) {
        externalNode=ExternalUtilities.getExternalNodeReadyToOpen(node);
      }
    }
    IWorkbenchPart part=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (externalNode != null && (part instanceof AbstractMultiPageTalendEditor)) {
      boolean isOriginalNode=false;
      ITestContainerProviderService testContainerService=null;
      if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
        testContainerService=(ITestContainerProviderService)GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
        if (testContainerService != null) {
          isOriginalNode=testContainerService.isOriginalNode(node);
          if (isOriginalNode) {
            testContainerService.renameConnection(node,true);
          }
        }
      }
      int returnValue=externalNode.open(getViewer().getControl().getShell());
      if (!node.isReadOnly()) {
        if (returnValue == SWT.OK) {
          Command cmd=new ExternalNodeChangeCommand(node,externalNode,oldExternalData);
          CommandStack cmdStack=(CommandStack)part.getAdapter(CommandStack.class);
          cmdStack.execute(cmd);
        }
 else {
          externalNode.setExternalData(oldExternalData);
        }
      }
      if (isOriginalNode && (testContainerService != null)) {
        testContainerService.renameConnection(node,false);
      }
    }
 else {
      boolean isJoblet=false;
      if (PluginChecker.isJobLetPluginLoaded()) {
        AbstractProcessProvider jobletProcessProvider=AbstractProcessProvider.findProcessProviderFromPID(IComponent.JOBLET_PID);
        final IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
        boolean isAvoidShowJobletAfterDoubleClick=false;
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
          IComponentsLocalProviderService componentService=(IComponentsLocalProviderService)GlobalServiceRegister.getDefault().getService(IComponentsLocalProviderService.class);
          if (componentService != null) {
            isAvoidShowJobletAfterDoubleClick=componentService.isAvoidToShowJobletAfterDoubleClick();
          }
        }
        if (service != null && service.isJobletComponent(node) && !isAvoidShowJobletAfterDoubleClick) {
          isJoblet=true;
          String version=(String)node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
          final Item jobletItem=jobletProcessProvider.getJobletItem(node,version);
          RepositoryWorkUnit<Object> repositoryWorkUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
            @Override protected void run() throws LoginException, PersistenceException {
              if (jobletItem != null) {
                service.openJobletItem((JobletProcessItem)jobletItem);
              }
            }
          }
;
          repositoryWorkUnit.setAvoidUnloadResources(true);
          CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
        }
      }
      if (!isJoblet) {
        IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        String processName=(String)node.getPropertyValue(EParameterName.PROCESS_TYPE_PROCESS.getName());
        String version=(String)node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
        boolean isAvoidShowJobAfterDoubleClick=false;
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
          IComponentsLocalProviderService service=(IComponentsLocalProviderService)GlobalServiceRegister.getDefault().getService(IComponentsLocalProviderService.class);
          if (service != null) {
            isAvoidShowJobAfterDoubleClick=service.isAvoidToShowJobAfterDoubleClick();
          }
        }
        boolean isSelectUseDynamic=false;
        Object useDynamicJobValue=node.getPropertyValue(EParameterName.USE_DYNAMIC_JOB.getName());
        if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
          isSelectUseDynamic=(Boolean)useDynamicJobValue;
        }
        if (processName != null && !"String_Node_Str".equals(processName) && !isAvoidShowJobAfterDoubleClick && !isSelectUseDynamic) {
          ItemCacheManager.clearCache();
          ProcessItem processItem=ItemCacheManager.getProcessItem(processName,version);
          Property updatedProperty=null;
          try {
            updatedProperty=ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(processItem)),processName).getProperty();
          }
 catch (          PersistenceException e) {
            CommonExceptionHandler.process(e);
          }
          processItem=(ProcessItem)updatedProperty.getItem();
          final ProcessItem item=processItem;
          RepositoryWorkUnit<Object> repositoryWorkUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
            @Override protected void run() throws LoginException, PersistenceException {
              try {
                if (item != null) {
                  ERepositoryObjectType repObjType=ERepositoryObjectType.getItemType(item);
                  IJobEditorHandler editorInputFactory=JobEditorHandlerManager.getInstance().extractEditorInputFactory(repObjType.getType());
                  editorInputFactory.openJobEditor(editorInputFactory.createJobEditorInput(item,true));
                }
              }
 catch (              PartInitException e) {
                MessageBoxExceptionHandler.process(e);
              }
            }
          }
;
          repositoryWorkUnit.setAvoidUnloadResources(true);
          CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
        }
 else {
          try {
            page.showView(ComponentSettingsView.ID);
          }
 catch (          PartInitException e) {
            CommonExceptionHandler.process(e);
          }
        }
      }
    }
  }
  super.performRequest(req);
}

Fixed version (ground truth):
@Override public void performRequest(Request req){
  Node node=(Node)getModel();
  IExternalData oldExternalData=node.getExternalData();
  if (req.getType().equals(RequestConstants.REQ_OPEN)) {
    IExternalNode externalNode=null;
    if (node.isExternalNode()) {
      IElementParameter externalParam=node.getElementParameterFromField(EParameterFieldType.EXTERNAL);
      if (externalParam != null && externalParam.isShow(node.getElementParameters())) {
        externalNode=ExternalUtilities.getExternalNodeReadyToOpen(node);
      }
    }
    IWorkbenchPart part=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (externalNode != null && (part instanceof AbstractMultiPageTalendEditor)) {
      boolean isOriginalNode=false;
      ITestContainerProviderService testContainerService=null;
      if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
        testContainerService=(ITestContainerProviderService)GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
        if (testContainerService != null) {
          isOriginalNode=testContainerService.isOriginalNode(node);
          if (isOriginalNode) {
            testContainerService.renameConnection(node,true);
          }
        }
      }
      int returnValue=externalNode.open(getViewer().getControl().getShell());
      if (!node.isReadOnly()) {
        if (returnValue == SWT.OK) {
          Command cmd=new ExternalNodeChangeCommand(node,externalNode,oldExternalData);
          CommandStack cmdStack=(CommandStack)part.getAdapter(CommandStack.class);
          cmdStack.execute(cmd);
        }
 else {
          externalNode.setExternalData(oldExternalData);
        }
      }
      if (isOriginalNode && (testContainerService != null)) {
        testContainerService.renameConnection(node,false);
      }
    }
 else {
      boolean isJoblet=false;
      if (PluginChecker.isJobLetPluginLoaded()) {
        AbstractProcessProvider jobletProcessProvider=AbstractProcessProvider.findProcessProviderFromPID(IComponent.JOBLET_PID);
        final IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
        boolean isAvoidShowJobletAfterDoubleClick=false;
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
          IComponentsLocalProviderService componentService=(IComponentsLocalProviderService)GlobalServiceRegister.getDefault().getService(IComponentsLocalProviderService.class);
          if (componentService != null) {
            isAvoidShowJobletAfterDoubleClick=componentService.isAvoidToShowJobletAfterDoubleClick();
          }
        }
        if (service != null && service.isJobletComponent(node) && !isAvoidShowJobletAfterDoubleClick) {
          isJoblet=true;
          String version=(String)node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
          final Item jobletItem=jobletProcessProvider.getJobletItem(node,version);
          RepositoryWorkUnit<Object> repositoryWorkUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
            @Override protected void run() throws LoginException, PersistenceException {
              if (jobletItem != null) {
                service.openJobletItem((JobletProcessItem)jobletItem);
              }
            }
          }
;
          repositoryWorkUnit.setAvoidUnloadResources(true);
          CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
        }
      }
      if (!isJoblet) {
        IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        String processName=(String)node.getPropertyValue(EParameterName.PROCESS_TYPE_PROCESS.getName());
        String version=(String)node.getPropertyValue(EParameterName.PROCESS_TYPE_VERSION.getName());
        boolean isAvoidShowJobAfterDoubleClick=false;
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsLocalProviderService.class)) {
          IComponentsLocalProviderService service=(IComponentsLocalProviderService)GlobalServiceRegister.getDefault().getService(IComponentsLocalProviderService.class);
          if (service != null) {
            isAvoidShowJobAfterDoubleClick=service.isAvoidToShowJobAfterDoubleClick();
          }
        }
        boolean isSelectUseDynamic=false;
        Object useDynamicJobValue=node.getPropertyValue(EParameterName.USE_DYNAMIC_JOB.getName());
        if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
          isSelectUseDynamic=(Boolean)useDynamicJobValue;
        }
        if (processName != null && !"String_Node_Str".equals(processName) && !isAvoidShowJobAfterDoubleClick && !isSelectUseDynamic) {
          ItemCacheManager.clearCache();
          ProcessItem processItem=ItemCacheManager.getProcessItem(processName,version);
          if (processItem == null) {
            return;
          }
          Property updatedProperty=null;
          try {
            updatedProperty=ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(processItem)),processName).getProperty();
          }
 catch (          PersistenceException e) {
            CommonExceptionHandler.process(e);
          }
          processItem=(ProcessItem)updatedProperty.getItem();
          final ProcessItem item=processItem;
          RepositoryWorkUnit<Object> repositoryWorkUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
            @Override protected void run() throws LoginException, PersistenceException {
              try {
                if (item != null) {
                  ERepositoryObjectType repObjType=ERepositoryObjectType.getItemType(item);
                  IJobEditorHandler editorInputFactory=JobEditorHandlerManager.getInstance().extractEditorInputFactory(repObjType.getType());
                  editorInputFactory.openJobEditor(editorInputFactory.createJobEditorInput(item,true));
                }
              }
 catch (              PartInitException e) {
                MessageBoxExceptionHandler.process(e);
              }
            }
          }
;
          repositoryWorkUnit.setAvoidUnloadResources(true);
          CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().executeRepositoryWorkUnit(repositoryWorkUnit);
        }
 else {
          try {
            page.showView(ComponentSettingsView.ID);
          }
 catch (          PartInitException e) {
            CommonExceptionHandler.process(e);
          }
        }
      }
    }
  }
  super.performRequest(req);
}