From f279ef14ceb725c98e1e070515fd31bb81d3ba9e Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 3 Jun 2013 00:33:31 +0200 Subject: [PATCH] Fix quality flaw --- .../src/main/java/org/sonar/server/issue/IssueService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java b/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java index 19b403631f3..ee8e177b9f1 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java @@ -171,7 +171,11 @@ public class IssueService implements ServerComponent { public IssueQueryResult loadIssue(String issueKey) { IssueQuery query = IssueQuery.builder().issueKeys(Arrays.asList(issueKey)).requiredRole(UserRole.USER).build(); - return finder.find(query); + IssueQueryResult result = finder.find(query); + if (result.issues().size()!=1) { + throw new IllegalStateException("Issue not found: " + issueKey); + } + return result; } public List listStatus() { -- 2.39.5