diff --git a/set-client/src/main/java/eu/europeana/set/client/connection/BaseApiConnection.java b/set-client/src/main/java/eu/europeana/set/client/connection/BaseApiConnection.java index a1187332..31140588 100644 --- a/set-client/src/main/java/eu/europeana/set/client/connection/BaseApiConnection.java +++ b/set-client/src/main/java/eu/europeana/set/client/connection/BaseApiConnection.java @@ -219,7 +219,7 @@ protected List getSearchUserSetResponse(String url, String au if (StringUtils.equals(profile, ProfileConstants.VALUE_PARAM_ITEMS)) { TypeReference> typeRef = new TypeReference<>() {}; List items = mapper.readValue(responseBody, typeRef).getItems(); - List sets = new ArrayList<>(); + List sets = new ArrayList<>(items.size()); for (String id: items) { UserSet set = new BaseUserSet(); set.setIdentifier(StringUtils.substringAfterLast(id, "/")); @@ -269,7 +269,7 @@ public static URI buildGetUrls(String path, String profile) throws SetApiClientE } return builder.build(); } catch (URISyntaxException e) { - throw new SetApiClientException("Error creating Get url for " +path); + throw new SetApiClientException("Error creating Get url - " + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, e); } } @@ -301,7 +301,7 @@ public static URI buildPaginatedGetUrls(String path, String sort, } return builder.build(); } catch (URISyntaxException e) { - throw new SetApiClientException("Error creating Paginated Get Urls url for " +path); + throw new SetApiClientException("Error creating Paginated Get Urls " +e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, e); } } @@ -342,7 +342,7 @@ public static URI buildSearchUrl(String query, String[] qf, String sort, String } return builder.build(); } catch (URISyntaxException e) { - throw new SetApiClientException("Error creating Search Urls url for " +SEARCH_PATH); + throw new SetApiClientException("Error creating Search Urls ", HttpStatus.SC_INTERNAL_SERVER_ERROR, e); } } diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java b/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java index 68899a3d..32475a8d 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java +++ b/set-client/src/test/java/eu/europeana/set/client/integration/web/BaseWebUserSetProtocol.java @@ -63,7 +63,7 @@ protected void deleteUserSet(UserSet set) throws SetApiClientException { protected void deleteUserSet(String identifier) throws SetApiClientException { String re = apiClient.getWebUserSetApi().deleteUserSet(identifier); - assertEquals(HttpStatus.SC_OK, re); + assertEquals(String.valueOf(HttpStatus.SC_OK), re); log.trace("User set deleted: /" + identifier); } diff --git a/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java b/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java index 323ddd3d..de290fd5 100644 --- a/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java +++ b/set-client/src/test/java/eu/europeana/set/client/integration/web/WebUserSetProtocolTest.java @@ -65,7 +65,7 @@ public void deleteUserSet() throws IOException, SetApiClientException { assertNotNull(testSetId); // delete user set by identifier URL String deleteResponse = apiClient.getWebUserSetApi().deleteUserSet(testSetId); - assertEquals(HttpStatus.SC_NO_CONTENT, deleteResponse); + assertEquals(String.valueOf(HttpStatus.SC_NO_CONTENT), deleteResponse); } /** diff --git a/set-common/src/main/java/eu/europeana/set/common/http/HttpConnection.java b/set-common/src/main/java/eu/europeana/set/common/http/HttpConnection.java index 1bb95f94..359d8ad0 100644 --- a/set-common/src/main/java/eu/europeana/set/common/http/HttpConnection.java +++ b/set-common/src/main/java/eu/europeana/set/common/http/HttpConnection.java @@ -103,10 +103,9 @@ private CloseableHttpResponse executeHttpClient(T } - private T addHeaders(T url, String headerName, String headerValue) { + private void addHeaders(T url, String headerName, String headerValue) { if (StringUtils.isNotBlank(headerValue)) { url.setHeader(headerName, headerValue); } - return url; } }