From d4cee632835a462da2dc6794b059fb0d6b1c9bc2 Mon Sep 17 00:00:00 2001 From: Oliver Burn Date: Tue, 25 Mar 2003 10:55:47 +0000 Subject: [PATCH] Small refactor to improve all test failures. Probably defining the default severity level in the SeverityLevel class is not the best thing to do - but I could not think of an other obvious place. --- src/checkstyle/com/puppycrawl/tools/checkstyle/api/Check.java | 2 +- .../com/puppycrawl/tools/checkstyle/api/LocalizedMessage.java | 4 +--- .../com/puppycrawl/tools/checkstyle/api/SeverityLevel.java | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Check.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Check.java index d3b5f7d95..f7c7f8fe3 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Check.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/Check.java @@ -48,7 +48,7 @@ public abstract class Check extends AutomaticBean private int mTabWidth = 8; // meaningful default /** the severity level of any violations found */ - private SeverityLevel mSeverityLevel = SeverityLevel.ERROR; + private SeverityLevel mSeverityLevel = SeverityLevel.DEFAULT_LEVEL; /** current class loader */ private ClassLoader mLoader = diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/LocalizedMessage.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/LocalizedMessage.java index f5eb2a495..f287fdbf2 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/LocalizedMessage.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/LocalizedMessage.java @@ -55,8 +55,6 @@ public final class LocalizedMessage /** the severity level **/ private final SeverityLevel mSeverityLevel; - /** the default severity level if one is not specified */ - private static final SeverityLevel DEFAULT_SEVERITY = SeverityLevel.WARNING; /** key for the message format **/ private final String mKey; @@ -129,7 +127,7 @@ public final class LocalizedMessage mKey = aKey; mArgs = aArgs; mBundle = aBundle; - mSeverityLevel = DEFAULT_SEVERITY; + mSeverityLevel = SeverityLevel.DEFAULT_LEVEL; } /** diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java index c87d5e8f7..1ed6e97b7 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java @@ -67,6 +67,9 @@ public final class SeverityLevel implements Comparable, Serializable public static final SeverityLevel ERROR = new SeverityLevel(SEVERITYCODE_ERROR, SEVERITYNAME_ERROR); + /** the default severity */ + public static final SeverityLevel DEFAULT_LEVEL = ERROR; + /** map from level names to the respective level */ private static final Map NAME_TO_LEVEL = new HashMap(); static {