NullPointerException can be raised when the workspace is null

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: