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

ClassCastException-warning in case of a matrix-job (multi-configuration project)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • build-timeout-plugin
    • Jenkins LTS 2.361.1 in Windows x64,
      Build Timeout Version1.24

      In case of a matrix (Ie. multi-configuration) project there's a warning about a ClassCastException; see below ...

      UnitTests#715 cannot allow individual jobs to overwrite timeout due to ClassCastException
      java.lang.ClassCastException: class hudson.matrix.MatrixProject cannot be cast to class hudson.model.Project (hudson.matrix.MatrixProject is in unnamed module of loader jenkins.util.URLClassLoader2 @8990457; hudson.model.Project is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @8519cb4)
      at hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration.timeOutFor(GlobalTimeOutConfiguration.java:91)
      at hudson.plugins.build_timeout.global.GlobalTimeOutRunListener.setUpEnvironment(GlobalTimeOutRunListener.java:43)
      at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:615)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:483)
      at hudson.model.Run.execute(Run.java:1899)
      at hudson.matrix.MatrixBuild.run(MatrixBuild.java:323)
      at hudson.model.ResourceController.execute(ResourceController.java:107)
      at hudson.model.Executor.run(Executor.java:449)

       

      IMHO, the current implementation of timeOutFor in GlobalTimeOutConfiguration.java (line #91) "needs" an project of type Project<?, ?> (returned by build.getProject()) to call the method getBuilders(). But also a project of type hudson.matrix.MatrixProject provides the same method the get the builders-list.

      I think (but I'm not a "real" java-developer), something like ...

      List<Builder> builders = (build.getProject() instanceof hudson.matrix.MatrixProject)
              ? ((hudson.matrix.MatrixProject)  build.getProject()).getBuilders()
              : ((Project<?, ?>)  build.getProject()).getBuilders();

      ... may extend this implementation to be also applicable for a matrix-project.

       

      Best regards from Salzburg,
      Markus

            kohsuke Kohsuke Kawaguchi
            gmc_devel GMC Software Development B&R Corporate
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: