From 70e645356d78d7b90f63bad4f40a343562d84d07 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 10 Feb 2011 00:08:27 +0100 Subject: [PATCH] Fix some violations --- .../java/org/sonar/plugins/clover/XmlReportParser.java | 2 +- .../org/sonar/plugins/surefire/TestSuiteParser.java | 2 +- .../src/main/java/org/sonar/channel/CodeReader.java | 4 ++-- .../org/sonar/api/checks/AnnotationCheckFactory.java | 8 ++++---- .../sonar/api/measures/RangeDistributionBuilder.java | 2 +- .../org/sonar/api/resources/ProjectFileSystem.java | 10 ++++++---- .../src/main/java/org/sonar/server/ui/JRubyFacade.java | 4 ---- .../org/sonar/wsclient/services/ResourceQuery.java | 3 +++ 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/plugins/sonar-clover-plugin/src/main/java/org/sonar/plugins/clover/XmlReportParser.java b/plugins/sonar-clover-plugin/src/main/java/org/sonar/plugins/clover/XmlReportParser.java index 0e3ad76dd83..c9d47cca0ff 100644 --- a/plugins/sonar-clover-plugin/src/main/java/org/sonar/plugins/clover/XmlReportParser.java +++ b/plugins/sonar-clover-plugin/src/main/java/org/sonar/plugins/clover/XmlReportParser.java @@ -188,8 +188,8 @@ public class XmlReportParser { } private boolean canBeIncludedInFileMetrics(SMInputCursor metricsCursor) throws ParseException, XMLStreamException { - // skip class elements on 1.x xml format while (metricsCursor.getNext() != null && metricsCursor.getLocalName().equals("class")) { + // skip class elements on 1.x xml format } return ParsingUtils.parseNumber(metricsCursor.getAttrValue("elements")) > 0; } diff --git a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/TestSuiteParser.java b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/TestSuiteParser.java index 3e8e326300c..d701a7407fb 100644 --- a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/TestSuiteParser.java +++ b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/TestSuiteParser.java @@ -119,8 +119,8 @@ public class TestSuiteParser implements XmlStreamHandler { setStackAndMessage(detail, childNode); } } - // make sure we loop till the end of the elements cursor while (childNode.getNext() != null) { + // make sure we loop till the end of the elements cursor } detail.setTimeMS(time.intValue()); detail.setStatus(status); diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java index 2c93f35fc0b..8cb36a94d72 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReader.java @@ -125,7 +125,7 @@ public class CodeReader extends CodeBuffer { } /** - * @see peekTo(EndMatcher matcher, Appendable appendable) + * @deprecated use peekTo(EndMatcher matcher, Appendable appendable) */ @Deprecated public final String peekTo(EndMatcher matcher) { @@ -135,7 +135,7 @@ public class CodeReader extends CodeBuffer { } /** - * @see popTo(Matcher matcher, Appendable appendable) + * @deprecated use popTo(Matcher matcher, Appendable appendable) */ @Deprecated public final void popTo(EndMatcher matcher, Appendable appendable) { 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 c7cabc3751c..017ab98ac34 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 @@ -123,16 +123,16 @@ public final class AnnotationCheckFactory extends CheckFactory { field.setByte(check, Byte.parseByte(value)); } else if (field.getType().equals(Integer.class)) { - field.set(check, new Integer(Integer.parseInt(value))); + field.set(check, Integer.parseInt(value)); } else if (field.getType().equals(Long.class)) { - field.set(check, new Long(Long.parseLong(value))); + field.set(check, Long.parseLong(value)); } else if (field.getType().equals(Double.class)) { - field.set(check, new Double(Double.parseDouble(value))); + field.set(check, Double.parseDouble(value)); } else if (field.getType().equals(Boolean.class)) { - field.set(check, Boolean.valueOf(Boolean.parseBoolean(value))); + field.set(check, Boolean.parseBoolean(value)); } else { throw new SonarException("The type of the field " + field + " is not supported: " + field.getType()); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java index 93bbe04e9e5..953f2cad00b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java @@ -77,7 +77,7 @@ public class RangeDistributionBuilder implements MeasureBuilder { } if (onlyInts) { for (int i=0 ; i mainFiles(String... langs); /** - * TODO comment me + * Source files of unit tests. Exclusion patterns are not applied. * * @param langs language filter. If null or empty, will return empty list * @since 2.6 diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index 309694c2466..06675cd00c8 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -234,10 +234,6 @@ public final class JRubyFacade implements ServerComponent { getAsyncMeasuresService().deleteMeasure(asyncMeasureId); } - private DefaultRulesManager getRulesManager() { - return getContainer().getComponent(DefaultRulesManager.class); - } - private ProfilesManager getProfilesManager() { return getContainer().getComponent(ProfilesManager.class); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java index b8f0b319356..608542513f4 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ResourceQuery.java @@ -141,6 +141,7 @@ public class ResourceQuery extends Query { * @param ruleCategories values: Maintainability, Usability, Reliability, Efficiency, Portability * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 */ + @Deprecated public ResourceQuery setRuleCategories(String... ruleCategories) { return this; } @@ -190,6 +191,7 @@ public class ResourceQuery extends Query { /** * @deprecated since 2.5 not used anymore */ + @Deprecated public boolean isExcludeRuleCategories() { return false; } @@ -197,6 +199,7 @@ public class ResourceQuery extends Query { /** * @deprecated since 2.5 not used anymore */ + @Deprecated public ResourceQuery setExcludeRuleCategories(boolean b) { return this; } -- 2.39.5