diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-02-02 11:47:55 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-02-02 11:47:55 +0100 |
commit | 7f280114fc26b402e33fb36cedad1659196cab4b (patch) | |
tree | 13a59e9edd3d3a3f62358048ea8f77bb440c3e4d /sonar-ws-client/src/main/java | |
parent | 8ee22cbabf8142c29b510bc82bfb726b3b215520 (diff) | |
download | sonarqube-7f280114fc26b402e33fb36cedad1659196cab4b.tar.gz sonarqube-7f280114fc26b402e33fb36cedad1659196cab4b.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-ws-client/src/main/java')
3 files changed, 27 insertions, 9 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/internal/HttpRequestFactory.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/internal/HttpRequestFactory.java index e20513ee7f2..525505bcd14 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/internal/HttpRequestFactory.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/internal/HttpRequestFactory.java @@ -23,20 +23,17 @@ import com.github.kevinsawicki.http.HttpRequest; import org.sonar.wsclient.base.HttpException; import javax.annotation.Nullable; - import java.util.Arrays; import java.util.Map; -import static java.net.HttpURLConnection.HTTP_CREATED; -import static java.net.HttpURLConnection.HTTP_NO_CONTENT; -import static java.net.HttpURLConnection.HTTP_OK; +import static java.net.HttpURLConnection.*; /** * Not an API. Please do not use this class, except maybe for unit tests. */ public class HttpRequestFactory { - private final static int[] RESPONSE_SUCCESS = {HTTP_OK, HTTP_CREATED, HTTP_NO_CONTENT}; + private static final int[] RESPONSE_SUCCESS = {HTTP_OK, HTTP_CREATED, HTTP_NO_CONTENT}; private final String baseUrl; private String login, password, proxyHost, proxyLogin, proxyPassword; diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/DefaultRuleTagClient.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/DefaultRuleTagClient.java index 43f9101a9b2..58bbfe72b6c 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/DefaultRuleTagClient.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/DefaultRuleTagClient.java @@ -25,7 +25,7 @@ import org.sonar.wsclient.rule.RuleTagClient; import java.util.Collection; import java.util.HashMap; -import java.util.List; +import java.util.Map; /** * Do not instantiate this class, but use {@link org.sonar.wsclient.SonarClient#ruleTagClient()}. @@ -46,13 +46,12 @@ public class DefaultRuleTagClient implements RuleTagClient { @SuppressWarnings("unchecked") public Collection<String> list() { String json = requestFactory.get(LIST_URL, null); - final List<String> tagList = (List<String>) JSONValue.parse(json); - return tagList; + return (Collection<String>) JSONValue.parse(json); } @Override public void create(String tag) { - final HashMap<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<String, Object>(); params.put("tag", tag); requestFactory.post(CREATE_URL, params); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/package-info.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/package-info.java new file mode 100644 index 00000000000..003389a31b4 --- /dev/null +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/rule/internal/package-info.java @@ -0,0 +1,22 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault package org.sonar.wsclient.rule.internal; + +import javax.annotation.ParametersAreNonnullByDefault; |