Program: 126553
Project: 126553
Buggy source:
@Override public Object start(IApplicationContext context) throws Exception {
  Display display=PlatformUI.createDisplay();
  boolean inuse=false;
  try {
    Shell shell=new Shell(display,SWT.ON_TOP);
    if (checkUnSupportJavaVersion(shell)) {
      shell.dispose();
      return EXIT_OK;
    }
    if (!Boolean.getBoolean("String_Node_Str")) {
      inuse=!acquireWorkspaceLock(shell);
    }
    if (inuse) {
      MessageDialog.openError(shell,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      shell.dispose();
      return EXIT_OK;
    }
    CoreRepositoryPlugin.getDefault().setRCPMode();
    checkBrowserSupport();
    if (!ArrayUtils.contains(Platform.getApplicationArgs(),EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND) && !Boolean.parseBoolean(System.getProperty("String_Node_Str"))) {
      openLicenseAndRegister(shell);
    }
    IMigrationToolService service=(IMigrationToolService)GlobalServiceRegister.getDefault().getService(IMigrationToolService.class);
    service.executeWorspaceTasks();
    boolean logUserOnProject=logUserOnProject(display.getActiveShell(),inuse);
    try {
      if (!logUserOnProject) {
        context.applicationRunning();
        return EXIT_OK;
      }
    }
  finally {
      shell.dispose();
    }
    if (System.getProperty(org.eclipse.equinox.app.IApplicationContext.EXIT_DATA_PROPERTY) != null) {
      return IApplication.EXIT_RELAUNCH;
    }
    boolean afterUpdate=false;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
      ICoreTisService tisService=(ICoreTisService)GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
      afterUpdate=tisService.needRestartAfterUpdate();
    }
    if (LoginComposite.isRestart) {
      if (afterUpdate) {
        EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_RELOAD_COMMAND,Boolean.TRUE.toString(),false);
        EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND,null,true);
        return IApplication.EXIT_RELAUNCH;
      }
      return IApplication.EXIT_RESTART;
    }
    IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (brandingService.isPoweredbyTalend()) {
      IPreferenceStore store=PlatformUI.getPreferenceStore();
      store.putValue(IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID,"String_Node_Str");
    }
    int returnCode=PlatformUI.createAndRunWorkbench(display,new ApplicationWorkbenchAdvisor());
    if (returnCode == PlatformUI.RETURN_RESTART) {
      EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_RELOAD_COMMAND,Boolean.FALSE.toString(),false);
      EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_PROJECT_TYPE_COMMAND,null,true);
      EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND,null,true,true);
      if (Platform.inDevelopmentMode()) {
        return IApplication.EXIT_RESTART;
      }
      return IApplication.EXIT_RELAUNCH;
    }
 else {
      return IApplication.EXIT_OK;
    }
  }
  finally {
    display.dispose();
    if (!inuse) {
      releaseWorkspaceLock();
    }
  }
}

Fixed version (ground truth):
@Override public Object start(IApplicationContext context) throws Exception {
  Display display=PlatformUI.createDisplay();
  boolean inuse=false;
  try {
    Shell shell=new Shell(display,SWT.ON_TOP);
    if (checkUnSupportJavaVersion(shell)) {
      shell.dispose();
      return EXIT_OK;
    }
    inuse=!acquireWorkspaceLock(shell);
    if (inuse) {
      MessageDialog.openError(shell,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      shell.dispose();
      return EXIT_OK;
    }
    CoreRepositoryPlugin.getDefault().setRCPMode();
    checkBrowserSupport();
    if (!ArrayUtils.contains(Platform.getApplicationArgs(),EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND) && !Boolean.parseBoolean(System.getProperty("String_Node_Str"))) {
      openLicenseAndRegister(shell);
    }
    IMigrationToolService service=(IMigrationToolService)GlobalServiceRegister.getDefault().getService(IMigrationToolService.class);
    service.executeWorspaceTasks();
    boolean logUserOnProject=logUserOnProject(display.getActiveShell(),inuse);
    try {
      if (!logUserOnProject) {
        context.applicationRunning();
        return EXIT_OK;
      }
    }
  finally {
      shell.dispose();
    }
    if (System.getProperty(org.eclipse.equinox.app.IApplicationContext.EXIT_DATA_PROPERTY) != null) {
      return IApplication.EXIT_RELAUNCH;
    }
    boolean afterUpdate=false;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
      ICoreTisService tisService=(ICoreTisService)GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
      afterUpdate=tisService.needRestartAfterUpdate();
    }
    if (LoginComposite.isRestart) {
      if (afterUpdate) {
        EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_RELOAD_COMMAND,Boolean.TRUE.toString(),false);
        EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND,null,true);
        return IApplication.EXIT_RELAUNCH;
      }
      return IApplication.EXIT_RESTART;
    }
    IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (brandingService.isPoweredbyTalend()) {
      IPreferenceStore store=PlatformUI.getPreferenceStore();
      store.putValue(IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID,"String_Node_Str");
    }
    int returnCode=PlatformUI.createAndRunWorkbench(display,new ApplicationWorkbenchAdvisor());
    if (returnCode == PlatformUI.RETURN_RESTART) {
      EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_RELOAD_COMMAND,Boolean.FALSE.toString(),false);
      EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_PROJECT_TYPE_COMMAND,null,true);
      EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND,null,true,true);
      if (Platform.inDevelopmentMode()) {
        return IApplication.EXIT_RESTART;
      }
      return IApplication.EXIT_RELAUNCH;
    }
 else {
      return IApplication.EXIT_OK;
    }
  }
  finally {
    display.dispose();
    if (!inuse) {
      releaseWorkspaceLock();
    }
  }
}