You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ck...@apache.org on 2007/01/20 16:18:42 UTC

svn commit: r498122 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java

Author: ckormos
Date: Sat Jan 20 07:18:42 2007
New Revision: 498122

URL: http://svn.apache.org/viewvc?view=rev&rev=498122
Log:
moved string locale-sesitive comparation before comparing values as Comparable.

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java?view=diff&rev=498122&r1=498121&r2=498122
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java Sat Jan 20 07:18:42 2007
@@ -362,17 +362,18 @@
             // even if the underlying object is not a Comparable.
             // This happens if the object at rowIndex zero is null.
             // So test before we cast:
-            if (value1 instanceof Comparable) 
-            {
-                return ((Comparable) value1).compareTo(value2);
-            } 
-            else if (value1 instanceof String) {
+            
+            if (value1 instanceof String) {
             	//if the object is a String we best compare locale-sesitive
             	CollationKey collationKey1 = getCollationKey((String)value1);
             	CollationKey collationKey2 = getCollationKey((String)value2);
             	
             	return collationKey1.compareTo(collationKey2);
             }
+            else if (value1 instanceof Comparable) 
+            {
+                return ((Comparable) value1).compareTo(value2);
+            } 
             else 
             {
                 // if the object is not a Comparable, then