Search in sources :

Example 1 with ParsingExceptionCallback

use of org.jivesoftware.smack.parsing.ParsingExceptionCallback in project Smack by igniterealtime.

the class AbstractXMPPConnection method parseAndProcessStanza.

protected void parseAndProcessStanza(XmlPullParser parser) throws Exception {
    ParserUtils.assertAtStartTag(parser);
    int parserDepth = parser.getDepth();
    Stanza stanza = null;
    try {
        stanza = PacketParserUtils.parseStanza(parser);
    } catch (Exception e) {
        CharSequence content = PacketParserUtils.parseContentDepth(parser, parserDepth);
        UnparseableStanza message = new UnparseableStanza(content, e);
        ParsingExceptionCallback callback = getParsingExceptionCallback();
        if (callback != null) {
            callback.handleUnparsableStanza(message);
        }
    }
    ParserUtils.assertAtEndTag(parser);
    if (stanza != null) {
        processStanza(stanza);
    }
}
Also used : Stanza(org.jivesoftware.smack.packet.Stanza) ParsingExceptionCallback(org.jivesoftware.smack.parsing.ParsingExceptionCallback) SecurityRequiredException(org.jivesoftware.smack.SmackException.SecurityRequiredException) XMPPErrorException(org.jivesoftware.smack.XMPPException.XMPPErrorException) AlreadyLoggedInException(org.jivesoftware.smack.SmackException.AlreadyLoggedInException) NotConnectedException(org.jivesoftware.smack.SmackException.NotConnectedException) StreamErrorException(org.jivesoftware.smack.XMPPException.StreamErrorException) NoResponseException(org.jivesoftware.smack.SmackException.NoResponseException) IOException(java.io.IOException) AlreadyConnectedException(org.jivesoftware.smack.SmackException.AlreadyConnectedException) SecurityRequiredByClientException(org.jivesoftware.smack.SmackException.SecurityRequiredByClientException) ResourceBindingNotOfferedException(org.jivesoftware.smack.SmackException.ResourceBindingNotOfferedException)

Aggregations

IOException (java.io.IOException)1 AlreadyConnectedException (org.jivesoftware.smack.SmackException.AlreadyConnectedException)1 AlreadyLoggedInException (org.jivesoftware.smack.SmackException.AlreadyLoggedInException)1 NoResponseException (org.jivesoftware.smack.SmackException.NoResponseException)1 NotConnectedException (org.jivesoftware.smack.SmackException.NotConnectedException)1 ResourceBindingNotOfferedException (org.jivesoftware.smack.SmackException.ResourceBindingNotOfferedException)1 SecurityRequiredByClientException (org.jivesoftware.smack.SmackException.SecurityRequiredByClientException)1 SecurityRequiredException (org.jivesoftware.smack.SmackException.SecurityRequiredException)1 StreamErrorException (org.jivesoftware.smack.XMPPException.StreamErrorException)1 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)1 Stanza (org.jivesoftware.smack.packet.Stanza)1 ParsingExceptionCallback (org.jivesoftware.smack.parsing.ParsingExceptionCallback)1