From 89ce85dfc88b21cdb7a8bc95d89b24259b987d19 Mon Sep 17 00:00:00 2001 From: Christopher Simons Date: Wed, 7 Oct 2015 08:55:17 -0400 Subject: [PATCH] [FIXED JENKINS-30502] trim job name upon rename If a job is renamed to a string with trailing whitespace, exceptions are thrown as the application attempts to rename the job directory in the file system, and the job can be neither deleted nor renamed again through the UI. This problem occurs only when renaming a job, and not when initially creating a job, because job names are trimmed when first created. This change trims the job name for rename operations as well, so that the name-setting behavior is consistent across create/update operations and inadvertent leading/trailing whitespace is removed before it can cause problems. --- core/src/main/java/hudson/model/Job.java | 12 ++- test/src/test/java/hudson/model/JobTest.java | 89 +++++++++++++++++++- 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java index 85d440f25a..5e7d56183a 100644 --- a/core/src/main/java/hudson/model/Job.java +++ b/core/src/main/java/hudson/model/Job.java @@ -1210,7 +1210,8 @@ public abstract class Job, RunT extends Run, RunT extends Run