diff options
author | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-04-28 13:54:16 +0200 |
---|---|---|
committer | Stephane Gamard <stephane.gamard@searchbox.com> | 2014-04-28 13:54:16 +0200 |
commit | bc42bb8486fccd4a541ffb9b23b02bee4da2de14 (patch) | |
tree | 10004a0d37e7cdee1d4ea38138f86fc5d5f84e0c | |
parent | 9837210b8a7286a842407fe94848460ea5ac56cf (diff) | |
parent | adab7517ae4c4cfa293b5720b66fd7b5ec4e026b (diff) | |
download | sonarqube-bc42bb8486fccd4a541ffb9b23b02bee4da2de14.tar.gz sonarqube-bc42bb8486fccd4a541ffb9b23b02bee4da2de14.zip |
Merge branch 'master' of https://github.com/SonarSource/sonarqube
# By Julien Lancelot
# Via Julien Lancelot
* 'master' of https://github.com/SonarSource/sonarqube:
Fix quality flaws
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java | 3 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileValidations.java | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java index b5b00e3b619..f5d9beb7adc 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java +++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActiveRuleOperations.java @@ -111,8 +111,7 @@ public class QProfileActiveRuleOperations implements ServerComponent { ActiveRuleDto createActiveRule(int profileId, RuleKey ruleKey, String severity, SqlSession session) { RuleDto rule = ruleDao.selectByKey(ruleKey, session); - QProfileValidations.checkRuleIsNotNull(rule); - return createActiveRule(profileId, rule.getId(), severity, session); + return createActiveRule(profileId, QProfileValidations.checkRuleIsNotNull(rule).getId(), severity, session); } private ActiveRuleDto createActiveRule(int profileId, int ruleId, String severity, SqlSession session) { diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileValidations.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileValidations.java index 255ead1ddb8..8d76ca8e000 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileValidations.java +++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileValidations.java @@ -33,21 +33,24 @@ public class QProfileValidations { // Only static methods } - public static void checkProfileIsNotNull(@Nullable QualityProfileDto profile) { + public static QualityProfileDto checkProfileIsNotNull(@Nullable QualityProfileDto profile) { if (profile == null) { throw new NotFoundException("This quality profile does not exists."); } + return profile; } - public static void checkRuleIsNotNull(@Nullable RuleDto rule) { + public static RuleDto checkRuleIsNotNull(@Nullable RuleDto rule) { if (rule == null) { throw new NotFoundException("This rule does not exists."); } + return rule; } - public static void checkActiveRuleIsNotNull(@Nullable ActiveRuleDto activeRule) { + public static ActiveRuleDto checkActiveRuleIsNotNull(@Nullable ActiveRuleDto activeRule) { if (activeRule == null) { throw new NotFoundException("This active rule does not exists."); } + return activeRule; } } |