Sort origins in WAYF list.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 23 Oct 2003 18:53:01 +0000 (18:53 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 23 Oct 2003 18:53:01 +0000 (18:53 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@776 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/wayf/Origin.java
src/edu/internet2/middleware/shibboleth/wayf/OriginSet.java

index af4bb91..2f6e83a 100755 (executable)
@@ -165,7 +165,11 @@ public class Origin implements Comparable {
         * @see java.lang.Comparable#compareTo(java.lang.Object)
         */
        public int compareTo(Object o) {
-                       return name.compareTo(((Origin)o).getDisplayName().toLowerCase());
+               int result = getDisplayName().toLowerCase().compareTo(((Origin) o).getDisplayName().toLowerCase());
+               if (result == 0) {
+                       result = getDisplayName().compareTo(((Origin) o).getDisplayName());
+               }
+               return result;
        }
 
 }
\ No newline at end of file
index 2c973fe..db3d0d9 100755 (executable)
@@ -50,7 +50,8 @@
 package edu.internet2.middleware.shibboleth.wayf;
 
 import java.util.Arrays;
-import java.util.HashSet;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import org.apache.log4j.Logger;
 
@@ -64,7 +65,7 @@ import org.apache.log4j.Logger;
 
 public class OriginSet {
 
-       private HashSet origins = new HashSet();
+       private SortedSet origins = new TreeSet();
        private static Logger log = Logger.getLogger(OriginSet.class.getName());
        private String name = "";