Repository: qpid-proton Updated Branches: refs/heads/0.13.x b937c85d2 -> a332fc7c5
NO-JIRA: cleanup vhost handling issues found by Coverity (cherry picked from commit 34ae9ea9e856d15c483ed8b98582c3e0bc665a85) Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a332fc7c Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a332fc7c Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a332fc7c Branch: refs/heads/0.13.x Commit: a332fc7c5a88b91667a0787575f249b15511c70c Parents: b937c85 Author: Ken Giusti <[email protected]> Authored: Tue May 31 13:35:23 2016 -0400 Committer: Ken Giusti <[email protected]> Committed: Wed Jun 1 11:04:01 2016 -0400 ---------------------------------------------------------------------- .../java/org/apache/qpid/proton/reactor/impl/IOHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a332fc7c/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java index c0e51d5..30ad246 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/IOHandler.java @@ -87,9 +87,12 @@ public class IOHandler extends BaseHandler { if (vhost == null) { // setHostname never called, use the host from the connection's // socket address as the default virtual host: - Address addr = new Address(reactor.getConnectionAddress(connection)); - connection.setHostname(addr.getHost()); - } else if (vhost == "") { + String conAddr = reactor.getConnectionAddress(connection); + if (conAddr != null) { + Address addr = new Address(conAddr); + connection.setHostname(addr.getHost()); + } + } else if (vhost.isEmpty()) { // setHostname called explictly with a null string. This allows // the application to completely avoid sending a virtual host // name --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
