1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 22:12:05 +01:00

Fixed logic bug where setting values via the API in SmackConfiguration could be overridden by the config file.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2297 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2004-04-18 18:11:26 +00:00 committed by mtucker
parent ad3b8a23d9
commit a958b245e6
2 changed files with 13 additions and 8 deletions

View file

@ -63,7 +63,13 @@ import org.xmlpull.v1.*;
* <ul>
* <li> Initializing classes by loading them at start-up.
* <li> Getting the current Smack version.
* <li> Getting and setting global library behavior, such as the period of time
* to wait for replies to packets from the server. Note: setting these values
* via the API will override settings in the configuration file.
* </ul>
*
* Configuration settings are stored in META-INF/smack-config.xml (typically inside the
* smack.jar file).
*
* @author Gaston Dombiak
*/
@ -78,14 +84,13 @@ public final class SmackConfiguration {
}
/**
* Loads the configuration from the smack.configuration file.<p>
* Loads the configuration from the smack-config.xml file.<p>
*
* So far this means that:
* 1) a set of classes will be loaded in order to execute their static init block
* 2) retrieve and set the current Smack release
*
*/
static void init() {
static {
try {
// Get an array of class loaders to try loading the providers files from.
ClassLoader[] classLoaders = getClassLoaders();
@ -98,8 +103,7 @@ public final class SmackConfiguration {
systemStream = url.openStream();
XmlPullParserFactory factory =
XmlPullParserFactory.newInstance(
"org.xmlpull.mxp1.MXParserFactory",
null);
"org.xmlpull.mxp1.MXParserFactory", null);
factory.setNamespaceAware(true);
XmlPullParser parser = factory.newPullParser();
parser.setInput(systemStream, "UTF-8");
@ -198,7 +202,7 @@ public final class SmackConfiguration {
Class.forName(className);
}
catch (ClassNotFoundException cnfe) {
System.err.println("Error! a startup class specified in smack-config.xml could " +
System.err.println("Error! A startup class specified in smack-config.xml could " +
"not be loaded: " + className);
}
}

View file

@ -94,6 +94,7 @@ public class XMPPConnection {
public static boolean DEBUG_ENABLED = false;
private static List connectionEstablishedListeners = new ArrayList();
static {
// Use try block since we may not have permission to get a system
// property (for example, when an applet).
@ -102,8 +103,8 @@ public class XMPPConnection {
}
catch (Exception e) {
}
// Initialize Smack with the parameterized configuration
SmackConfiguration.init();
// Ensure the SmackConfiguration class is loaded by calling a method in it.
SmackConfiguration.getVersion();
}
private SmackDebugger debugger = null;