Update of
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/util
In directory
james.mmbase.org:/tmp/cvs-serv13247/cmsc/utilities/src/java/com/finalist/cmsc/util
Modified Files:
NodeComparator.java
Log Message:
CMSC-1281 Assets: Relate URLs to content element - New search screen
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/util
See also: http://www.mmbase.org/jira/browse/CMSC-1281
Index: NodeComparator.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/util/NodeComparator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- NodeComparator.java 17 Dec 2008 10:07:01 -0000 1.3
+++ NodeComparator.java 26 Feb 2009 06:45:39 -0000 1.4
@@ -48,7 +48,7 @@
* The two message nodes will be compared using the compare function of
* the values of their fields.
* Only Comparable values can be used (String, Numbers, Date), as well as
- * Boolean values.
+ * Boolean values. Default null is less than any values.
* In other cases it's assumed that the values cannot be ordered.
* <br />
* Note: this class assumes that values in fields are of similar types
@@ -70,7 +70,7 @@
f2 = o2.getObjectValue(field);
if (f1 instanceof Comparable) {
try {
- result=((Comparable)f1).compareTo(f2);
+ result = (f2==null)? 1:((Comparable)f1).compareTo(f2);
} catch (ClassCastException e) {
// types do not compare -
// possibly the in-memory value type differs from the
@@ -79,10 +79,12 @@
// Solving this could bring this compare to a crawl, so we
// don't. Just edit stuff the right way.
}
- } else if (!f1.equals(f2)) {
+ } else if (f1 != null && !f1.equals(f2)) {
if (f1 instanceof Boolean) {
result=((Boolean)f1).booleanValue() ? 1 : -1;
}
+ } else if (f1 == null ){
+ result=-1;
}
fieldnr++;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs