mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42: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:
parent
ad3b8a23d9
commit
a958b245e6
2 changed files with 13 additions and 8 deletions
|
@ -63,7 +63,13 @@ import org.xmlpull.v1.*;
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> Initializing classes by loading them at start-up.
|
* <li> Initializing classes by loading them at start-up.
|
||||||
* <li> Getting the current Smack version.
|
* <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>
|
* </ul>
|
||||||
|
*
|
||||||
|
* Configuration settings are stored in META-INF/smack-config.xml (typically inside the
|
||||||
|
* smack.jar file).
|
||||||
*
|
*
|
||||||
* @author Gaston Dombiak
|
* @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:
|
* So far this means that:
|
||||||
* 1) a set of classes will be loaded in order to execute their static init block
|
* 1) a set of classes will be loaded in order to execute their static init block
|
||||||
* 2) retrieve and set the current Smack release
|
* 2) retrieve and set the current Smack release
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static void init() {
|
static {
|
||||||
try {
|
try {
|
||||||
// Get an array of class loaders to try loading the providers files from.
|
// Get an array of class loaders to try loading the providers files from.
|
||||||
ClassLoader[] classLoaders = getClassLoaders();
|
ClassLoader[] classLoaders = getClassLoaders();
|
||||||
|
@ -98,8 +103,7 @@ public final class SmackConfiguration {
|
||||||
systemStream = url.openStream();
|
systemStream = url.openStream();
|
||||||
XmlPullParserFactory factory =
|
XmlPullParserFactory factory =
|
||||||
XmlPullParserFactory.newInstance(
|
XmlPullParserFactory.newInstance(
|
||||||
"org.xmlpull.mxp1.MXParserFactory",
|
"org.xmlpull.mxp1.MXParserFactory", null);
|
||||||
null);
|
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true);
|
||||||
XmlPullParser parser = factory.newPullParser();
|
XmlPullParser parser = factory.newPullParser();
|
||||||
parser.setInput(systemStream, "UTF-8");
|
parser.setInput(systemStream, "UTF-8");
|
||||||
|
@ -198,7 +202,7 @@ public final class SmackConfiguration {
|
||||||
Class.forName(className);
|
Class.forName(className);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException cnfe) {
|
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);
|
"not be loaded: " + className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,7 @@ public class XMPPConnection {
|
||||||
public static boolean DEBUG_ENABLED = false;
|
public static boolean DEBUG_ENABLED = false;
|
||||||
|
|
||||||
private static List connectionEstablishedListeners = new ArrayList();
|
private static List connectionEstablishedListeners = new ArrayList();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Use try block since we may not have permission to get a system
|
// Use try block since we may not have permission to get a system
|
||||||
// property (for example, when an applet).
|
// property (for example, when an applet).
|
||||||
|
@ -102,8 +103,8 @@ public class XMPPConnection {
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
// Initialize Smack with the parameterized configuration
|
// Ensure the SmackConfiguration class is loaded by calling a method in it.
|
||||||
SmackConfiguration.init();
|
SmackConfiguration.getVersion();
|
||||||
}
|
}
|
||||||
private SmackDebugger debugger = null;
|
private SmackDebugger debugger = null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue