mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
[core] Wrap current connection exception when re-throwing
Instead of directly throwing the current connection exception, wrap it, so we do not lose the stack trace of the thread invoking waitForConditionorThrowConnectionException().
This commit is contained in:
parent
3c5fb5810e
commit
9e5ac5a39a
5 changed files with 24 additions and 39 deletions
|
@ -889,8 +889,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
if (startTlsFeature != null) {
|
||||
if (startTlsFeature.required() && config.getSecurityMode() == SecurityMode.disabled) {
|
||||
SecurityRequiredByServerException smackException = new SecurityRequiredByServerException();
|
||||
currentSmackException = smackException;
|
||||
notifyWaitingThreads();
|
||||
setCurrentConnectionExceptionAndNotify(smackException);
|
||||
throw smackException;
|
||||
}
|
||||
|
||||
|
@ -1020,8 +1019,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
// situation. It is still possible to authenticate and
|
||||
// use the connection but using an uncompressed connection
|
||||
// TODO Parse failure stanza
|
||||
currentSmackException = new SmackException.SmackMessageException("Could not establish compression");
|
||||
notifyWaitingThreads();
|
||||
SmackException.SmackMessageException exception = new SmackException.SmackMessageException("Could not establish compression");
|
||||
setCurrentConnectionExceptionAndNotify(exception);
|
||||
break;
|
||||
default:
|
||||
parseAndProcessNonza(parser);
|
||||
|
|
|
@ -46,9 +46,11 @@ import javax.net.ssl.SSLSession;
|
|||
|
||||
import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.SecurityRequiredByClientException;
|
||||
import org.jivesoftware.smack.SmackException.SecurityRequiredByServerException;
|
||||
import org.jivesoftware.smack.SmackException.SmackCertificateException;
|
||||
import org.jivesoftware.smack.SmackException.SmackWrappedException;
|
||||
import org.jivesoftware.smack.SmackFuture;
|
||||
import org.jivesoftware.smack.SmackFuture.InternalSmackFuture;
|
||||
import org.jivesoftware.smack.SmackReactor.SelectionKeyAttachment;
|
||||
|
@ -1201,7 +1203,7 @@ public class XmppTcpTransportModule extends ModularXmppClientToServerConnectionM
|
|||
return handshakeStatus == TlsHandshakeStatus.successful || handshakeStatus == TlsHandshakeStatus.failed;
|
||||
}
|
||||
|
||||
private void waitForHandshakeFinished() throws InterruptedException, CertificateException, SSLException, SmackException, XMPPException {
|
||||
private void waitForHandshakeFinished() throws InterruptedException, CertificateException, SSLException, SmackWrappedException, NoResponseException {
|
||||
connectionInternal.waitForConditionOrThrowConnectionException(() -> isHandshakeFinished(), "TLS handshake to finish");
|
||||
|
||||
if (handshakeStatus == TlsHandshakeStatus.failed) {
|
||||
|
@ -1234,8 +1236,7 @@ public class XmppTcpTransportModule extends ModularXmppClientToServerConnectionM
|
|||
}
|
||||
|
||||
@Override
|
||||
public void waitUntilInputOutputClosed() throws IOException, CertificateException, InterruptedException,
|
||||
SmackException, XMPPException {
|
||||
public void waitUntilInputOutputClosed() throws IOException, CertificateException, InterruptedException, SmackWrappedException, NoResponseException {
|
||||
waitForHandshakeFinished();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue