Skip to content

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

Closed

Description

@jenkins-infra-bot

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.


Originally reported by rjgodoy, imported from: Unable to delete project with trailing whitespace in name
  • assignee: csimons
  • status: Resolved
  • priority: Minor
  • component(s): core
  • label(s): exception, jenkins
  • resolution: Fixed
  • resolved: 2015-10-06T12:29:19+00:00
  • votes: 0
  • watchers: 4
  • imported: 2025-11-24
Raw content of original issue

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.

  • environment: Jenkins ver. 1.629 / Windows 7 (64 bits) / JRE 1.7.0_45-b18 (64 bits)
1 attachment

Activity

  1. jenkins-infra-bot commented on Oct 5, 2015

    @jenkins-infra-bot
    Author
    csimons:
    • Original comment link
    • Raw content of original comment:

      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.

    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.

  2. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original 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: 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.

  3. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    scm_issue_link:

    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: a0eb564...67879ab

  4. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    scm_issue_link:

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

  5. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    dogfood:

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

    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
  6. jenkins-infra-bot commented on Nov 24, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-19203]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions