From bb759a136e80e354891c0c7b21837a9724713e86 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 10 Feb 2019 19:05:55 +0100 Subject: [PATCH] Use SmackWrappedException where sensible --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 4 ++-- .../org/jivesoftware/smack/tcp/XmppNioTcpConnection.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index de7c03ff2..c28d60730 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -900,7 +900,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { openStream(); } catch (Exception e) { - SmackException smackException = new SmackException(e); + SmackException.SmackWrappedException smackException = new SmackException.SmackWrappedException(e); tlsHandled.reportFailure(smackException); throw e; } @@ -985,7 +985,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { if (!smEnabledSyncPoint.requestSent()) { throw new IllegalStateException("Failed element received but SM was not previously enabled"); } - smEnabledSyncPoint.reportFailure(new SmackException(xmppException)); + smEnabledSyncPoint.reportFailure(new SmackException.SmackWrappedException(xmppException)); // Report success for last lastFeaturesReceived so that in case a // failed resumption, we can continue with normal resource binding. // See text of XEP-198 5. below Example 11. diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppNioTcpConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppNioTcpConnection.java index e37b407c9..75529dcae 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppNioTcpConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppNioTcpConnection.java @@ -1000,7 +1000,8 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection { @Override protected TransitionIntoResult transitionInto(WalkStateGraphContext walkStateGraphContext) - throws SmackException, FailedNonzaException, IOException, InterruptedException { + throws SmackWrappedException, FailedNonzaException, IOException, InterruptedException, + ConnectionUnexpectedTerminatedException, NoResponseException, NotConnectedException { sendAndWaitForResponse(StartTls.INSTANCE, TlsProceed.class, TlsFailure.class); SmackTlsContext smackTlsContext; @@ -1008,7 +1009,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection { smackTlsContext = getSmackTlsContext(); } catch (KeyManagementException | UnrecoverableKeyException | NoSuchAlgorithmException | CertificateException | KeyStoreException | NoSuchProviderException e) { - throw new SmackException(e); + throw new SmackWrappedException(e); } tlsState = new TlsState(smackTlsContext); @@ -1028,7 +1029,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection { try { tlsState.waitForHandshakeFinished(); } catch (CertificateException e) { - throw new SmackException(e); + throw new SmackWrappedException(e); } newStreamOpenWaitForFeaturesSequence("stream features after TLS established");