diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-03-27 21:26:17 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-03-27 21:26:17 +0200 |
commit | 2b560c35ab24a4f7db27d7e180a64e830b9a56a1 (patch) | |
tree | 59318ddf4d2e78688a7fa2ced83b37f921f6eac8 /sonar-plugin-api | |
parent | 9559e69e14d6123c3e03335e7d9b416cbac5e576 (diff) | |
download | sonarqube-2b560c35ab24a4f7db27d7e180a64e830b9a56a1.tar.gz sonarqube-2b560c35ab24a4f7db27d7e180a64e830b9a56a1.zip |
fix coding violations
Diffstat (limited to 'sonar-plugin-api')
4 files changed, 13 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java index 6462db590d5..808328f877f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java @@ -598,7 +598,7 @@ public class Measure { if (this == o) { return true; } - if (!(o.getClass().equals(Measure.class))) { + if (o == null || getClass() != o.getClass()) { return false; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java index b7702d660e5..4d19a4144ac 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java @@ -19,6 +19,7 @@ */ package org.sonar.api.utils; +import java.lang.ref.Reference; import java.lang.ref.SoftReference; import java.text.*; import java.util.Date; @@ -33,8 +34,8 @@ public final class DateUtils { public static final String DATE_FORMAT = "yyyy-MM-dd"; public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; - private static final DateFormat dateFormat = new ThreadSafeDateFormat(DATE_FORMAT); - private static final DateFormat dateTimeFormat = new ThreadSafeDateFormat(DATETIME_FORMAT); + private static final ThreadSafeDateFormat dateFormat = new ThreadSafeDateFormat(DATE_FORMAT); + private static final ThreadSafeDateFormat dateTimeFormat = new ThreadSafeDateFormat(DATETIME_FORMAT); public static String formatDate(Date d) { return dateFormat.format(d); @@ -69,9 +70,9 @@ public final class DateUtils { this.format = format; } - private final ThreadLocal cache = new ThreadLocal() { + private final transient ThreadLocal cache = new ThreadLocal() { public Object get() { - SoftReference softRef = (SoftReference) super.get(); + Reference softRef = (Reference)super.get(); if (softRef == null || softRef.get() == null) { softRef = new SoftReference(new SimpleDateFormat(format)); super.set(softRef); @@ -81,7 +82,7 @@ public final class DateUtils { }; private DateFormat getDateFormat() { - return (DateFormat) ((SoftReference) cache.get()).get(); + return (DateFormat) ((Reference)cache.get()).get(); } public StringBuffer format(Date date,StringBuffer toAppendTo, FieldPosition fieldPosition) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java index 165152c3537..996bfccd826 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java @@ -29,7 +29,6 @@ import org.apache.commons.lang.math.NumberUtils; import org.slf4j.LoggerFactory; import org.sonar.api.rules.RulePriority; -import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -432,6 +431,9 @@ public final class KeyValueFormat { } + /** + * @deprecated since 2.7 replaced by Converter + */ @Deprecated public interface Transformer<KEY, VALUE> { KeyValue<KEY, VALUE> transform(String key, String value); @@ -439,6 +441,7 @@ public final class KeyValueFormat { /** * Implementation of Transformer<String, Double> + * @deprecated since 2.7 replaced by Converter */ @Deprecated public static class StringNumberPairTransformer implements Transformer<String, Double> { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java index 5f39b6af5a3..f23d458a684 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java @@ -20,7 +20,8 @@ package org.sonar.api.utils.command; public final class CommandException extends RuntimeException { - private Command command; + + private transient Command command = null; public CommandException(Command command, String message, Throwable throwable) { super(message + " [command: " + command + "]", throwable); |