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

NullPointerException in Configuration Screen

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: other
    • Labels:
      None
    • Environment:
      Platform: All, OS: Windows XP
    • Similar Issues:

      Description

      On Windows you get an NPE in the Configuration screen; I tracked this down to
      hudson.util.FormFieldValidator line 368, where the system attempts to retrieve
      the PATH environment variable. Unfortunately this is case sensitive, and many
      Windows installations store this variable under the value Path - so it returns
      null, resulting in the NPE.

        Attachments

          Activity

          Hide
          mahoney266 mahoney266 added a comment -

          Created an attachment (id=154)
          Patch that fixes issue

          Show
          mahoney266 mahoney266 added a comment - Created an attachment (id=154) Patch that fixes issue
          Hide
          mahoney266 mahoney266 added a comment -

          Thought I'd do it properly and provide a test and patch... mocking static calls
          on java.lang classes is a pig! If you can be bothered to make the unit test
          work, you need jmockit (https://jmockit.dev.java.net/) and you must run your
          test with the following VM arguments:

          -javaagent:<full_path_to>/jmockit.jar
          -Xbootclasspath/a:"<full_path_to_EnvVars_class>:<full_path_to_EnvVarsTest_class>:<full_path_to>/junit.jar:<full_path_to>/jmockit.jar"

          Just to make it more fun, the path and classpath separators have to be system
          correct. On my machine it looks like this:

          -javaagent:c:\jmockit.jar -Xbootclasspath/a:"c:\Eclipse
          Workspaces\hudson\hudson-core\target\classes;c:\Eclipse
          Workspaces\hudson\hudson-core\target\test-classes;c:\Program
          Files\eclipse\plugins\org.junit_3.8.2.v200711021030\junit.jar;c:\jmockit.jar"

          Show
          mahoney266 mahoney266 added a comment - Thought I'd do it properly and provide a test and patch... mocking static calls on java.lang classes is a pig! If you can be bothered to make the unit test work, you need jmockit ( https://jmockit.dev.java.net/ ) and you must run your test with the following VM arguments: -javaagent:<full_path_to>/jmockit.jar -Xbootclasspath/a:"<full_path_to_EnvVars_class>:<full_path_to_EnvVarsTest_class>:<full_path_to>/junit.jar:<full_path_to>/jmockit.jar" Just to make it more fun, the path and classpath separators have to be system correct. On my machine it looks like this: -javaagent:c:\jmockit.jar -Xbootclasspath/a:"c:\Eclipse Workspaces\hudson\hudson-core\target\classes;c:\Eclipse Workspaces\hudson\hudson-core\target\test-classes;c:\Program Files\eclipse\plugins\org.junit_3.8.2.v200711021030\junit.jar;c:\jmockit.jar"
          Hide
          mahoney266 mahoney266 added a comment -

          Just found this rather useful guide to using jmockit with Maven, that resolves a
          lot of the issues.

          Show
          mahoney266 mahoney266 added a comment - Just found this rather useful guide to using jmockit with Maven, that resolves a lot of the issues.
          Show
          mahoney266 mahoney266 added a comment - http://www.jroller.com/xwarzee/entry/jmockit_maven2_how_to
          Hide
          kohsuke Kohsuke Kawaguchi added a comment -

          Thanks for your analysis of the issue, the patch, and the test case. I applied
          your change toward 1.166.

          If you'd like to be able to fix this kind of issues more quickly, I'd be happy
          to give you a commit access. Please write to me in e-mail if that's the case.

          Show
          kohsuke Kohsuke Kawaguchi added a comment - Thanks for your analysis of the issue, the patch, and the test case. I applied your change toward 1.166. If you'd like to be able to fix this kind of issues more quickly, I'd be happy to give you a commit access. Please write to me in e-mail if that's the case.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            mahoney266 mahoney266
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: