From e83f3af0805d7eedc02e1183031b706eabf249a6 Mon Sep 17 00:00:00 2001 From: Filipe Roque Date: Fri, 17 May 2024 14:12:15 +0100 Subject: [PATCH] Call super constructor in subclasses of WebApplicationException Frameworks like Datadog dd-trace-java java agent inspect the known WebApplicationException and mark the exception as an HTTP 500, because that is the default for the non argument constructor. https://github.com/keycloak/keycloak/issues/29451 Signed-off-by: Filipe Roque --- .../java/org/keycloak/services/CorsErrorResponseException.java | 1 + .../src/main/java/org/keycloak/services/ErrorPageException.java | 1 + .../main/java/org/keycloak/services/ErrorResponseException.java | 1 + 3 files changed, 3 insertions(+) diff --git a/services/src/main/java/org/keycloak/services/CorsErrorResponseException.java b/services/src/main/java/org/keycloak/services/CorsErrorResponseException.java index f2ed784851..1c8731b148 100644 --- a/services/src/main/java/org/keycloak/services/CorsErrorResponseException.java +++ b/services/src/main/java/org/keycloak/services/CorsErrorResponseException.java @@ -35,6 +35,7 @@ public class CorsErrorResponseException extends WebApplicationException { private final Response.Status status; public CorsErrorResponseException(Cors cors, String error, String errorDescription, Response.Status status) { + super(error, status); this.cors = cors; this.error = error; this.errorDescription = errorDescription; diff --git a/services/src/main/java/org/keycloak/services/ErrorPageException.java b/services/src/main/java/org/keycloak/services/ErrorPageException.java index 2cf4a352b8..d2285f9e5c 100644 --- a/services/src/main/java/org/keycloak/services/ErrorPageException.java +++ b/services/src/main/java/org/keycloak/services/ErrorPageException.java @@ -36,6 +36,7 @@ public class ErrorPageException extends WebApplicationException { public ErrorPageException(KeycloakSession session, Response.Status status, String errorMessage, Object... parameters) { + super(errorMessage, status); this.session = session; this.status = status; this.errorMessage = errorMessage; diff --git a/services/src/main/java/org/keycloak/services/ErrorResponseException.java b/services/src/main/java/org/keycloak/services/ErrorResponseException.java index b7d258b169..99fe06fdc7 100644 --- a/services/src/main/java/org/keycloak/services/ErrorResponseException.java +++ b/services/src/main/java/org/keycloak/services/ErrorResponseException.java @@ -36,6 +36,7 @@ public class ErrorResponseException extends WebApplicationException { private final Response.Status status; public ErrorResponseException(String error, String errorDescription, Response.Status status) { + super(error, status); this.response = null; this.error = error; this.errorDescription = errorDescription;