diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-03-27 23:43:19 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-03-27 23:43:19 +0200 |
commit | d4ae5228bb668e65baa644b52d41286d5f3d55cd (patch) | |
tree | 8b3f18401fade28db31c1b9364e2f4ebad2b017d /sonar-plugin-api | |
parent | 2b560c35ab24a4f7db27d7e180a64e830b9a56a1 (diff) | |
download | sonarqube-d4ae5228bb668e65baa644b52d41286d5f3d55cd.tar.gz sonarqube-d4ae5228bb668e65baa644b52d41286d5f3d55cd.zip |
Fix coding violations
Diffstat (limited to 'sonar-plugin-api')
10 files changed, 24 insertions, 13 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java index 2567b0c79ca..92bd5fa8132 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java @@ -29,6 +29,7 @@ import org.sonar.api.resources.Project; * @since 1.10 * @deprecated since 2.6 was superseded by interface {@link CoverageExtension} */ +@Deprecated public abstract class AbstractCoverageExtension implements CoverageExtension { /** diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java index 872e6f7f027..8f09a59e68f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java @@ -194,7 +194,7 @@ public interface SensorContext { * if the source has already been set on this resource * @since 1.10. Returns a boolean since 2.6. */ - void saveSource(Resource reference, String source) throws DuplicatedSourceException; + void saveSource(Resource reference, String source); // ----------- LINKS -------------- 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 017ab98ac34..7844a375578 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 @@ -138,7 +138,7 @@ public final class AnnotationCheckFactory extends CheckFactory { throw new SonarException("The type of the field " + field + " is not supported: " + field.getType()); } } catch (IllegalAccessException e) { - throw new SonarException("Can not set the value of the field " + field + " in the class: " + check.getClass().getName()); + throw new SonarException("Can not set the value of the field " + field + " in the class: " + check.getClass().getName(), e); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java index adc29ed1ddf..2afffb5e307 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java @@ -20,7 +20,6 @@ package org.sonar.api.database.model; import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.sonar.api.database.DatabaseSession; import org.sonar.api.measures.Metric; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index ec6c75f5af1..33c3f4b4680 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -365,6 +365,9 @@ public final class CoreMetrics { .setBestValue(100.0) .create(); + /** + * @deprecated since 2.7. Replaced by COVERED_CONDITIONS_BY_LINE_KEY and COVERED_CONDITIONS_BY_LINE_KEY + */ @Deprecated public static final String BRANCH_COVERAGE_HITS_DATA_KEY = "branch_coverage_hits_data"; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java index 4fc69f2332e..70501b4afdd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java @@ -31,11 +31,16 @@ public final class Iso9126RulesCategories { private Iso9126RulesCategories() { } - public static final RulesCategory RELIABILITY = new RulesCategory("Reliability", "The extent to which the project can be expected to perform its intended function with rescission. Some examples : are loop indexes range tested? Is input data checked for range errors ? Is divide-by-zero avoided ? Is exception handling provided ?"); - public static final RulesCategory EFFICIENCY = new RulesCategory("Efficiency", "The extent to which the project fulfills its purpose without waste of resources. This means resources in the sense of memory utilisation and processor speed."); - public static final RulesCategory PORTABILITY = new RulesCategory("Portability", "The extent to which the project can be operated easily and well on multiple computer configurations. Portability can mean both between different hardware setups and between different operating systems -- such as running on both Mac OS X and GNU/Linux."); - public static final RulesCategory USABILITY = new RulesCategory("Usability", "The extent to which the project can be understood, learned, operated, attractive and compliant with usability regulations and guidelines. It commonly relies on naming conventions and formatting rules."); - public static final RulesCategory MAINTAINABILITY = new RulesCategory("Maintainability", "The extent to which the project facilitates updating to satisfy new requirements. Thus the the project which is maintainable should be not complex."); + public static final RulesCategory RELIABILITY = new RulesCategory("Reliability", + "The extent to which the project can be expected to perform its intended function with rescission. Some examples : are loop indexes range tested? Is input data checked for range errors ? Is divide-by-zero avoided ? Is exception handling provided ?"); + public static final RulesCategory EFFICIENCY = new RulesCategory("Efficiency", + "The extent to which the project fulfills its purpose without waste of resources. This means resources in the sense of memory utilisation and processor speed."); + public static final RulesCategory PORTABILITY = new RulesCategory("Portability", + "The extent to which the project can be operated easily and well on multiple computer configurations. Portability can mean both between different hardware setups and between different operating systems -- such as running on both Mac OS X and GNU/Linux."); + public static final RulesCategory USABILITY = new RulesCategory("Usability", + "The extent to which the project can be understood, learned, operated, attractive and compliant with usability regulations and guidelines. It commonly relies on naming conventions and formatting rules."); + public static final RulesCategory MAINTAINABILITY = new RulesCategory("Maintainability", + "The extent to which the project facilitates updating to satisfy new requirements. Thus the the project which is maintainable should be not complex."); public static final List<RulesCategory> ALL = Collections.unmodifiableList(Arrays.asList(RELIABILITY, EFFICIENCY, PORTABILITY, USABILITY, MAINTAINABILITY)); } 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 4d19a4144ac..d3b431ae076 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 @@ -50,7 +50,7 @@ public final class DateUtils { return dateFormat.parse(s); } catch (ParseException e) { - throw new SonarException("The date '" + s + "' does not respect format '" + DATE_FORMAT + "'"); + throw new SonarException("The date '" + s + "' does not respect format '" + DATE_FORMAT + "'", e); } } @@ -59,7 +59,7 @@ public final class DateUtils { return dateTimeFormat.parse(s); } catch (ParseException e) { - throw new SonarException("The date '" + s + "' does not respect format '" + DATETIME_FORMAT + "'"); + throw new SonarException("The date '" + s + "' does not respect format '" + DATETIME_FORMAT + "'", e); } } 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 996bfccd826..6b4ff0f7293 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 @@ -432,7 +432,7 @@ public final class KeyValueFormat { /** - * @deprecated since 2.7 replaced by Converter + * @deprecated since 2.7. Replaced by Converter */ @Deprecated public interface Transformer<KEY, VALUE> { @@ -452,6 +452,7 @@ public final class KeyValueFormat { /** * Implementation of Transformer<Double, Double> + * @deprecated since 2.7. Replaced by Converter */ @Deprecated public static class DoubleNumbersPairTransformer implements Transformer<Double, Double> { @@ -462,6 +463,7 @@ public final class KeyValueFormat { /** * Implementation of Transformer<Integer, Integer> + * @deprecated since 2.7. Replaced by Converter */ @Deprecated public static class IntegerNumbersPairTransformer implements Transformer<Integer, Integer> { @@ -473,6 +475,7 @@ public final class KeyValueFormat { /** * Implementation of Transformer<RulePriority, Integer> + * @deprecated since 2.7. Replaced by Converter */ @Deprecated public static class RulePriorityNumbersPairTransformer implements Transformer<RulePriority, Integer> { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ServerHttpClient.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ServerHttpClient.java index 50f1933ca52..6f174980bb9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ServerHttpClient.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ServerHttpClient.java @@ -96,7 +96,7 @@ public class ServerHttpClient implements BatchComponent { protected String executeAction(String action) { String result = getRemoteContent(url + action); - if (result.trim().length() == 0) { + if (StringUtils.isBlank(result)) { throw new ServerApiEmptyContentException("Empty " + action + " returned from server"); } return result; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java index a4d107347a5..413aa9c1758 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java @@ -157,7 +157,7 @@ public final class ZipUtils { } } - public static interface ZipEntryFilter { + private static interface ZipEntryFilter { boolean accept(ZipEntry entry); } |