You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2016/04/04 18:08:31 UTC

[1/2] activemq-artemis git commit: This closes #435

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 01d6e2608 -> 7e80cc358


This closes #435


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7e80cc35
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7e80cc35
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7e80cc35

Branch: refs/heads/master
Commit: 7e80cc3586cefe49c8d0a61cdbd4c31c958c1ca7
Parents: 01d6e26 2788eaa
Author: jbertram <jb...@apache.org>
Authored: Mon Apr 4 11:08:18 2016 -0500
Committer: jbertram <jb...@apache.org>
Committed: Mon Apr 4 11:08:18 2016 -0500

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/utils/uri/URISupport.java   | 9 ++++++---
 .../org/apache/activemq/artemis/utils/URIParserTest.java    | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: Put parameters into query string in a predictable order

Posted by jb...@apache.org.
Put parameters into query string in a predictable order

Previously, the order of query parameters depended on the iteration order of items in a Set.
This order is undefined for some Sets. Nevertheless, unit test for createQueryString expected
that query parameters are in a particular order.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2788eaa1
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2788eaa1
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2788eaa1

Branch: refs/heads/master
Commit: 2788eaa1bfdc4ccc76c2dbfa670a2bf88cf33608
Parents: 01d6e26
Author: Jiri Danek <jd...@redhat.com>
Authored: Thu Mar 31 23:18:17 2016 +0200
Committer: jbertram <jb...@apache.org>
Committed: Mon Apr 4 11:08:18 2016 -0500

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/utils/uri/URISupport.java   | 9 ++++++---
 .../org/apache/activemq/artemis/utils/URIParserTest.java    | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2788eaa1/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java
index 7cbfeaa..d03f2f0 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISupport.java
@@ -463,7 +463,7 @@ public class URISupport {
 
    /**
     * Given a key / value mapping, create and return a URI formatted query string that is valid and
-    * can be appended to a URI.
+    * can be appended to a URI. Query parameters in the string are sorted by key.
     *
     * @param options The Mapping that will create the new Query string.
     * @return a URI formatted query string.
@@ -472,9 +472,12 @@ public class URISupport {
    public static String createQueryString(Map<String, ? extends Object> options) throws URISyntaxException {
       try {
          if (options.size() > 0) {
-            StringBuffer rc = new StringBuffer();
+            StringBuilder rc = new StringBuilder();
             boolean first = true;
-            for (String key : options.keySet()) {
+            List<String> keys = new ArrayList<String>();
+            keys.addAll(options.keySet());
+            Collections.sort(keys);
+            for (String key : keys) {
                if (first) {
                   first = false;
                }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2788eaa1/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/URIParserTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/URIParserTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/URIParserTest.java
index 71a7833..d4e9950 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/URIParserTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/URIParserTest.java
@@ -114,12 +114,12 @@ public class URIParserTest {
       System.out.println("queryString2: " + queryString);
       Assert.assertEquals("key1=value1", queryString);
 
-      query.put("key2", "value2");
+      query.put("key3", "value3");
       queryString = URISupport.createQueryString(query);
       System.out.println("queryString3: " + queryString);
-      Assert.assertEquals("key1=value1&key2=value2", queryString);
+      Assert.assertEquals("key1=value1&key3=value3", queryString);
 
-      query.put("key3", "value3");
+      query.put("key2", "value2");
       queryString = URISupport.createQueryString(query);
       System.out.println("queryString4: " + queryString);
       Assert.assertEquals("key1=value1&key2=value2&key3=value3", queryString);