1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

Shrink try body in XmppHostnameVerifier

This commit is contained in:
Florian Schmaus 2015-06-24 10:56:02 +02:00
parent 19c797777e
commit a73dcd6f53

View file

@ -78,19 +78,20 @@ public class XmppHostnameVerifier implements HostnameVerifier {
} }
catch (SSLPeerUnverifiedException e) { catch (SSLPeerUnverifiedException e) {
// Not using certificates for peers, try verifying the principal // Not using certificates for peers, try verifying the principal
Principal peerPrincipal = null;
try { try {
Principal peerPrincipal = session.getPeerPrincipal(); peerPrincipal = session.getPeerPrincipal();
if (peerPrincipal instanceof KerberosPrincipal) {
validPrincipal = match(hostname, (KerberosPrincipal) peerPrincipal);
}
else {
LOGGER.info("Can't verify principal for " + hostname + ". Not kerberos");
}
} }
catch (SSLPeerUnverifiedException e2) { catch (SSLPeerUnverifiedException e2) {
LOGGER.log(Level.INFO, "Can't verify principal for " + hostname + ". Not kerberos", LOGGER.log(Level.INFO, "Can't verify principal for " + hostname + ". Not kerberos",
e2); e2);
} }
if (peerPrincipal instanceof KerberosPrincipal) {
validPrincipal = match(hostname, (KerberosPrincipal) peerPrincipal);
}
else {
LOGGER.info("Can't verify principal for " + hostname + ". Not kerberos");
}
} }
return validCertificate || validPrincipal; return validCertificate || validPrincipal;