diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-08-02 18:18:07 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-08-02 18:18:07 +0200 |
commit | 1f5682409af97410aca5e545ccbd40b6b037e6a9 (patch) | |
tree | ba9f1fe3c26d994b9aaafe9a09d5cf528fc21a41 /sonar-plugin-api | |
parent | 6e38de82d91aed63e200f0b45f54a4a2a7875941 (diff) | |
download | sonarqube-1f5682409af97410aca5e545ccbd40b6b037e6a9.tar.gz sonarqube-1f5682409af97410aca5e545ccbd40b6b037e6a9.zip |
Fix new violations
Diffstat (limited to 'sonar-plugin-api')
3 files changed, 13 insertions, 13 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java index f6dbdcd9f64..49d1bc892d8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SquidUtils.java @@ -36,7 +36,7 @@ public final class SquidUtils { } String convertedKey = key.replace('/', '.'); - if (convertedKey.indexOf('.') == -1 && !convertedKey.equals("")) { + if (convertedKey.indexOf('.') == -1 && !"".equals(convertedKey)) { convertedKey = "[default]." + convertedKey; } else if (convertedKey.indexOf('.') == -1) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java index 7844a375578..ee5f98f872f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java @@ -104,22 +104,22 @@ public final class AnnotationCheckFactory extends CheckFactory { if (field.getType().equals(String.class)) { field.set(check, value); - } else if (field.getType().getSimpleName().equals("int")) { + } else if ("int".equals(field.getType().getSimpleName())) { field.setInt(check, Integer.parseInt(value)); - } else if (field.getType().getSimpleName().equals("short")) { + } else if ("short".equals(field.getType().getSimpleName())) { field.setShort(check, Short.parseShort(value)); - } else if (field.getType().getSimpleName().equals("long")) { + } else if ("long".equals(field.getType().getSimpleName())) { field.setLong(check, Long.parseLong(value)); - } else if (field.getType().getSimpleName().equals("double")) { + } else if ("double".equals(field.getType().getSimpleName())) { field.setDouble(check, Double.parseDouble(value)); - } else if (field.getType().getSimpleName().equals("boolean")) { + } else if ("boolean".equals(field.getType().getSimpleName())) { field.setBoolean(check, Boolean.parseBoolean(value)); - } else if (field.getType().getSimpleName().equals("byte")) { + } else if ("byte".equals(field.getType().getSimpleName())) { field.setByte(check, Byte.parseByte(value)); } else if (field.getType().equals(Integer.class)) { 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 4a072719622..c41d5a3684f 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 @@ -34,23 +34,23 @@ 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 ThreadSafeDateFormat dateFormat = new ThreadSafeDateFormat(DATE_FORMAT); - private static final ThreadSafeDateFormat dateTimeFormat = new ThreadSafeDateFormat(DATETIME_FORMAT); + private static final ThreadSafeDateFormat THREAD_SAFE_DATE_FORMAT = new ThreadSafeDateFormat(DATE_FORMAT); + private static final ThreadSafeDateFormat THREAD_SAFE_DATETIME_FORMAT = new ThreadSafeDateFormat(DATETIME_FORMAT); private DateUtils() { } public static String formatDate(Date d) { - return dateFormat.format(d); + return THREAD_SAFE_DATE_FORMAT.format(d); } public static String formatDateTime(Date d) { - return dateTimeFormat.format(d); + return THREAD_SAFE_DATETIME_FORMAT.format(d); } public static Date parseDate(String s) { try { - return dateFormat.parse(s); + return THREAD_SAFE_DATE_FORMAT.parse(s); } catch (ParseException e) { throw new SonarException("The date '" + s + "' does not respect format '" + DATE_FORMAT + "'", e); @@ -59,7 +59,7 @@ public final class DateUtils { public static Date parseDateTime(String s) { try { - return dateTimeFormat.parse(s); + return THREAD_SAFE_DATETIME_FORMAT.parse(s); } catch (ParseException e) { throw new SonarException("The date '" + s + "' does not respect format '" + DATETIME_FORMAT + "'", e); |