SonarQube Eclipse
  1. SonarQube Eclipse
  2. SONARIDE-317

NullPointerException in the ServerLocationWizardPage.java source file at line 140

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: Configuration
    • Labels:
      None
    • Number of attachments :
      0

      Description

      While configuring a new Sonar server, it's possible to get a NullPointerException at line 140 if an unexpected exception occurs while testing the new url.

            @Override
            public void widgetSelected(SelectionEvent e) {
              // We need those variables - in other case we would get an IllegalAccessException
              final String serverUrl = getServerUrl();
              final String username = getUsername();
              final String password = getPassword();
              try {
                getWizard().getContainer().run(true, true, new IRunnableWithProgress() {
      
                  public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    monitor.beginTask("Testing", IProgressMonitor.UNKNOWN);
                    try {
                      if (SonarCorePlugin.getServersManager().testSonar(serverUrl, username, password)) {
                        status = new Status(Status.OK, ISonarConstants.PLUGIN_ID, Messages.ServerLocationWizardPage_msg_connected);
                      } else {
                        status = new Status(Status.ERROR, ISonarConstants.PLUGIN_ID, Messages.ServerLocationWizardPage_msg_error);
                      }
                    } catch (CoreException e) {
                      status = e.getStatus();
                    } catch (OperationCanceledException e) {
                      status = Status.CANCEL_STATUS;
                      throw new InterruptedException();
                    } catch (Exception e) {
                      throw new InvocationTargetException(e);
                    } finally {
                      monitor.done();
                    }
                  }
                });
              } catch (InvocationTargetException e1) {
                LoggerFactory.getLogger(getClass()).error(e1.getMessage(), e1);
              } catch (InterruptedException e1) { 
              }
              getWizard().getContainer().updateButtons();
      
              String message = status.getMessage();  <- PROBLEM IS HERE, status CAN BE NULL
              switch (status.getSeverity()) {
                case IStatus.OK:
                  setMessage(message, IMessageProvider.INFORMATION);
                  break;
                default:
                  setMessage(message, IMessageProvider.ERROR);
                  break;
              }
            }
      
      

        Activity

        Hide
        Freddy Mallet added a comment -

        No easy way to manually test it.

        Show
        Freddy Mallet added a comment - No easy way to manually test it.

          People

          • Assignee:
            David Gageot
            Reporter:
            Freddy Mallet
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: