[LANG-1691] ClassUtils.getShortCanonicalName doesn't use the

canonicalName #949
This commit is contained in:
Gary Gregory 2022-09-15 15:28:00 -04:00
parent 45acc1c970
commit 19612d4134
2 changed files with 5 additions and 8 deletions

View File

@ -101,6 +101,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Marc Wrobel">Fix links in Javadoc and documentation #926.</action> <action type="fix" dev="ggregory" due-to="Marc Wrobel">Fix links in Javadoc and documentation #926.</action>
<action issue="LANG-1604" type="fix" dev="ggregory" due-to="Gilles Sadowski, Maksym Bohachov, Gary Gregory">Deprecate RandomUtils in favor of Apache Commons RNG UniformRandomProvider #942.</action> <action issue="LANG-1604" type="fix" dev="ggregory" due-to="Gilles Sadowski, Maksym Bohachov, Gary Gregory">Deprecate RandomUtils in favor of Apache Commons RNG UniformRandomProvider #942.</action>
<action issue="LANG-1638" type="fix" dev="ggregory" due-to="Shailendra Soni, Michael Osipov, Arun Avanathan, Andrew Thomas, Bruno P. Kinoshita, Gary Gregory">Added docs regarding week year support #924.</action> <action issue="LANG-1638" type="fix" dev="ggregory" due-to="Shailendra Soni, Michael Osipov, Arun Avanathan, Andrew Thomas, Bruno P. Kinoshita, Gary Gregory">Added docs regarding week year support #924.</action>
<action issue="LANG-1691" type="fix" dev="ggregory" due-to="Thiyagarajan, Gary Gregory">ClassUtils.getShortCanonicalName doesn't use the canonicalName #949.</action>
<!-- ADD --> <!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GitHub coverage.yml.</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add GitHub coverage.yml.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add EnumUtils.getEnumSystemProperty(...).</action> <action type="add" dev="ggregory" due-to="Gary Gregory">Add EnumUtils.getEnumSystemProperty(...).</action>

View File

@ -808,12 +808,10 @@ public class ClassUtils {
* @param cls the class for which to get the short canonical class name; may be null * @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 * @return the canonical name without the package name or an empty string
* @since 2.4 * @since 2.4
* @see Class#getCanonicalName()
*/ */
public static String getShortCanonicalName(final Class<?> cls) { public static String getShortCanonicalName(final Class<?> cls) {
if (cls == null) { return cls == null ? StringUtils.EMPTY : getShortCanonicalName(cls.getCanonicalName());
return StringUtils.EMPTY;
}
return getShortCanonicalName(cls.getCanonicalName());
} }
/** /**
@ -823,12 +821,10 @@ public class ClassUtils {
* @param valueIfNull the value to return if null * @param valueIfNull the value to return if null
* @return the canonical name of the object without the package name, or the null value * @return the canonical name of the object without the package name, or the null value
* @since 2.4 * @since 2.4
* @see Class#getCanonicalName()
*/ */
public static String getShortCanonicalName(final Object object, final String valueIfNull) { public static String getShortCanonicalName(final Object object, final String valueIfNull) {
if (object == null) { return object == null ? valueIfNull : getShortCanonicalName(object.getClass().getCanonicalName());
return valueIfNull;
}
return getShortCanonicalName(object.getClass().getCanonicalName());
} }
/** /**