Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-41124] Findbugs catches a bug
  • Loading branch information
stephenc committed Jan 18, 2017
1 parent 89d7ade commit 76db05c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/jenkins/branch/OrganizationFolder.java
Expand Up @@ -1133,7 +1133,8 @@ public void complete() throws IllegalStateException, InterruptedException {
if (factory == null) {
return;
}
MultiBranchProject<?, ?> existing = observer.shouldUpdate(projectName);
String folderName = NameEncoder.encode(projectName);
MultiBranchProject<?, ?> existing = observer.shouldUpdate(folderName);
if (existing != null) {
BulkChange bc = new BulkChange(existing);
try {
Expand All @@ -1154,16 +1155,16 @@ public void complete() throws IllegalStateException, InterruptedException {
existing.scheduleBuild();
return;
}
if (!observer.mayCreate(projectName)) {
listener.getLogger().println("Ignoring duplicate child " + projectName);
if (!observer.mayCreate(folderName)) {
listener.getLogger().println("Ignoring duplicate child " + projectName + " named " + folderName);
return;
}
MultiBranchProject<?, ?> project = factory.createNewProject(
OrganizationFolder.this, projectName, sources, attributes, listener
OrganizationFolder.this, folderName, sources, attributes, listener
);
BulkChange bc = new BulkChange(project);
try {
if (!projectName.equals(projectName)) {
if (!projectName.equals(folderName)) {
project.setDisplayName(projectName);
}
project.addProperty(new ProjectNameProperty(projectName));
Expand Down

0 comments on commit 76db05c

Please sign in to comment.