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

Null Pointer when publishing assets and server is down

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin
    • None
    • Jenkins: 1.613
      p4-plugin: 1.2.1

      I was attempting to publish assets as a post build action in one of my jobs and didn't realise the perforce server that it would publish to wasn't online.

      The error I got was not helpful, but a Null Pointer instead:

      ERROR: Publisher 'Perforce: Publish assets' aborted due to exception: 
      java.lang.InterruptedException: P4: Unable to setup workspace: java.lang.NullPointerException
      	at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:63)
      	at org.jenkinsci.plugins.p4.asset.AssetNotifier.perform(AssetNotifier.java:87)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
      	at hudson.model.Build$BuildExecution.post2(Build.java:185)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
      	at hudson.model.Run.execute(Run.java:1769)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:374)
      

      I'm assuming there was a proper error message at some point about not being able to connect to the perforce server but that was lost by a Null Pointer which sent me on a wild goose chase for a while until I realised what was really going on.

      Looking at the code in AbstractTask.java I'm assuming ClientHelper p4 = getConnection(); doesn't error if it can't get a connection, it just returns null and the code below doesn't check for that first?
      The catch block does nothing to show the full stack of Exception e, so it's hard to say for sure where the Null Pointer comes from, but that's my guess anyway. Ideally it would throw a RuntimeException(err, e); instead of the InterruptedException(err);?

            p4paul Paul Allen
            palmr Nick Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: