diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-12-09 09:34:43 -0600 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-12-10 20:46:09 +0100 |
commit | d1fd889554bccbb50122550899dbb66b90b04f78 (patch) | |
tree | 9cad838366292ee79b77ac3513403f7489b06355 /server/sonar-webserver-ws/src | |
parent | f86a1094588e4e47b3abf612891af0431653cd0e (diff) | |
download | sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.tar.gz sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.zip |
Fix code quality issues and reduce dependency on Guava
Diffstat (limited to 'server/sonar-webserver-ws/src')
4 files changed, 7 insertions, 8 deletions
diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java index 07c11840a16..a55a8c2b1dc 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java @@ -20,7 +20,6 @@ package org.sonar.server.ws; import com.google.common.base.Throwables; -import com.google.common.collect.Maps; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -28,6 +27,7 @@ import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; import java.util.Collection; +import java.util.HashMap; import java.util.Map; import javax.annotation.CheckForNull; import org.apache.commons.io.IOUtils; @@ -41,7 +41,7 @@ public class DefaultLocalResponse implements Response, LocalConnector.LocalRespo private final InMemoryStream stream = new InMemoryStream(); private final ByteArrayOutputStream output = new ByteArrayOutputStream(); - private final Map<String, String> headers = Maps.newHashMap(); + private final Map<String, String> headers = new HashMap<>(); @Override public int getStatus() { diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java index 262a8325845..e300f834aca 100644 --- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java +++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java @@ -36,7 +36,7 @@ public class RemovedWebServiceHandlerTest { public ExpectedException expectedException = ExpectedException.none(); @Test - public void throw_server_exception() throws Exception { + public void throw_server_exception() { Request request = mock(Request.class); when(request.getPath()).thenReturn("/api/resources/index"); diff --git a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java index f7d2aeedd80..8ff41e5080a 100644 --- a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java +++ b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java @@ -20,7 +20,6 @@ package org.sonar.server.ws; import com.google.common.base.Throwables; -import com.google.common.collect.Maps; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -28,6 +27,7 @@ import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; import java.util.Collection; +import java.util.HashMap; import java.util.Map; import javax.annotation.CheckForNull; import org.apache.commons.io.IOUtils; @@ -40,7 +40,7 @@ public class DumbResponse implements Response { private final ByteArrayOutputStream output = new ByteArrayOutputStream(); - private Map<String, String> headers = Maps.newHashMap(); + private Map<String, String> headers = new HashMap<>(); public class InMemoryStream implements Response.Stream { private String mediaType; @@ -118,7 +118,7 @@ public class DumbResponse implements Response { } @CheckForNull - public String getHeader(String name){ + public String getHeader(String name) { return headers.get(name); } diff --git a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java index aea0e0d69bd..9992319c361 100644 --- a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java +++ b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java @@ -23,7 +23,6 @@ import com.google.common.base.Throwables; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ListMultimap; -import com.google.common.collect.Maps; import com.google.protobuf.GeneratedMessageV3; import java.io.BufferedReader; import java.io.InputStream; @@ -47,7 +46,7 @@ public class TestRequest extends ValidatingRequest { private final ListMultimap<String, String> multiParams = ArrayListMultimap.create(); private final Map<String, String> params = new HashMap<>(); private final Map<String, String> headers = new HashMap<>(); - private final Map<String, Part> parts = Maps.newHashMap(); + private final Map<String, Part> parts = new HashMap<>(); private String payload = ""; private boolean payloadConsumed = false; private String method = "GET"; |