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

NoStaplerConstructorException on UserMergeOptions.mergeStrategy

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Environment:
      Jenkins 1.642.3, Pipeline 2.0, Git Plugin 2.4.4, Git Client Plugin 1.19.6
    • Similar Issues:

      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

            Hide
            jglick Jesse Glick added a comment -

            Offered an alternate patch.

            Show
            jglick Jesse Glick added a comment - Offered an alternate patch.
            Hide
            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.

            Show
            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.
            Hide
            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

            Show
            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
            Hide
            markewaite Mark Waite added a comment -

            Included in git plugin 3.9.0 released 12 May 2018

            Show
            markewaite Mark Waite added a comment - Included in git plugin 3.9.0 released 12 May 2018
            Hide
            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".

            Show
            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

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

                Dates

                • Created:
                  Updated:
                  Resolved: