qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1576413 - /qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/Address.java
Date Tue, 11 Mar 2014 16:33:46 GMT
Author: astitcher
Date: Tue Mar 11 16:33:46 2014
New Revision: 1576413

URL: http://svn.apache.org/r1576413
Log:
PROTON-506: Fix Java address URL parser to correctly identify the host component
if there is an '@' character in the path component.

Modified:
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/Address.java

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/Address.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/Address.java?rev=1576413&r1=1576412&r2=1576413&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/Address.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/messenger/impl/Address.java
Tue Mar 11 16:33:46 2014
@@ -56,35 +56,39 @@ class Address
 
         int start = 0;
         int schemeEnd = _address.indexOf("://", start);
-        if (schemeEnd > 0) {
+        if (schemeEnd >= 0) {
             _scheme = _address.substring(start, schemeEnd);
             start = schemeEnd + 3;
         }
 
-        int at = _address.indexOf('@', start);
-        if (at > 0) {
-            String up = _address.substring(start, at);
+        String uphp;
+        int slash = _address.indexOf("/", start);
+        if (slash > 0) {
+            uphp = _address.substring(start, slash);
+            _name = _address.substring(slash + 1);
+        } else {
+            uphp = _address.substring(start);
+        }
+
+        String hp;
+        int at = uphp.indexOf('@');
+        if (at >= 0) {
+            String up = uphp.substring(0, at);
+            hp = uphp.substring(at + 1);
+
             int colon = up.indexOf(':');
-            if (colon > 0) {
+            if (colon >= 0) {
                 _user = up.substring(0, colon);
                 _pass = up.substring(colon + 1);
             } else {
                 _user = up;
             }
-            start = at + 1;
-        }
-
-        int slash = _address.indexOf("/", start);
-        String hp;
-        if (slash > 0) {
-            hp = _address.substring(start, slash);
-            _name = _address.substring(slash + 1);
         } else {
-            hp = _address.substring(start);
+            hp = uphp;
         }
 
         int colon = hp.indexOf(':');
-        if (colon > 0) {
+        if (colon >= 0) {
             _host = hp.substring(0, colon);
             _port = hp.substring(colon + 1);
         } else {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message