1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

SMACK-425 Introduced smack.parsing.ParsingExceptionCallback, a callback invoked when a exception is thrown while parsing a stanza. Smack is now able to either rethrow the exception ulitmatly causing a disconnect *or* log/ignore the exception and resume parsing after the faulty stanza.

Conflicts:
	source/org/jivesoftware/smack/SmackConfiguration.java

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13685 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-06-22 17:00:27 +00:00 committed by flow
parent dac68c64a9
commit 4cd53e4419
12 changed files with 541 additions and 8 deletions

View file

@ -28,6 +28,8 @@ import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
import org.jivesoftware.smack.parsing.ThrowException;
import org.xmlpull.mxp1.MXParser;
import org.xmlpull.v1.XmlPullParser;
@ -58,6 +60,17 @@ public final class SmackConfiguration {
private static int localSocks5ProxyPort = 7777;
private static int packetCollectorSize = 5000;
/**
* defaultPingInterval (in seconds)
*/
private static int defaultPingInterval = 1800; // 30 min (30*60)
/**
* The default parsing exception callback is {@link ThrowException} which will
* throw an exception and therefore disconnect the active connection.
*/
private static ParsingExceptionCallback defaultCallback = new ThrowException();
/**
* This automatically enables EntityCaps for new connections if it is set to true
*/
@ -331,6 +344,38 @@ public final class SmackConfiguration {
return autoEnableEntityCaps;
}
<<<<<<< HEAD
=======
/**
* Set if Entity Caps are enabled or disabled for every new connection
*
* @param true if Entity Caps should be auto enabled, false if not
*/
public static void setAutoEnableEntityCaps(boolean b) {
autoEnableEntityCaps = b;
}
/**
* Set the default parsing exception callback for all newly created connections
*
* @param callback
* @see ParsingExceptionCallback
*/
public static void setDefaultParsingExceptionCallback(ParsingExceptionCallback callback) {
defaultCallback = callback;
}
/**
* Returns the default parsing exception callback
*
* @return the default parsing exception callback
* @see ParsingExceptionCallback
*/
public static ParsingExceptionCallback getDefaultParsingExceptionCallback() {
return defaultCallback;
}
>>>>>>> SMACK-425 Introduced smack.parsing.ParsingExceptionCallback, a callback invoked when a exception is thrown while parsing a stanza. Smack is now able to either rethrow the exception ulitmatly causing a disconnect *or* log/ignore the exception and resume parsing after the faulty stanza.
private static void parseClassToLoad(XmlPullParser parser) throws Exception {
String className = parser.nextText();
// Attempt to load the class so that the class can get initialized