diff options
author | Nick Hudson <nick.hudson@isode.com> | 2012-03-19 17:43:01 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-03-29 15:59:06 (GMT) |
commit | 1cf764950ad4675b9192a1d76e422415e377216b (patch) | |
tree | a8761107481e7573b74c30622be650ea36bdc191 /src | |
parent | c194f7d215935cded5b2eab4daeed725a5a4069c (diff) | |
download | stroke-1cf764950ad4675b9192a1d76e422415e377216b.zip stroke-1cf764950ad4675b9192a1d76e422415e377216b.tar.bz2 |
Make CoreClient.getSessionCertificate more robust
The javadoc for the method was not in line with its behaviour, so you
could get a NullPointerException if you asked for a session
certificate when the session wasn't TLS.
This patch makes the code do what the javadoc says (and what clients
most likely want)
Test-information:
Returns null rather than crashing when I ask for a certificate on a
non-TLS stream.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/isode/stroke/client/CoreClient.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/isode/stroke/client/CoreClient.java b/src/com/isode/stroke/client/CoreClient.java index 453307e..eca9fda 100644 --- a/src/com/isode/stroke/client/CoreClient.java +++ b/src/com/isode/stroke/client/CoreClient.java @@ -420,7 +420,7 @@ public class CoreClient { * @return the peer certificate, if one is available, otherwise null. */ public Certificate getSessionCertificate() { - return (sessionStream_ == null ? null : sessionStream_.getPeerCertificate()); + return (isSessionTLSEncrypted() ? sessionStream_.getPeerCertificate() : null); } |