Attaching Johann's fix to LANG-322 (via Ben's patch)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@594394 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da6569b4a6
commit
62a9fa6811
|
@ -161,16 +161,15 @@ public class ClassUtils {
|
|||
if (className.length() == 0) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
char[] chars = className.toCharArray();
|
||||
int lastDot = 0;
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] == PACKAGE_SEPARATOR_CHAR) {
|
||||
lastDot = i + 1;
|
||||
} else if (chars[i] == INNER_CLASS_SEPARATOR_CHAR) { // handle inner classes
|
||||
chars[i] = PACKAGE_SEPARATOR_CHAR;
|
||||
}
|
||||
|
||||
int lastDotIdx = className.lastIndexOf(PACKAGE_SEPARATOR_CHAR);
|
||||
int innerIdx = className.indexOf(
|
||||
INNER_CLASS_SEPARATOR_CHAR, lastDotIdx == -1 ? 0 : lastDotIdx + 1);
|
||||
String out = className.substring(lastDotIdx + 1);
|
||||
if (innerIdx != -1) {
|
||||
out = out.replace(INNER_CLASS_SEPARATOR_CHAR, PACKAGE_SEPARATOR_CHAR);
|
||||
}
|
||||
return new String(chars, lastDot, chars.length - lastDot);
|
||||
return out;
|
||||
}
|
||||
|
||||
// Package name
|
||||
|
|
Loading…
Reference in New Issue