From 69d039be23392aa6dfcafa20b1eb8c48910f26c5 Mon Sep 17 00:00:00 2001 From: Sangmin Date: Fri, 25 Apr 2025 18:01:13 +0900 Subject: [PATCH] refactor: add IllegalArgumentException in getMostSpecificCause Method - Signed-off-by: Sangmin Na --- .../java/org/springframework/core/NestedExceptionUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-core/src/main/java/org/springframework/core/NestedExceptionUtils.java b/spring-core/src/main/java/org/springframework/core/NestedExceptionUtils.java index eba27406021e..6fbb35ba0a04 100644 --- a/spring-core/src/main/java/org/springframework/core/NestedExceptionUtils.java +++ b/spring-core/src/main/java/org/springframework/core/NestedExceptionUtils.java @@ -82,6 +82,9 @@ public abstract class NestedExceptionUtils { * @since 4.3.9 */ public static Throwable getMostSpecificCause(Throwable original) { + if (original == null) { + throw new IllegalArgumentException("Original exception must not be null"); + } Throwable rootCause = getRootCause(original); return (rootCause != null ? rootCause : original); }