Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5151

NullPointerException can be raised when the workspace is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • rubyMetrics-plugin
    • None

      If the workspace is null, the *Publisher classes will end up throwing a NullPointerException, causing the build to fail unexpectedly. According to AbstractBuild.getWorkspace(), the workspace can be null when it's on a slave that is no longer connected.

      Line 49 of RailsStatsPublisher.java:
      return fail(build, listener, "This is not a rails app directory: " + workspace.getName());
      can be changed to
      return fail(build, listener, "This is not a rails app directory: " + (workspace == null ? "null" : workspace.getName());

      I marked this minor because the build will fail anyway, it's just more descriptive without the uncaught Exception.

            david_calavera david_calavera
            adamstegman adamstegman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: