activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r985154 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/util/URISupport.java test/java/org/apache/activemq/util/URISupportTest.java
Date Fri, 13 Aug 2010 10:53:49 GMT
Author: dejanb
Date: Fri Aug 13 10:53:48 2010
New Revision: 985154

URL: http://svn.apache.org/viewvc?rev=985154&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2598 - additional fix

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/URISupportTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java?rev=985154&r1=985153&r2=985154&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/URISupport.java Fri
Aug 13 10:53:48 2010
@@ -125,7 +125,7 @@ public class URISupport {
     }
 
     public static Map<String, String> parseParameters(URI uri) throws URISyntaxException
{
-        if (uri.getQuery() != null) {
+        if (!isCompositeURI(uri)) {
             return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(),
"?"));
         } else {
             CompositeData data = URISupport.parseComposite(uri);
@@ -188,12 +188,28 @@ public class URISupport {
         CompositeData rc = new CompositeData();
         rc.scheme = uri.getScheme();
         String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim();
+        
 
         parseComposite(uri, rc, ssp);
 
         rc.fragment = uri.getFragment();
         return rc;
     }
+    
+    public static boolean isCompositeURI(URI uri) {
+        if (uri.getQuery() != null) {
+            return false;
+        } else {
+            String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "(").trim();
+            ssp = stripPrefix(ssp, "//").trim();
+            try {
+                new URI(ssp);
+            } catch (URISyntaxException e) {
+                return false;
+            }
+            return true;
+        }
+    }
 
     /**
      * @param uri

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/URISupportTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/URISupportTest.java?rev=985154&r1=985153&r2=985154&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/URISupportTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/URISupportTest.java
Fri Aug 13 10:53:48 2010
@@ -109,6 +109,8 @@ public class URISupportTest extends Test
         uri = new URI("static://http://localhost:61617?proxyHost=localhost&proxyPort=80");
         parameters = URISupport.parseParameters(uri);
         verifyParams(parameters);
+        uri = new URI("http://0.0.0.0:61616");
+        parameters = URISupport.parseParameters(uri);
     }
     
     private void verifyParams(Map<String,String> parameters) {



Mime
View raw message