Skip to content

Commit

Permalink
fix sonar cloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SrdjanStevanetic committed Jul 8, 2024
1 parent 11a90b1 commit a8d9485
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ UserSet fetchItems(UserSet storedUserSet, String sort, String sortOrder, int pag
/**
* update (stored) <code>persistentUserSet</code> with values from
* <code>webUserSet</code>
*
*
* @param persistentUserSet
* @param webUserSet
* @param profile
* @return
* @throws HttpException
* @throws HttpException
*/
UserSet updateUserSet(PersistentUserSet persistentUserSet, UserSet webUserSet) throws HttpException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public ResponseEntity<String> getUserSet(
profile=CommonApiConstants.PROFILE_MINIMAL;
} else {
pageNr = parseIntegerParam(CommonApiConstants.QUERY_PARAM_PAGE, page, -1, UserSetUtils.DEFAULT_PAGE);
pageNr = pageNr==null ? UserSetUtils.DEFAULT_PAGE : pageNr;
pageNr = pageNr==null ? Integer.valueOf(UserSetUtils.DEFAULT_PAGE) : pageNr;
int maxPageSize = getConfiguration().getMaxPageSize();
pageItems = parseIntegerParam(CommonApiConstants.QUERY_PARAM_PAGE_SIZE, pageSize, maxPageSize, UserSetConfigurationImpl.MIN_ITEMS_PER_PAGE);
pageItems = pageItems==null ? UserSetConfigurationImpl.DEFAULT_ITEMS_PER_PAGE : pageItems;
pageItems = pageItems==null ? Integer.valueOf(UserSetConfigurationImpl.DEFAULT_ITEMS_PER_PAGE) : pageItems;
}

return getUserSet(profile, identifier, request, sortField, sortOrderField, pageNr, pageItems,
Expand Down Expand Up @@ -592,13 +592,12 @@ public ResponseEntity<String> deleteItemFromUserSet(
// check user credentials, if invalid respond with HTTP 401,
// or if unauthorized respond with HTTP 403
Authentication authentication = verifyWriteAccess(Operations.DELETE, request);
return deleteItemFromUserSet(request, authentication, identifier, datasetId, localId);
return deleteItemFromUserSet(authentication, identifier, datasetId, localId);
}

/**
* This method validates input values and deletes item from a user set.
*
* @param request
*
* @param authentication The Authentication object
* @param identifier The identifier of a user set
* @param datasetId The identifier of the dataset, typically a number
Expand All @@ -608,8 +607,8 @@ public ResponseEntity<String> deleteItemFromUserSet(
* @return response entity that comprises response body, headers and status code
* @throws HttpException
*/
protected ResponseEntity<String> deleteItemFromUserSet(HttpServletRequest request,
Authentication authentication, String identifier, String datasetId, String localId)
protected ResponseEntity<String> deleteItemFromUserSet(Authentication authentication,
String identifier, String datasetId, String localId)
throws HttpException {
try {
// check if the Set exists, if not respond with HTTP 404
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ private void validateNewItems(UserSet storedUserSet, UserSet userSetUpdates)
* only metadata can be update for entity sets
*/
if (storedUserSet.isEntityBestItemsSet() && userSetUpdates.getItems()!=null
&& userSetUpdates.getItems().size()>0) {
&& !userSetUpdates.getItems().isEmpty()) {
throw new ApplicationAuthenticationException(
UserSetI18nConstants.USERSET_MINIMAL_UPDATE_PROFILE,
UserSetI18nConstants.USERSET_MINIMAL_UPDATE_PROFILE, new String[] {},
Expand Down

0 comments on commit a8d9485

Please sign in to comment.