qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1619317 - /qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
Date Thu, 21 Aug 2014 08:57:40 GMT
Author: rgodfrey
Date: Thu Aug 21 08:57:39 2014
New Revision: 1619317

URL: http://svn.apache.org/r1619317
Log:
QPID-6027 : Sort children in the Json store by name

Modified:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java?rev=1619317&r1=1619316&r2=1619317&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
(original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
Thu Aug 21 08:57:39 2014
@@ -432,9 +432,13 @@ public class JsonFileConfigStore impleme
                     SortedSet<ConfiguredObjectRecord> sortedChildren = new TreeSet<>(new
Comparator<ConfiguredObjectRecord>()
                     {
                         @Override
-                        public int compare(final ConfiguredObjectRecord o1, final ConfiguredObjectRecord
o2)
+                        public int compare(final ConfiguredObjectRecord left, final ConfiguredObjectRecord
right)
                         {
-                            return ((String)o1.getAttributes().get(ConfiguredObject.NAME)).compareTo(((String)o2.getAttributes().get(ConfiguredObject.NAME)));
+                            String leftName = (String) left.getAttributes().get(ConfiguredObject.NAME);
+                            String rightName = (String) right.getAttributes().get(ConfiguredObject.NAME);
+                            return leftName == null
+                                    ?  -1
+                                    : rightName == null ? 1 : leftName.compareTo(rightName);
                         }
                     });
                     for(UUID childId : childIds)



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


Mime
View raw message