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

NoStaplerConstructorException on UserMergeOptions.mergeStrategy

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • git-plugin
    • Jenkins 1.642.3, Pipeline 2.0, Git Plugin 2.4.4, Git Client Plugin 1.19.6

    Description

      Using Jenkins 1.642.3 and Pipeline 2.0, an exception is thrown when the DataBoundConstructor is missing from plugin code. The problem can be reproduced with the following line up: Jenkins 1.642.3, Pipeline 2.0, Git Plugin 2.4.4, Git Client Plugin 1.19.6.

      The problem did not exists with Pipeline 1.15 and Jenkins 1.642.1.

      To reproduce the problem, install those plugins, create a Pipeline job, and go in the snippet generator, then:

      • select the "checkout" step
      • select Git
      • Additional behaviors: Merge Before Build
      • Click "Generate Groovy"

      The stacktrace in the console should contain:

      Caused by: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.gitclient.MergeCommand$Strategy
      

      And there is no groovy code generated.

      Attachments

        Issue Links

          Activity

            jglick Jesse Glick added a comment -

            Offered an alternate patch.

            jglick Jesse Glick added a comment - Offered an alternate patch.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/hudson/plugins/git/UserMergeOptions.java
            src/main/resources/hudson/plugins/git/UserMergeOptions/config.jelly
            http://jenkins-ci.org/commit/git-plugin/624ffcef88c110149820e67356073285611edad9
            Log:
            JENKINS-34070 Fixing UserMergeOptions.mergeStrategy databinding.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/git/UserMergeOptions.java src/main/resources/hudson/plugins/git/UserMergeOptions/config.jelly http://jenkins-ci.org/commit/git-plugin/624ffcef88c110149820e67356073285611edad9 Log: JENKINS-34070 Fixing UserMergeOptions.mergeStrategy databinding.

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/main/java/hudson/plugins/git/UserMergeOptions.java
            src/main/resources/hudson/plugins/git/UserMergeOptions/config.jelly
            http://jenkins-ci.org/commit/git-plugin/44e9eb0716165de33f277fd2552d6a4de2961bb0
            Log:
            Merge pull request #580 from jglick/UserMergeOptions.mergeStrategy-JENKINS-34070

            JENKINS-34070 Fixing UserMergeOptions.mergeStrategy databinding

            Compare: https://github.com/jenkinsci/git-plugin/compare/a81c6552af4a...44e9eb071616

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/UserMergeOptions.java src/main/resources/hudson/plugins/git/UserMergeOptions/config.jelly http://jenkins-ci.org/commit/git-plugin/44e9eb0716165de33f277fd2552d6a4de2961bb0 Log: Merge pull request #580 from jglick/UserMergeOptions.mergeStrategy- JENKINS-34070 JENKINS-34070 Fixing UserMergeOptions.mergeStrategy databinding Compare: https://github.com/jenkinsci/git-plugin/compare/a81c6552af4a...44e9eb071616
            markewaite Mark Waite added a comment -

            Included in git plugin 3.9.0 released 12 May 2018

            markewaite Mark Waite added a comment - Included in git plugin 3.9.0 released 12 May 2018
            renescheibe René Scheibe added a comment - - edited

            This change breaks existing functionality when the extension was configured in a pipeline like this (lowercase mergeStrategy):

            checkout([$class: 'GitSCM', extensions: [[$class: 'PreBuildMerge', options: [mergeStrategy: 'default', ...]]]])
            
            java.lang.IllegalArgumentException: No enum constant org.jenkinsci.plugins.gitclient.MergeCommand.Strategy.default
            	at java.lang.Enum.valueOf(Unknown Source)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:404)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:360)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:283)
            Caused: java.lang.IllegalArgumentException: Could not instantiate {mergeStrategy=default, fastForwardMode=FF, mergeTarget=develop, mergeRemote=origin} for UserMergeOptions(mergeTarget: String, fastForwardMode?: GitPluginFastForwardMode[FF, FF_ONLY, NO_FF], mergeRemote?: String, mergeStrategy?: Strategy[DEFAULT, RESOLVE, RECURSIVE, OCTOPUS, OURS, SUBTREE, RECURSIVE_THEIRS])
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:286)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:402)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:340)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:281)
            Caused: java.lang.IllegalArgumentException: Could not instantiate {options={fastForwardMode=FF, mergeRemote=origin, mergeStrategy=default, mergeTarget=develop}} for PreBuildMerge(options: UserMergeOptions(mergeTarget: String, fastForwardMode?: GitPluginFastForwardMode[FF, FF_ONLY, NO_FF], mergeRemote?: String, mergeStrategy?: Strategy[DEFAULT, RESOLVE, RECURSIVE, OCTOPUS, OURS, SUBTREE, RECURSIVE_THEIRS]))
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:286)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:402)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.coerceList(DescribableModel.java:485)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:387)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:340)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:281)
            

            I think this was an incorrect use anyway that worked by accident just for the value "default".

            renescheibe René Scheibe added a comment - - edited This change breaks existing functionality when the extension was configured in a pipeline like this (lowercase mergeStrategy ): checkout([$class: 'GitSCM' , extensions: [[$class: 'PreBuildMerge' , options: [mergeStrategy: ' default ' , ...]]]]) java.lang.IllegalArgumentException: No enum constant org.jenkinsci.plugins.gitclient.MergeCommand.Strategy. default at java.lang.Enum.valueOf(Unknown Source) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:404) at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:360) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:283) Caused: java.lang.IllegalArgumentException: Could not instantiate {mergeStrategy= default , fastForwardMode=FF, mergeTarget=develop, mergeRemote=origin} for UserMergeOptions(mergeTarget: String , fastForwardMode?: GitPluginFastForwardMode[FF, FF_ONLY, NO_FF], mergeRemote?: String , mergeStrategy?: Strategy[DEFAULT, RESOLVE, RECURSIVE, OCTOPUS, OURS, SUBTREE, RECURSIVE_THEIRS]) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:286) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:402) at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:340) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:281) Caused: java.lang.IllegalArgumentException: Could not instantiate {options={fastForwardMode=FF, mergeRemote=origin, mergeStrategy= default , mergeTarget=develop}} for PreBuildMerge(options: UserMergeOptions(mergeTarget: String , fastForwardMode?: GitPluginFastForwardMode[FF, FF_ONLY, NO_FF], mergeRemote?: String , mergeStrategy?: Strategy[DEFAULT, RESOLVE, RECURSIVE, OCTOPUS, OURS, SUBTREE, RECURSIVE_THEIRS])) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:286) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:402) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerceList(DescribableModel.java:485) at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:387) at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:340) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:281) I think this was an incorrect use anyway that worked by accident just for the value "default".

            People

              jglick Jesse Glick
              deepchip Martin d'Anjou
              Votes:
              5 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: