Skip to content

Commit

Permalink
Merge pull request #92 from jglick/ISE-JENKINS-42511
Browse files Browse the repository at this point in the history
[JENKINS-42511] Make sure we do not attempt to create the same branch project twice
  • Loading branch information
stephenc committed Mar 8, 2017
2 parents 5f30c4e + c79800d commit 509a08c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/jenkins/branch/MultiBranchProject.java
Expand Up @@ -2043,8 +2043,11 @@ public void observe(@NonNull SCMHead head, @NonNull SCMRevision revision) {
return;
}
try (ChildNameGenerator.Trace trace = ChildNameGenerator.beforeCreateItem(
MultiBranchProject.this, branch.getEncodedName(), branch.getName()
MultiBranchProject.this, encodedName, branch.getName()
)){
if (getItem(encodedName) != null) {
throw new IllegalStateException("JENKINS-42511: attempted to redundantly create " + encodedName + " in " + MultiBranchProject.this);
}
project = _factory.newInstance(branch);
}
if (!project.getName().equals(encodedName)) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/jenkins/branch/OrganizationFolder.java
Expand Up @@ -1314,6 +1314,9 @@ public void complete() throws IllegalStateException, IOException, InterruptedExc
try (ChildNameGenerator.Trace trace = ChildNameGenerator.beforeCreateItem(
OrganizationFolder.this, folderName, projectName
)) {
if (getItem(folderName) != null) {
throw new IllegalStateException("JENKINS-42511: attempted to redundantly create " + folderName + " in " + OrganizationFolder.this);
}
project = factory.createNewProject(
OrganizationFolder.this, folderName, sources, attributes, listener
);
Expand Down

0 comments on commit 509a08c

Please sign in to comment.