use of org.orcid.core.exception.SearchStartParameterLimitExceededException in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method validateStart.
private void validateStart(Map<String, List<String>> queryMap) {
String clientId = orcidSecurityManager.getClientIdFromAPIRequest();
if (clientId == null) {
// only validate start param where no client credentials
List<String> startList = queryMap.get("start");
if (startList != null && !startList.isEmpty()) {
try {
String startString = startList.get(0);
int start = Integer.valueOf(startString);
if (start < 0 || start > OrcidSearchManager.MAX_SEARCH_START) {
throw new SearchStartParameterLimitExceededException(localeManager.resolveMessage("apiError.badrequest_invalid_search_start.exception", OrcidSearchManager.MAX_SEARCH_START));
}
} catch (NumberFormatException e) {
throw new OrcidBadRequestException(localeManager.resolveMessage("apiError.badrequest_invalid_search_start.exception", OrcidSearchManager.MAX_SEARCH_START));
}
}
}
}
Aggregations