From a7871a6bdbbd17a64e0743b9eff6ae2aa86f0bcb Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Tue, 11 Jun 2024 10:53:54 -0400 Subject: [PATCH] Use Objects.toString() --- src/main/java/org/apache/commons/lang3/ObjectUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java index 295852861..ea59208d7 100644 --- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java +++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java @@ -1274,9 +1274,9 @@ public class ObjectUtils { * ObjectUtils.toString(Boolean.TRUE) = "true" * * - * @see StringUtils#defaultString(String) * @see Objects#toString(Object) * @see Objects#toString(Object, String) + * @see StringUtils#defaultString(String) * @see String#valueOf(Object) * @param obj the Object to {@code toString}, may be null * @return the passed in Object's toString, or {@code ""} if {@code null} input @@ -1302,6 +1302,8 @@ public class ObjectUtils { * ObjectUtils.toString(Boolean.TRUE, "null") = "true" * * + * @see Objects#toString(Object) + * @see Objects#toString(Object, String) * @see StringUtils#defaultString(String,String) * @see String#valueOf(Object) * @param obj the Object to {@code toString}, may be null @@ -1313,7 +1315,7 @@ public class ObjectUtils { */ @Deprecated public static String toString(final Object obj, final String nullStr) { - return obj == null ? nullStr : obj.toString(); + return Objects.toString(obj, nullStr); } /**