Don't attempt to load camelCased version of the package name.
It's unlikely that a package would have a camelCased name and an attempt to load a class with wrong case is causing NoClassDefFoundError instead of ClassNotFoundException on non case-sensitive file systems.
This commit is contained in:
parent
db04649271
commit
4c295a28d5
|
@ -213,20 +213,15 @@ public class ImmutableSettings implements Settings {
|
|||
try {
|
||||
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
||||
} catch (ClassNotFoundException e1) {
|
||||
fullClassName = prefixPackage + toCamelCase(sValue) + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName;
|
||||
try {
|
||||
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
||||
} catch (ClassNotFoundException e2) {
|
||||
fullClassName = prefixPackage + toCamelCase(sValue).toLowerCase() + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName;
|
||||
try {
|
||||
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
||||
} catch (ClassNotFoundException e3) {
|
||||
} catch (ClassNotFoundException e2) {
|
||||
throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + sValue + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String[] getAsArray(String settingPrefix) throws SettingsException {
|
||||
return getAsArray(settingPrefix, Strings.EMPTY_ARRAY);
|
||||
|
|
Loading…
Reference in New Issue