mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-02 06:45:59 +01:00
Make PacketReader.resetParser() throw the exception
there is no need to catch it and disguise it.
This commit is contained in:
parent
a613d5f574
commit
790ebeca33
1 changed files with 10 additions and 16 deletions
|
@ -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,16 +127,13 @@ 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 {
|
||||
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);
|
||||
}
|
||||
private void resetParser() throws XmlPullParserException {
|
||||
parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||
parser.setInput(connection.reader);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue