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

(Jira) Updater throws NullPointerException for labels

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: jira-plugin
    • Environment:
      RHEL5
      Jenkins ver. 1.642.2
      Jira Plugin 2.2
      Jenkins Job with an empty box of labels (and no checkmark)
    • Similar Issues:

      Description

      Under a special job configuration situation the plugin throws an exception when commenting issues

      Mar 03, 2016 12:49:06 PM hudson.plugins.jira.Updater perform
      WARNING: Error updating JIRA issues. Saving issues for next build.
      java.lang.NullPointerException
      	at hudson.plugins.jira.Updater.submitComments(Updater.java:177)
      	at hudson.plugins.jira.Updater.perform(Updater.java:128)
      	at hudson.plugins.jira.JiraIssueUpdater.perform(JiraIssueUpdater.java:64)
      	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
      	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
      	at hudson.model.Build$BuildExecution.post2(Build.java:185)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
      	at hudson.model.Run.execute(Run.java:1763)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      

      As this do not change the job result, we had not noticed that at the beginning. However, this exception results into not saving the state (i.e. commenting on prior Jira issues). And this results into re-commenting on the same issue on every subsequented build.

      I've tracked down the exception a bit:

      That's weired, because JiraIssueUpdate's contructor ensures the non-nullability of labels already. Does the plugin can be created bypassing the specific constructor? Otherwise it does not explain how labels can be null.

      My workaround is setting master as a label (which is okay for me). But it looks definitely like bug.

        Attachments

          Issue Links

            Activity

            Hide
            warden Radek Antoniuk added a comment -

            So, the only explanation would be JiraIssueUpdater.java:97. I'm just wondering if that's the case that this update was "delayed" and processed via Aggregator.

            Show
            warden Radek Antoniuk added a comment - So, the only explanation would be JiraIssueUpdater.java:97. I'm just wondering if that's the case that this update was "delayed" and processed via Aggregator.
            Hide
            jcarsique Julien Carsique added a comment - - edited

            There are maybe two separate issues:

            • NPE on labels is blocker for the comments. Fixed with https://github.com/jenkinsci/jira-plugin/pull/92
            • null labels come from somewhere; I couldn't quickly figure how. What are the labels? JIRA labels? Why would you hard-code it to master? The above fix simply initiates the labels as an empty list when the constructor is called with a null value, and it works fine as a preventive action without any unwanted behavior (see for instance https://jira.nuxeo.com/browse/NXP-18806 which has been properly updated by the jira plugin with that fix).

            I suggest to solve the current issue with such a fix https://github.com/jenkinsci/jira-plugin/pull/92.
            Then, create a dedicated issue for the labels if something does not work as expected.

            Show
            jcarsique Julien Carsique added a comment - - edited There are maybe two separate issues: NPE on labels is blocker for the comments. Fixed with https://github.com/jenkinsci/jira-plugin/pull/92 null labels come from somewhere; I couldn't quickly figure how. What are the labels? JIRA labels? Why would you hard-code it to master? The above fix simply initiates the labels as an empty list when the constructor is called with a null value, and it works fine as a preventive action without any unwanted behavior (see for instance https://jira.nuxeo.com/browse/NXP-18806 which has been properly updated by the jira plugin with that fix). I suggest to solve the current issue with such a fix https://github.com/jenkinsci/jira-plugin/pull/92 . Then, create a dedicated issue for the labels if something does not work as expected.
            Hide
            knalli knalli added a comment -

            I think also for Updater.java itself the change is okay.

            null labels come from somewhere; I couldn't quickly figure how. What are the labels? JIRA labels?

            Node labels

            Well, I've fixed this setting a label for a job configuration setting called something like "run this job only if the following labels are applied to the build node). Actually, it was the only setting with "label" in its name which has came into my mind at this time (and it had worked). I'm absolutely not sure about the flow of these data attributes.

            Show
            knalli knalli added a comment - I think also for Updater.java itself the change is okay. null labels come from somewhere; I couldn't quickly figure how. What are the labels? JIRA labels? Node labels Well, I've fixed this setting a label for a job configuration setting called something like "run this job only if the following labels are applied to the build node). Actually, it was the only setting with "label" in its name which has came into my mind at this time (and it had worked). I'm absolutely not sure about the flow of these data attributes.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Julien Carsique
            Path:
            src/main/java/hudson/plugins/jira/Updater.java
            http://jenkins-ci.org/commit/jira-plugin/b6ba033b5ee3ee6cfe8362573f16891b2e9d4465
            Log:
            JENKINS-33293: fix NPE on labels in Updater.submitComments()

            Duplicated by JENKINS-33551

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Julien Carsique Path: src/main/java/hudson/plugins/jira/Updater.java http://jenkins-ci.org/commit/jira-plugin/b6ba033b5ee3ee6cfe8362573f16891b2e9d4465 Log: JENKINS-33293 : fix NPE on labels in Updater.submitComments() Duplicated by JENKINS-33551

              People

              • Assignee:
                warden Radek Antoniuk
                Reporter:
                knalli knalli
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: