Skip to content

Commit

Permalink
[INFRA-100] - Do not rename components to existing names
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed Jun 29, 2014
1 parent 1ab8354 commit 19bf9d9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/jenkinsci/jira_scraper/JiraScraper.java
Expand Up @@ -65,6 +65,18 @@ public void renameComponent(String projectKey, String oldName, String newName)
BasicComponent c = getBasicComponent(projectKey, oldName);
Component comp = getComponent(c);

// Check the existance of the new component
BasicComponent newComponent = null;
try {
newComponent = getBasicComponent(projectKey, newName);
} catch (IOException cannotFindTheComponent) {
// All is OK
}
if (newComponent != null) {
throw new IOException("Unable to rename component " + oldName +
". Component " + newName + " already exists");
}

AssigneeInfo info = comp.getAssigneeInfo();
AssigneeType assigneeType = info != null ? info.getAssigneeType() : null;
BasicUser leadUser = info != null ? info.getAssignee() : null;
Expand Down

0 comments on commit 19bf9d9

Please sign in to comment.