mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
Shrink try body in XmppHostnameVerifier
This commit is contained in:
parent
19c797777e
commit
a73dcd6f53
1 changed files with 8 additions and 7 deletions
|
@ -78,8 +78,14 @@ 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();
|
||||||
|
}
|
||||||
|
catch (SSLPeerUnverifiedException e2) {
|
||||||
|
LOGGER.log(Level.INFO, "Can't verify principal for " + hostname + ". Not kerberos",
|
||||||
|
e2);
|
||||||
|
}
|
||||||
if (peerPrincipal instanceof KerberosPrincipal) {
|
if (peerPrincipal instanceof KerberosPrincipal) {
|
||||||
validPrincipal = match(hostname, (KerberosPrincipal) peerPrincipal);
|
validPrincipal = match(hostname, (KerberosPrincipal) peerPrincipal);
|
||||||
}
|
}
|
||||||
|
@ -87,11 +93,6 @@ public class XmppHostnameVerifier implements HostnameVerifier {
|
||||||
LOGGER.info("Can't verify principal for " + hostname + ". Not kerberos");
|
LOGGER.info("Can't verify principal for " + hostname + ". Not kerberos");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SSLPeerUnverifiedException e2) {
|
|
||||||
LOGGER.log(Level.INFO, "Can't verify principal for " + hostname + ". Not kerberos",
|
|
||||||
e2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return validCertificate || validPrincipal;
|
return validCertificate || validPrincipal;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue