diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-04-10 17:11:32 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-04-10 17:11:40 +0200 |
commit | 18fbb41d409fa4b58e298de2d30581d8e1f4a3a8 (patch) | |
tree | 8da95c31da78c25c76e8cf2fc3fb60d11ef71dd9 /sonar-server | |
parent | 0714ae86a68f3230d1819ff02f2e26eb31e114fe (diff) | |
download | sonarqube-18fbb41d409fa4b58e298de2d30581d8e1f4a3a8.tar.gz sonarqube-18fbb41d409fa4b58e298de2d30581d8e1f4a3a8.zip |
Fix quality flaws
Diffstat (limited to 'sonar-server')
3 files changed, 17 insertions, 9 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java b/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java index 29293d7e326..ace86157de1 100644 --- a/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java +++ b/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java @@ -53,7 +53,7 @@ public class DefaultRubyComponentService implements RubyComponentService { } @Override - public Component<?> findByKey(String key) { + public Component findByKey(String key) { return resourceDao.findByKey(key); } diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ProfileRuleQuery.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ProfileRuleQuery.java index 4d3c0fc5b98..4080b760b33 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ProfileRuleQuery.java +++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ProfileRuleQuery.java @@ -105,6 +105,19 @@ public class ProfileRuleQuery { result.addTags(optionalVarargs(params.get(PARAM_TAGS))); } + parseInheritance(params, errors, result); + + parseParams(params, errors, result); + + if (!errors.isEmpty()) { + throw BadRequestException.of("Incorrect rule search parameters", errors); + } else { + result.profileId = RubyUtils.toInteger(params.get(PARAM_PROFILE_ID)); + } + return result; + } + + private static void parseInheritance(Map<String, Object> params, List<BadRequestException.Message> errors, ProfileRuleQuery result) { if (params.containsKey(PARAM_INHERITANCE)) { String inheritance = (String) params.get(PARAM_INHERITANCE); validateInheritance(inheritance, errors); @@ -118,7 +131,9 @@ public class ProfileRuleQuery { } else { result.setAnyInheritance(true); } + } + private static void parseParams(Map<String, Object> params, List<BadRequestException.Message> errors, ProfileRuleQuery result) { if (params.get(PARAM_SORT) != null) { String sort = (String) params.get(PARAM_SORT); Boolean asc = RubyUtils.toBoolean(params.get(PARAM_ASC)); @@ -128,13 +143,6 @@ public class ProfileRuleQuery { result.setAsc(asc); } } - - if (!errors.isEmpty()) { - throw BadRequestException.of("Incorrect rule search parameters", errors); - } else { - result.profileId = RubyUtils.toInteger(params.get(PARAM_PROFILE_ID)); - } - return result; } private static void validatePresenceOf(Map<String, Object> params, List<BadRequestException.Message> errors, String... paramNames) { diff --git a/sonar-server/src/main/java/org/sonar/server/user/DoPrivileged.java b/sonar-server/src/main/java/org/sonar/server/user/DoPrivileged.java index 9e323a63919..edae46ab7ae 100644 --- a/sonar-server/src/main/java/org/sonar/server/user/DoPrivileged.java +++ b/sonar-server/src/main/java/org/sonar/server/user/DoPrivileged.java @@ -53,7 +53,7 @@ public final class DoPrivileged { * Define a task that will be executed using the highest privileges available. The privileged section is restricted * to the execution of the {@link #doPrivileged()} method. */ - public static abstract class Task { + public abstract static class Task { /** * Code placed in this method will be executed in a privileged environment. |