Permission denied

Report a typo

Complete the following @ExceptionHandler method which handles PermissionDeniedException.

Java
@ExceptionHandler({1})
public ResponseEntity<Map<String, String>> handlePermissionDenied({2} e) {

    Map<String, String> body = new HashMap<>();
    body.put("message", e.getMessage());
    body.put("status", {3});

    return new ResponseEntity<>(body, {4});
}
Kotlin
@ExceptionHandler({1})
fun handlePermissionDenied(e: {2}): ResponseEntity<Map<String, String>> {

    val body = HashMap<String, String?>()
    body["message"] = e.getMessage()
    body["status"] = {3}

    return ResponseEntity(body, {4})
}
Match the items from left and right columns
{1}
{2}
{3}
{4}
HttpStatus.FORBIDDEN.toString()
HttpStatus.FORBIDDEN
PermissionDeniedException
PermissionDeniedException.class
___

Create a free account to access the full topic