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

ArrayIndexOutOfBoundsException when $VARIABLE in project list contains comma

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Set an environment variable to PROJECTS=job1,job2
      Add Trigger parameterized build on other projects step and set Projects to build to $PROJECTS

      When running the job you will get an

      11:14:36 java.lang.ArrayIndexOutOfBoundsException: 1
      11:14:36 	at hudson.plugins.parameterizedtrigger.BuildTrigger.perform(BuildTrigger.java:123)
      11:14:36 	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      11:14:36 	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
      11:14:36 	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676)
      11:14:36 	at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
      11:14:36 	at hudson.model.Run.execute(Run.java:1782)
      11:14:36 	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      11:14:36 	at hudson.model.ResourceController.execute(ResourceController.java:97)
      11:14:36 	at hudson.model.Executor.run(Executor.java:405)

      The offending code is

      					String[] projects = config.getProjects(build.getEnvironment(listener)).split(",");
      					String[] vars = config.getProjects().split(",");
      					for (int i = 0; i < projects.length; i++) {
      if (vars[i].trim().contains("$")) {

      One can easily see the arrays will be of different length when an enviorment variable contains the , character.

      I don't understand why this logic is needed there though and the commit message only says "Trigger project by using parameters". Sergey Shelomentsev ?

        Attachments

          Activity

            People

            • Assignee:
              huybrechts huybrechts
              Reporter:
              jbochenski Jakub Bochenski
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: