Mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckor...@apache.org
Subject svn commit: r498122 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/component/html/ext/SortableModel.java
Date Sat, 20 Jan 2007 15:18:42 GMT
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



Mime
View raw message