1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 06:45:59 +01:00

Log loaded classes by SmackConfiguration

This commit is contained in:
Florian Schmaus 2014-03-24 20:33:01 +01:00
parent cc026a7e85
commit 2619a63c21

View file

@ -322,14 +322,10 @@ public final class SmackConfiguration {
}
private static void loadSmackClass(String className, boolean optional) throws Exception {
// Attempt to load the class so that the class can get initialized
Class<?> initClass;
try {
Class<?> initClass = Class.forName(className);
if (SmackInitializer.class.isAssignableFrom(initClass)) {
SmackInitializer initializer = (SmackInitializer) initClass.newInstance();
initializer.initialize();
}
// Attempt to load the class so that the class can get initialized
initClass = Class.forName(className);
}
catch (ClassNotFoundException cnfe) {
Level logLevel;
@ -341,8 +337,18 @@ public final class SmackConfiguration {
}
LOGGER.log(logLevel, "A startup class [" + className
+ "] specified in smack-config.xml could not be loaded: ");
if (!optional)
if (!optional) {
throw cnfe;
} else {
return;
}
}
if (SmackInitializer.class.isAssignableFrom(initClass)) {
SmackInitializer initializer = (SmackInitializer) initClass.newInstance();
initializer.initialize();
LOGGER.log(Level.FINE, "Loaded SmackInitializer " + className);
} else {
LOGGER.log(Level.FINE, "Loaded " + className);
}
}
}