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

PipelineTriggersProperty#removeTrigger causes java.lang.UnsupportedOperationException

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: workflow-job-plugin
    • Labels:
      None
    • Environment:
      Workflow-job-plugin 2.12.1 latest Jenkins LTS
    • Similar Issues:

      Description

      Plugin calls WorkflowJob.addTrigger during a job via a custom buildstep

      Upon update to the newer plugins from Workflow-job-plugin 2.0 we get the following stacktrace:

      java.lang.UnsupportedOperationException
      	at java.util.Collections$UnmodifiableCollection.remove(Collections.java:1058)
      	at org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty.removeTrigger(PipelineTriggersJobProperty.java:116)
      	at org.jenkinsci.plugins.workflow.job.WorkflowJob.addTrigger(WorkflowJob.java:562)
      

      Somehow PipelineTriggerJobProperty has a UnmodifableCollection inside it

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            I think I see the problem - something must have called WorkflowJob.setTriggers(List) with an UnmodifiableList as the parameter. Easy enough to work around.

            Show
            abayer Andrew Bayer added a comment - I think I see the problem - something must have called WorkflowJob.setTriggers(List) with an UnmodifiableList as the parameter. Easy enough to work around.
            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/workflow-job-plugin/pull/64
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/job/properties/PipelineTriggersJobProperty.java
            src/test/java/org/jenkinsci/plugins/workflow/job/properties/PipelineTriggersJobPropertyTest.java
            http://jenkins-ci.org/commit/workflow-job-plugin/7b9b83604f705ec47837a163817738bdb93fe14e
            Log:
            [FIXED JENKINS-45460] Allow adding triggers after migration.

            Before this, if you had triggers configured before upgrading from a
            version that didn't yet have PipelineTriggersJobProperty,
            PipelineTriggersJobProperty.setTriggers(List) was called via
            WorkflowJob.onLoad with the old DescribableList triggers.toList() -
            which returns an UnmodifiableList. Oops.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/workflow/job/properties/PipelineTriggersJobProperty.java src/test/java/org/jenkinsci/plugins/workflow/job/properties/PipelineTriggersJobPropertyTest.java http://jenkins-ci.org/commit/workflow-job-plugin/7b9b83604f705ec47837a163817738bdb93fe14e Log: [FIXED JENKINS-45460] Allow adding triggers after migration. Before this, if you had triggers configured before upgrading from a version that didn't yet have PipelineTriggersJobProperty, PipelineTriggersJobProperty.setTriggers(List) was called via WorkflowJob.onLoad with the old DescribableList triggers.toList() - which returns an UnmodifiableList. Oops.
            Hide
            abayer Andrew Bayer added a comment -

            Will be in next workflow-job release (2.15 most likely)

            Show
            abayer Andrew Bayer added a comment - Will be in next workflow-job release (2.15 most likely)

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                Carbon Kieran Webber
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: