dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42213
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21568: minor fix, correctly handle ignoreCase flag in in-memory ordering
------------------------------------------------------------
revno: 21568
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-01-04 16:50:01 +0700
message:
minor fix, correctly handle ignoreCase flag in in-memory ordering
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Order.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Order.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Order.java 2016-01-04 06:04:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/Order.java 2016-01-04 09:50:01 +0000
@@ -95,7 +95,10 @@
if ( String.class.isInstance( o1 ) && String.class.isInstance( o2 ) )
{
- return ascending ? ((String) o1).compareTo( (String) o2 ) : ((String) o2).compareTo( (String) o1 );
+ String value1 = ignoreCase ? ((String) o1).toLowerCase() : (String) o1;
+ String value2 = ignoreCase ? ((String) o2).toLowerCase() : (String) o2;
+
+ return ascending ? value1.compareTo( value2 ) : value2.compareTo( value1 );
}
if ( Boolean.class.isInstance( o1 ) && Boolean.class.isInstance( o2 ) )
{