1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +01:00

Use SmackWrappedException where sensible

This commit is contained in:
Florian Schmaus 2019-02-10 19:05:55 +01:00
parent b7d6edcd1e
commit bb759a136e
2 changed files with 6 additions and 5 deletions

View file

@ -900,7 +900,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
openStream(); openStream();
} }
catch (Exception e) { catch (Exception e) {
SmackException smackException = new SmackException(e); SmackException.SmackWrappedException smackException = new SmackException.SmackWrappedException(e);
tlsHandled.reportFailure(smackException); tlsHandled.reportFailure(smackException);
throw e; throw e;
} }
@ -985,7 +985,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
if (!smEnabledSyncPoint.requestSent()) { if (!smEnabledSyncPoint.requestSent()) {
throw new IllegalStateException("Failed element received but SM was not previously enabled"); 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 // Report success for last lastFeaturesReceived so that in case a
// failed resumption, we can continue with normal resource binding. // failed resumption, we can continue with normal resource binding.
// See text of XEP-198 5. below Example 11. // See text of XEP-198 5. below Example 11.

View file

@ -1000,7 +1000,8 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
@Override @Override
protected TransitionIntoResult transitionInto(WalkStateGraphContext walkStateGraphContext) 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); sendAndWaitForResponse(StartTls.INSTANCE, TlsProceed.class, TlsFailure.class);
SmackTlsContext smackTlsContext; SmackTlsContext smackTlsContext;
@ -1008,7 +1009,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
smackTlsContext = getSmackTlsContext(); smackTlsContext = getSmackTlsContext();
} catch (KeyManagementException | UnrecoverableKeyException | NoSuchAlgorithmException } catch (KeyManagementException | UnrecoverableKeyException | NoSuchAlgorithmException
| CertificateException | KeyStoreException | NoSuchProviderException e) { | CertificateException | KeyStoreException | NoSuchProviderException e) {
throw new SmackException(e); throw new SmackWrappedException(e);
} }
tlsState = new TlsState(smackTlsContext); tlsState = new TlsState(smackTlsContext);
@ -1028,7 +1029,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
try { try {
tlsState.waitForHandshakeFinished(); tlsState.waitForHandshakeFinished();
} catch (CertificateException e) { } catch (CertificateException e) {
throw new SmackException(e); throw new SmackWrappedException(e);
} }
newStreamOpenWaitForFeaturesSequence("stream features after TLS established"); newStreamOpenWaitForFeaturesSequence("stream features after TLS established");