This issue is archived. You can view it, but you can't modify it. Learn more

ExportXMLWordPrintable

      The cast seems redundant. I'm not sure if this affects other fields, but scm.locations is what I use. I need to do some checking out on the node, but with slightly different parameters.

      The failing checkout step:
                  checkout  changelog: false, scm: [$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: scm.locations, quietOperation: true, workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]

       

      Produces following error:

      {{ java.lang.ClassCastException: hudson.scm.SubversionSCM.locations expects java.util.List<hudson.scm.SubversionSCM$ModuleLocation> but received class [Lhudson.scm.SubversionSCM$ModuleLocation;}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:394)}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:318)}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:259)}}
      {{ Caused: java.lang.IllegalArgumentException: Could not instantiate {excludedRegions=, quietOperation=true, workspaceUpdater={$class=UpdateWithCleanUpdater}, additionalCredentials=[], excludedUsers=, filterChangelog=false, excludedRevprop=, ignoreDirPropChanges=false, includedRegions=, locations=[Lhudson.scm.SubversionSCM$ModuleLocation;@17f0e7d, excludedCommitMessages=} for SubversionSCM(locations: ModuleLocation(remote: String, credentialsId: String, local: String, depthOption: String, ignoreExternalsOption: boolean)[], workspaceUpdater: WorkspaceUpdater{CheckoutUpdater() | NoopUpdater() | UpdateUpdater() | UpdateWithCleanUpdater() | UpdateWithRevertUpdater()}, browser: SubversionRepositoryBrowser{Assembla(spaceName: String) | CollabNetSVN(url: String) | FishEyeSVN(url: String, rootModule: String) | Phabricator(url: String, repo: String) | RedmineRepositoryBrowser(repositoryId: String) | SVNWeb(url: String) | Sventon(url: String, repositoryInstance: String) | Sventon2(url: String, repositoryInstance: String) | ViewSVN(url: String) | WebSVN(url: String)}, excludedRegions: String, excludedUsers: String, excludedRevprop: String, excludedCommitMessages: String, includedRegions: String, ignoreDirPropChanges: boolean, filterChangelog: boolean, additionalCredentials: AdditionalCredentials(realm: String, credentialsId: String)[], quietOperation: boolean)}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:264)}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:380)}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.buildArguments(DescribableModel.java:318)}}
      {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:259)}}
      {{ at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:201)}}
      {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:205)}}
      {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)}}
      {{ at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)}}
      {{ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)}}
      {{ at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)}}
      {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)}}
      {{ at java.lang.reflect.Method.invoke(Unknown Source)}}
      {{ at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)}}
      {{ at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)}}
      {{ at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)}}
      {{ at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)}}
      {{ at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)}}
      {{ at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)}}
      {{ at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)}}
      {{ at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)}}
      {{ at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)}}
      {{ at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133)}}
      {{ at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)}}
      {{ at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)}}
      {{ at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)}}
      {{ at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)}}
      {{ at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)}}
      {{ at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)}}

       

      Adding a cast to List<...> resolves the error:

                  checkout  changelog: false, scm: [$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: scm.locations as java.util.List<hudson.scm.SubversionSCM$ModuleLocation>, quietOperation: true, workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]

            Assignee:
            Unassigned
            Reporter:
            Edgars Batna
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: