mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Don't throw XmlPullParserException
removes the need to wrap the exception in a SmackException in XMPPTCPConnection.initConnection()
This commit is contained in:
parent
06c6546d2e
commit
ddb47c2d60
2 changed files with 15 additions and 10 deletions
|
@ -59,7 +59,7 @@ class PacketReader {
|
||||||
|
|
||||||
volatile boolean done;
|
volatile boolean done;
|
||||||
|
|
||||||
protected PacketReader(final XMPPTCPConnection connection) throws XmlPullParserException {
|
protected PacketReader(final XMPPTCPConnection connection) throws SmackException {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
@ -68,9 +68,9 @@ class PacketReader {
|
||||||
* Initializes the reader in order to be used. The reader is initialized during the
|
* Initializes the reader in order to be used. The reader is initialized during the
|
||||||
* first connection and when reconnecting due to an abruptly disconnection.
|
* first connection and when reconnecting due to an abruptly disconnection.
|
||||||
*
|
*
|
||||||
* @throws XmlPullParserException if the parser could not be reset.
|
* @throws SmackException if the parser could not be reset.
|
||||||
*/
|
*/
|
||||||
protected void init() throws XmlPullParserException {
|
protected void init() throws SmackException {
|
||||||
done = false;
|
done = false;
|
||||||
lastFeaturesParsed = false;
|
lastFeaturesParsed = false;
|
||||||
|
|
||||||
|
@ -128,13 +128,18 @@ class PacketReader {
|
||||||
* when the plain connection has been secured or when a new opening stream element is going
|
* when the plain connection has been secured or when a new opening stream element is going
|
||||||
* to be sent by the server.
|
* to be sent by the server.
|
||||||
*
|
*
|
||||||
* @throws XmlPullParserException XmlPullParserException if the parser could not be reset.
|
* @throws SmackException if the parser could not be reset.
|
||||||
*/
|
*/
|
||||||
private void resetParser() throws XmlPullParserException {
|
private void resetParser() throws SmackException {
|
||||||
|
try {
|
||||||
parser = XmlPullParserFactory.newInstance().newPullParser();
|
parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||||
parser.setInput(connection.reader);
|
parser.setInput(connection.reader);
|
||||||
}
|
}
|
||||||
|
catch (XmlPullParserException e) {
|
||||||
|
throw new SmackException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse top-level packets in order to process them further.
|
* Parse top-level packets in order to process them further.
|
||||||
|
|
|
@ -518,7 +518,7 @@ public class XMPPTCPConnection extends XMPPConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (SmackException ex) {
|
||||||
// An exception occurred in setting up the connection. Make sure we shut down the
|
// An exception occurred in setting up the connection. Make sure we shut down the
|
||||||
// readers and writers and close the socket.
|
// readers and writers and close the socket.
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ public class XMPPTCPConnection extends XMPPConnection {
|
||||||
authenticated = false;
|
authenticated = false;
|
||||||
connected = false;
|
connected = false;
|
||||||
|
|
||||||
throw new SmackException(ex); // Everything stoppped. Now throw the exception.
|
throw ex; // Everything stoppped. Now throw the exception.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue