diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/PersistenceExceptionConverter.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/PersistenceExceptionConverter.java index 2153af0a4d..5cb61d5687 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/PersistenceExceptionConverter.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/PersistenceExceptionConverter.java @@ -81,7 +81,7 @@ public class PersistenceExceptionConverter implements InvocationHandler { public static ModelException convert(Throwable t) { final Predicate checkDuplicationMessage = throwable -> { final String message = throwable.getCause() != null ? throwable.getCause().getMessage() : throwable.getMessage(); - return message.toLowerCase().contains("duplicate"); + return message == null ? false : message.toLowerCase().contains("duplicate"); }; Predicate throwModelDuplicateEx = throwable ->