Reuse own API

This commit is contained in:
Gary Gregory 2022-11-04 14:20:14 -04:00
parent 3c38140a2f
commit ecd23d5e20
2 changed files with 4 additions and 6 deletions

View File

@ -1163,8 +1163,7 @@ public class Validate {
public static void isInstanceOf(final Class<?> type, final Object obj) {
// TODO when breaking BC, consider returning obj
if (!type.isInstance(obj)) {
throw new IllegalArgumentException(String.format(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(),
obj == null ? "null" : obj.getClass().getName()));
throw new IllegalArgumentException(String.format(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(), ClassUtils.getName(obj, "null")));
}
}

View File

@ -32,6 +32,7 @@ import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.LocaleUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
@ -424,8 +425,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
if (obj instanceof Long) {
return format(((Long) obj).longValue(), toAppendTo);
}
throw new IllegalArgumentException("Unknown class: " +
(obj == null ? "<null>" : obj.getClass().getName()));
throw new IllegalArgumentException("Unknown class: " + ClassUtils.getName(obj, "<null>"));
}
/**
@ -445,8 +445,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
if (obj instanceof Long) {
return format(((Long) obj).longValue());
}
throw new IllegalArgumentException("Unknown class: " +
(obj == null ? "<null>" : obj.getClass().getName()));
throw new IllegalArgumentException("Unknown class: " + ClassUtils.getName(obj, "<null>"));
}
/* (non-Javadoc)