aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-06-13 18:00:07 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-06-13 18:00:56 +0200
commit19cb14ea03ce36545b2e288269a30f0fdd82d402 (patch)
tree903bd708fea27e15b9b86a0a22d661a2a0327d6a /sonar-ws-client
parent27576858612f0d5a141ce71b2862ff6c906dabfb (diff)
downloadsonarqube-19cb14ea03ce36545b2e288269a30f0fdd82d402.tar.gz
sonarqube-19cb14ea03ce36545b2e288269a30f0fdd82d402.zip
Fix some quality flaws
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/internal/HttpRequestFactory.java5
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java6
2 files changed, 5 insertions, 6 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 e454a585448..e8cd100597a 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
@@ -135,11 +135,8 @@ public class HttpRequestFactory {
// TODO handle error messages
throw new HttpException(request.url().toString(), request.code());
- } catch (HttpException e) {
- throw e;
-
} catch (HttpRequest.HttpRequestException e) {
- throw new IllegalStateException(e.getCause());
+ throw new IllegalStateException("Fail to request " + request.url(), e.getCause());
}
}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java
index 9969090a1ee..41100306f7d 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java
@@ -58,7 +58,9 @@ public class HttpRequestFactoryTest {
fail();
} catch (Exception e) {
assertThat(e).isInstanceOf(IllegalStateException.class);
- assertThat(e).hasMessage("java.net.ConnectException: Connection refused");
+ assertThat(e).hasMessage("Fail to request http://localhost:1/api/issues");
+ assertThat(e.getCause()).hasMessage("Connection refused");
+
}
}
@@ -100,7 +102,7 @@ public class HttpRequestFactoryTest {
}
@Test
- public void should_encore_characters() {
+ public void should_encode_characters() {
HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url());
httpServer.doReturnBody("{\"issues\": [{\"key\": \"ABCDE\"}]}");