/** * Verifies that the passed parameter is greater than 0. * * @param parameter The parameter to be validated. * @param parameterName The name of the parameter to appear in the error message * * @throws BadPaginationException if 'parameter' is not greater than 0. */ private static void validate(int parameter, String parameterName) throws BadPaginationException { if (parameter < MINIMAL_VALUE) { ErrorMessageFormat errorMessage = ErrorMessageFormat.PAGINATION_PARAMETER_INVALID; LOG.debug(errorMessage.logFormat(parameterName, parameter)); throw new BadPaginationException(errorMessage.format(parameterName, parameter)); } }
ErrorMessageFormat errorMessage = ErrorMessageFormat.PAGINATION_PARAMETER_MISSING; LOG.debug(errorMessage.logFormat(parameterName)); throw new BadPaginationException(errorMessage.format(parameterName)); ErrorMessageFormat errorMessage = ErrorMessageFormat.PAGINATION_PARAMETER_INVALID; LOG.debug(errorMessage.logFormat(parameterName, parameter)); throw new BadPaginationException(errorMessage.format(parameterName, parameter));