From 12962e9254d4369937fb92281502531851179ae8 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 28 May 2013 16:35:18 +0200 Subject: [PATCH] SONAR-4304 fix closing of manual issues --- .../core/issue/IssueTrackingDecorator.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java index 869e1f8a458..6bfa194f968 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java @@ -165,20 +165,21 @@ public class IssueTrackingDecorator implements Decorator { private void addUnmatched(Collection unmatchedIssues, Collection issues) { for (IssueDto unmatchedDto : unmatchedIssues) { DefaultIssue unmatched = unmatchedDto.toDefaultIssue(); - boolean manualIssue = !Strings.isNullOrEmpty(unmatched.reporter()); - Rule rule = ruleFinder.findByKey(RuleKey.of(unmatchedDto.getRuleRepo(), unmatchedDto.getRule())); + unmatched.setNew(false); - boolean onDisabledRule = (rule == null || Rule.STATUS_REMOVED.equals(rule.getStatus())); + boolean manualIssue = !Strings.isNullOrEmpty(unmatched.reporter()); + Rule rule = ruleFinder.findByKey(unmatched.ruleKey()); if (manualIssue) { // Manual rules are not declared in Quality profiles, so no need to check ActiveRule + boolean onDisabledRule = (rule == null || Rule.STATUS_REMOVED.equals(rule.getStatus())); unmatched.setEndOfLife(onDisabledRule); + unmatched.setOnDisabledRule(onDisabledRule); } else { - ActiveRule activeRule = rulesProfile.getActiveRule(unmatchedDto.getRuleRepo(), unmatchedDto.getRule()); - onDisabledRule &= (activeRule == null); + ActiveRule activeRule = rulesProfile.getActiveRule(unmatched.ruleKey().repository(), unmatched.ruleKey().rule()); unmatched.setEndOfLife(true); + unmatched.setOnDisabledRule(activeRule == null || rule == null || Rule.STATUS_REMOVED.equals(rule.getStatus())); } - unmatched.setNew(false); - unmatched.setOnDisabledRule(onDisabledRule); + issues.add(unmatched); } } -- 2.39.5