1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

Make PacketReader.resetParser() throw the exception

there is no need to catch it and disguise it.
This commit is contained in:
Florian Schmaus 2014-04-26 19:08:50 +02:00
parent a613d5f574
commit 790ebeca33

View file

@ -34,9 +34,6 @@ import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Listens for XML traffic from the XMPP server and parses it into packet objects.
* The packet reader also invokes all packet listeners and collectors.<p>
@ -47,8 +44,6 @@ import java.util.logging.Logger;
*/
class PacketReader {
private static final Logger LOGGER = Logger.getLogger(PacketReader.class.getName());
private Thread readerThread;
private XMPPTCPConnection connection;
@ -64,7 +59,7 @@ class PacketReader {
volatile boolean done;
protected PacketReader(final XMPPTCPConnection connection) {
protected PacketReader(final XMPPTCPConnection connection) throws XmlPullParserException {
this.connection = connection;
this.init();
}
@ -72,8 +67,10 @@ class PacketReader {
/**
* Initializes the reader in order to be used. The reader is initialized during the
* first connection and when reconnecting due to an abruptly disconnection.
*
* @throws XmlPullParserException if the parser could not be reset.
*/
protected void init() {
protected void init() throws XmlPullParserException {
done = false;
lastFeaturesParsed = false;
@ -130,17 +127,14 @@ class PacketReader {
* Resets the parser using the latest connection's reader. Reseting the parser is necessary
* when the plain connection has been secured or when a new opening stream element is going
* to be sent by the server.
*
* @throws XmlPullParserException XmlPullParserException if the parser could not be reset.
*/
private void resetParser() {
try {
private void resetParser() throws XmlPullParserException {
parser = XmlPullParserFactory.newInstance().newPullParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(connection.reader);
}
catch (XmlPullParserException xppe) {
LOGGER.log(Level.WARNING, "Error while resetting parser", xppe);
}
}
/**
* Parse top-level packets in order to process them further.