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,16 +213,11 @@ public class ImmutableSettings implements Settings {
|
||||||
try {
|
try {
|
||||||
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
||||||
} catch (ClassNotFoundException e1) {
|
} catch (ClassNotFoundException e1) {
|
||||||
fullClassName = prefixPackage + toCamelCase(sValue) + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName;
|
fullClassName = prefixPackage + toCamelCase(sValue).toLowerCase() + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName;
|
||||||
try {
|
try {
|
||||||
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
||||||
} catch (ClassNotFoundException e2) {
|
} catch (ClassNotFoundException e2) {
|
||||||
fullClassName = prefixPackage + toCamelCase(sValue).toLowerCase() + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName;
|
throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + sValue + "]", e);
|
||||||
try {
|
|
||||||
return (Class<? extends T>) getClassLoader().loadClass(fullClassName);
|
|
||||||
} catch (ClassNotFoundException e3) {
|
|
||||||
throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + sValue + "]", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue