Skip to content

Commit

Permalink
EA-4015 sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SrishtiSingh-eu committed Dec 12, 2024
1 parent a6b9ca0 commit aa169ed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ protected List<? extends UserSet> getSearchUserSetResponse(String url, String au
if (StringUtils.equals(profile, ProfileConstants.VALUE_PARAM_ITEMS)) {
TypeReference<ResultsPageImpl<String>> typeRef = new TypeReference<>() {};
List<String> items = mapper.readValue(responseBody, typeRef).getItems();
List<UserSet> sets = new ArrayList<>();
List<UserSet> sets = new ArrayList<>(items.size());
for (String id: items) {
UserSet set = new BaseUserSet();
set.setIdentifier(StringUtils.substringAfterLast(id, "/"));
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ private <T extends HttpUriRequestBase> CloseableHttpResponse executeHttpClient(T

}

private <T extends HttpUriRequestBase> T addHeaders(T url, String headerName, String headerValue) {
private <T extends HttpUriRequestBase> void addHeaders(T url, String headerName, String headerValue) {
if (StringUtils.isNotBlank(headerValue)) {
url.setHeader(headerName, headerValue);
}
return url;
}
}

0 comments on commit aa169ed

Please sign in to comment.