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

Unable to delete project with trailing whitespace in name

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Jenkins ver. 1.629 / Windows 7 (64 bits) / JRE 1.7.0_45-b18 (64 bits)

      I renamed a (maven) project in Jenkins and the new name ended in a whitespace: "name ".
      A directory "name" (*without *the trailing whitespace) was created under jenkins jobs directory.

      Now the project cannot be deleted because Jenkins fails with the following message:
      Trailing char < > at index 51: C:\Program Files (x86)\Jenkins\jobs\aaaaaaaaaaaaaaa _

      Exception trace attached.

          [JENKINS-30502] Unable to delete project with trailing whitespace in name

          Christopher Simons added a comment - - edited

          I've verified that once a job is renamed to a string with a trailing space, it can be neither deleted nor renamed again (through the UI). Part of the problem is that the initial rename (to a string with a trailing space) fails to rename the job directory.

          This problem occurs only when renaming a job, and not when initially creating a job, because job names are trimmed when first created. It seems a sensible solution would be simply to trim the given job 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.

          Fixed in PR #1855.

          Christopher Simons added a comment - - edited I've verified that once a job is renamed to a string with a trailing space, it can be neither deleted nor renamed again (through the UI). Part of the problem is that the initial rename (to a string with a trailing space) fails to rename the job directory. This problem occurs only when renaming a job, and not when initially creating a job, because job names are trimmed when first created. It seems a sensible solution would be simply to trim the given job 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. Fixed in PR #1855 .

          Code changed in jenkins
          User: Christopher Simons
          Path:
          core/src/main/java/hudson/model/Job.java
          test/src/test/java/hudson/model/JobTest.java
          http://jenkins-ci.org/commit/jenkins/89ce85dfc88b21cdb7a8bc95d89b24259b987d19
          Log:
          [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.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Simons Path: core/src/main/java/hudson/model/Job.java test/src/test/java/hudson/model/JobTest.java http://jenkins-ci.org/commit/jenkins/89ce85dfc88b21cdb7a8bc95d89b24259b987d19 Log: [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.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/Job.java
          test/src/test/java/hudson/model/JobTest.java
          http://jenkins-ci.org/commit/jenkins/67879ab2327f0a3fd4015f5f9ff53cf0a5b7ef08
          Log:
          Merge pull request #1855 from csimons/fix-rename-trailing-whitespace

          [FIXED JENKINS-30502] trim job name upon rename

          Compare: https://github.com/jenkinsci/jenkins/compare/a0eb564cf930...67879ab2327f

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/Job.java test/src/test/java/hudson/model/JobTest.java http://jenkins-ci.org/commit/jenkins/67879ab2327f0a3fd4015f5f9ff53cf0a5b7ef08 Log: Merge pull request #1855 from csimons/fix-rename-trailing-whitespace [FIXED JENKINS-30502] trim job name upon rename Compare: https://github.com/jenkinsci/jenkins/compare/a0eb564cf930...67879ab2327f

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/3bc0f447efd5b5abca466881949106f19c8b9ebf
          Log:
          Noting JENKINS-30502 from #1855

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: changelog.html http://jenkins-ci.org/commit/jenkins/3bc0f447efd5b5abca466881949106f19c8b9ebf Log: Noting JENKINS-30502 from #1855

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4328
          [FIXED JENKINS-30502] trim job name upon rename (Revision 89ce85dfc88b21cdb7a8bc95d89b24259b987d19)
          Noting JENKINS-30502 from #1855 (Revision 3bc0f447efd5b5abca466881949106f19c8b9ebf)

          Result = SUCCESS
          christopherleesimons : 89ce85dfc88b21cdb7a8bc95d89b24259b987d19
          Files :

          • test/src/test/java/hudson/model/JobTest.java
          • core/src/main/java/hudson/model/Job.java

          o.v.nenashev : 3bc0f447efd5b5abca466881949106f19c8b9ebf
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #4328 [FIXED JENKINS-30502] trim job name upon rename (Revision 89ce85dfc88b21cdb7a8bc95d89b24259b987d19) Noting JENKINS-30502 from #1855 (Revision 3bc0f447efd5b5abca466881949106f19c8b9ebf) Result = SUCCESS christopherleesimons : 89ce85dfc88b21cdb7a8bc95d89b24259b987d19 Files : test/src/test/java/hudson/model/JobTest.java core/src/main/java/hudson/model/Job.java o.v.nenashev : 3bc0f447efd5b5abca466881949106f19c8b9ebf Files : changelog.html

            csimons Christopher Simons
            rjgodoy Javier Godoy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: