diff options
author | Gary Gregory <garydgregory@gmail.com> | 2022-09-15 15:28:00 -0400 |
---|---|---|
committer | Gary Gregory <garydgregory@gmail.com> | 2022-09-15 15:28:00 -0400 |
commit | 19612d4134c6000644fda0539a47211d577d116f (patch) | |
tree | 9cebdf2e0fa548bd32648dba93990ca4194240ca /src/main | |
parent | 45acc1c97094cd68928f634ce4896e4b05ee92ac (diff) | |
download | apache-commons-lang-19612d4134c6000644fda0539a47211d577d116f.tar.gz |
[LANG-1691] ClassUtils.getShortCanonicalName doesn't use the
canonicalName #949
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/apache/commons/lang3/ClassUtils.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java index 2e37d54d3..9e8f5f6ad 100644 --- a/src/main/java/org/apache/commons/lang3/ClassUtils.java +++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java @@ -808,12 +808,10 @@ public class ClassUtils { * @param cls the class for which to get the short canonical class name; may be null * @return the canonical name without the package name or an empty string * @since 2.4 + * @see Class#getCanonicalName() */ public static String getShortCanonicalName(final Class<?> cls) { - if (cls == null) { - return StringUtils.EMPTY; - } - return getShortCanonicalName(cls.getCanonicalName()); + return cls == null ? StringUtils.EMPTY : getShortCanonicalName(cls.getCanonicalName()); } /** @@ -823,12 +821,10 @@ public class ClassUtils { * @param valueIfNull the value to return if null * @return the canonical name of the object without the package name, or the null value * @since 2.4 + * @see Class#getCanonicalName() */ public static String getShortCanonicalName(final Object object, final String valueIfNull) { - if (object == null) { - return valueIfNull; - } - return getShortCanonicalName(object.getClass().getCanonicalName()); + return object == null ? valueIfNull : getShortCanonicalName(object.getClass().getCanonicalName()); } /** |