From 9b57d0b379935e053ef050b0379c65fc32810bc1 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 4 Feb 2011 13:43:03 +0100 Subject: [PATCH] Fix bug on deprecated profiles --- .../src/main/java/org/sonar/api/rules/ActiveRule.java | 2 +- .../main/java/org/sonar/server/rules/DeprecatedProfiles.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java index 2da2c6c2352..b773d4076ec 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java @@ -288,6 +288,6 @@ public class ActiveRule implements Cloneable { * @since 2.6 */ public boolean isEnabled() { - return getRule().isEnabled(); + return getRule()!=null && getRule().isEnabled(); } } diff --git a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java index 40ed1877b07..7d61dc8ccb8 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java @@ -103,7 +103,7 @@ public final class DeprecatedProfiles { for (int index = 0; index < repository.getProvidedProfiles().size(); index++) { RulesProfile deprecated = (RulesProfile) repository.getProvidedProfiles().get(index); DefaultProfileDefinition providedProfile = DefaultProfileDefinition.create(deprecated.getName(), repository.getLanguage().getKey()); - for (ActiveRule deprecatedActiveRule : deprecated.getActiveRules()) { + for (ActiveRule deprecatedActiveRule : deprecated.getActiveRules(true)) { String repositoryKey = deprecatedActiveRule.getRepositoryKey(); if (StringUtils.isBlank(repositoryKey)) { repositoryKey = getPluginKey(repository); @@ -161,7 +161,7 @@ public final class DeprecatedProfiles { } public List getRules() { - return profile.getActiveRules(); + return profile.getActiveRules(true); } public List getRulesByRepositoryKey(String repositoryKey) { -- 2.39.5