diff --git a/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/exception/ErrorResponse.java b/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/exception/ErrorResponse.java index 5384d8d0..628d8949 100644 --- a/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/exception/ErrorResponse.java +++ b/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/exception/ErrorResponse.java @@ -89,7 +89,7 @@ public static String process422(Throwable throwable) { if (throwable == null) { return ERROR_422_INVALID_FORMAT.getMsg(); } - return Optional.of(throwable.getCause()) + return Optional.ofNullable(throwable.getCause()) .flatMap(cause -> Optional.ofNullable(cause.getMessage())) .filter(isMissingProperty.or(isInvalidValue)) .orElseGet(ERROR_422_INVALID_FORMAT::getMsg);