Skip to content
Snippets Groups Projects

fixed ConfidentialClientApplication

Merged Martin Gargalovič requested to merge Confidential-Client-Fix into main
3 files
+ 51
4
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -7,7 +7,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.util.UrlPathHelper;
@@ -41,7 +40,7 @@ public class RestResponseEntityExceptionHandler {
* @param request request
* @return response entity
*/
@ExceptionHandler(value = {MethodArgumentNotValidException.class, HttpMessageNotReadableException.class})
@ExceptionHandler(value = {MethodArgumentNotValidException.class})
public ResponseEntity<ApiError> handleValidationErrors(MethodArgumentNotValidException ex, HttpServletRequest request) {
List<ApiSubError> subErrors = ex.getBindingResult().getFieldErrors()
.stream()
@@ -55,6 +54,22 @@ public class RestResponseEntityExceptionHandler {
return buildResponseEntity(error);
}
/**
* Handle MessageNotReadable exceptions
*
* @param ex exception
* @param request request
* @return response entity
*/
@ExceptionHandler(value = {HttpMessageNotReadableException.class})
public ResponseEntity<ApiError> handleMessageNotReadableErrors(HttpMessageNotReadableException ex, HttpServletRequest request) {
ApiError error = new ApiError(
HttpStatus.BAD_REQUEST,
ex,
URL_PATH_HELPER.getRequestUri(request));
return buildResponseEntity(error);
}
/**
* Handle exceptions not matched by above handler methods
*
Loading