From 92c01ac3408da4a0eb2f112e824fc83bba32fbaf Mon Sep 17 00:00:00 2001
From: birariro <vps32@naver.com>
Date: Thu, 8 Feb 2024 13:36:28 +0900
Subject: [PATCH] modify constructor paramenter valid not null

---
 .../springframework/data/rest/core/ValidationErrors.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/ValidationErrors.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/ValidationErrors.java
index 104f49df3..07872fe2c 100644
--- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/ValidationErrors.java
+++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/ValidationErrors.java
@@ -55,9 +55,7 @@ public class ValidationErrors extends AbstractPropertyBindingResult {
 	 */
 	public ValidationErrors(Object source, PersistentEntities entities) {
 
-		super(source.getClass().getSimpleName());
-
-		Assert.notNull(source, "Entity must not be null");
+		super(requireNotNull(source, "Entity must not be null").getClass().getSimpleName());
 		Assert.notNull(entities, "PersistentEntities must not be null");
 
 		this.entities = entities;
@@ -104,6 +102,10 @@ private Object lookupValueOn(Object value, String segment) {
 			}
 		};
 	}
+	private static <T> T requireNotNull(T object, String message) {
+		Assert.notNull(object, message);
+		return object;
+	}
 
 	@Override
 	public Object getTarget() {