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

Null pointer exception when issuing p4 where commands

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • p4-plugin
    • None
    • Windows Server 2003

      At the beginning of a build the Perforce plugin executes a series of "p4 where" commands to get the locations of files included in a changelist. If one of these files is not within the workspace for the build the job fails with a null pointer exception. If I add the files to the workspace view then the job starts working.

      Some explanation may be in order because you may be wondering why not all files are in the build workspace. This is because we have separate Jenkins jobs for each release, and each job has it's own Perforce workspace that includes only the files for that specific release. Each release is it's own directory at the top of the directory tree, so our workspace view specifications follow this format:

      //depot/product_name/release/source_code_directory_tree/... //workspace_release/...

      If a developer submits a changelist that includes files in multiple releases, then the release portion of the path will be different. It's possible to modify the same file, say sample.java, for both releases, so the p4 where command will be working with files like:

      //depot/product_name/1.0/sample.java
      //depot/product_name/1.1/sample.java

      For the 1.0 release the p4 where command will work fine for the first file, but p4 where command for the second file causes a null pointer exception for the release 1.1

      Here's the console log from the build for our 5.2.1 release. Note how the "p4 where" command works OK for the file in the 5.2.1 release, but fails for the file in the 5.2.2 release.

      [build_PRODUCT_5.2.1] $ "E:\Program Files\Perforce\p4" -G where //depot/PRODUCT/5.2.1/PasswordRuleSet.java
      [build_PRODUCT_5.2.1] $ "E:\Program Files\Perforce\p4" -G where //depot/PRODUCT/5.2.2/PasswordChangeDialog.java
      FATAL: null
      java.lang.NullPointerException
      at hudson.plugins.perforce.PerforceSCMHelper.parseWhereMapping(PerforceSCMHelper.java:133)
      at com.tek42.perforce.parse.Changes.calculateWorkspacePaths(Changes.java:78)
      at com.tek42.perforce.parse.Changes.getChangelist(Changes.java:67)
      at com.tek42.perforce.parse.Changes.getChangelistsFromNumbers(Changes.java:403)
      at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:628)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1184)
      at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:537)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:425)
      at hudson.model.Run.run(Run.java:1376)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:175)

          [JENKINS-10327] Null pointer exception when issuing p4 where commands

          halostatue added a comment -

          JENKINS-10327 and JENKINS-10328 are duplicates of one another.

          halostatue added a comment - JENKINS-10327 and JENKINS-10328 are duplicates of one another.

            Unassigned Unassigned
            vegebrain VegeBrain
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: