You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2016/05/31 19:09:24 UTC

[2/2] qpid-proton git commit: NO-JIRA: cleanup vhost handling issues found by Coverity

NO-JIRA: cleanup vhost handling issues found by Coverity


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/34ae9ea9
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/34ae9ea9
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/34ae9ea9

Branch: refs/heads/master
Commit: 34ae9ea9e856d15c483ed8b98582c3e0bc665a85
Parents: 9a7b2cf
Author: Ken Giusti <kg...@apache.org>
Authored: Tue May 31 13:35:23 2016 -0400
Committer: Ken Giusti <kg...@apache.org>
Committed: Tue May 31 15:02:55 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/34ae9ea9/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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org