aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-05-04 16:27:41 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-05-04 16:27:49 +0200
commit1d3bedbab5cc4c5051db2b1781d43d1a7b68395f (patch)
treedd5eab2355a035fb0621e4ad3c0a571872ed4ebc
parent76bed236592c538acd248009af0a0126b47354fb (diff)
downloadsonarqube-1d3bedbab5cc4c5051db2b1781d43d1a7b68395f.tar.gz
sonarqube-1d3bedbab5cc4c5051db2b1781d43d1a7b68395f.zip
SONAR-2301 ClassComplexityCheck NullPointerException
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java6
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java6
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java6
3 files changed, 12 insertions, 6 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
index faa95c72a7a..1f360273b95 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
@@ -39,8 +39,10 @@ import org.sonar.squid.measures.Metric;
+ "and which should be re-factored to be split in several classes.</p>")
public class ClassComplexityCheck extends SquidCheck {
- @RuleProperty(description = "Maximum complexity allowed.", defaultValue = "200")
- private Integer max;
+ public static final int DEFAULT_MAX = 200;
+
+ @RuleProperty(description = "Maximum complexity allowed.", defaultValue = "" + DEFAULT_MAX)
+ private Integer max = DEFAULT_MAX;
@Override
public void visitClass(SourceClass sourceClass) {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
index b9b13f76f26..9599cd0453b 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
@@ -37,8 +37,10 @@ import org.sonar.squid.measures.Metric;
+ "'inheritance' when 'composition' would suit better.</p>")
public class DITCheck extends SquidCheck {
- @RuleProperty(description = "Maximum depth of the inheritance tree.", defaultValue = "5")
- private Integer max;
+ public static final int DEFAULT_MAX = 5;
+
+ @RuleProperty(description = "Maximum depth of the inheritance tree.", defaultValue = "" + DEFAULT_MAX)
+ private Integer max = DEFAULT_MAX;
@Override
public void visitClass(SourceClass sourceClass) {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
index 186e859f38f..0cbeb094367 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
@@ -39,8 +39,10 @@ import org.sonar.squid.measures.Metric;
+ "so the risk of regression increases exponentially.</p>")
public class MethodComplexityCheck extends SquidCheck {
- @RuleProperty(description = "Maximum complexity allowed.", defaultValue = "10")
- private Integer max;
+ public static final int DEFAULT_MAX = 10;
+
+ @RuleProperty(description = "Maximum complexity allowed.", defaultValue = "" + DEFAULT_MAX)
+ private Integer max = DEFAULT_MAX;
@Override
public void visitMethod(SourceMethod sourceMethod) {