jenkinsci / jenkinsci/parameterized-trigger-plugin

[JENKINS-45937] ArrayIndexOutOfBoundsException when $VARIABLE in project list contains comma

Open
#730 0 comments 0 reactions 0 assignees View on GitHub
component:parameterized-trigger-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
77
Forks
174
Avg merge
22h 27m
Merged PRs (30d)
1

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". sshelomentsev ?

---
Originally reported by jbochenski, imported from: ArrayIndexOutOfBoundsException when $VARIABLE in project list contains comma


  • assignee: huybrechts
  • status: Open
  • priority: Major
  • component(s): parameterized-trigger-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

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". sshelomentsev ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.