1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-27 00:32:07 +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 { 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 { try {
Class<?> initClass = Class.forName(className); // Attempt to load the class so that the class can get initialized
initClass = Class.forName(className);
if (SmackInitializer.class.isAssignableFrom(initClass)) {
SmackInitializer initializer = (SmackInitializer) initClass.newInstance();
initializer.initialize();
}
} }
catch (ClassNotFoundException cnfe) { catch (ClassNotFoundException cnfe) {
Level logLevel; Level logLevel;
@ -341,8 +337,18 @@ public final class SmackConfiguration {
} }
LOGGER.log(logLevel, "A startup class [" + className LOGGER.log(logLevel, "A startup class [" + className
+ "] specified in smack-config.xml could not be loaded: "); + "] specified in smack-config.xml could not be loaded: ");
if (!optional) if (!optional) {
throw cnfe; 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);
} }
} }
} }