Comparable comparator thows exceptions if either arg in the comparison is not 
Comparable. However, the strings reverse which argument is incorrect, 
claiming the first when it's o2, and the second when it's o1.

? .classpath
? .project
? .vcm_meta
? maven.log
? target
? src/java/org/apache/commons/collections/AbstractBag.java
Index: src/java/org/apache/commons/collections/comparators/ComparableComparator.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/collections/src/java/org/apache/commons/collections/comparators/ComparableComparator.java,v
retrieving revision 1.5
diff -u -w -r1.5 ComparableComparator.java
--- src/java/org/apache/commons/collections/comparators/ComparableComparator.java	12 Jun 2002 03:59:17 -0000	1.5
+++ src/java/org/apache/commons/collections/comparators/ComparableComparator.java	6 Oct 2002 01:29:16 -0000
@@ -121,7 +121,7 @@
             } else {
                 // o2 wasn't comparable
                 throw new ClassCastException(
-                    "The first argument of this method was not a Comparable: " +
+                    "The second argument of this method was not a Comparable: " +
                     o2.getClass().getName()
                     );
             }
@@ -129,13 +129,13 @@
         if(o2 instanceof Comparable) {
             // o1 wasn't comparable
             throw new ClassCastException(
-                "The second argument of this method was not a Comparable: " +
+                "The first argument of this method was not a Comparable: " +
                 o1.getClass().getName()
                 );
         } else {
             // neither were comparable
             throw new ClassCastException(
-                "Both arguments of this method were not Comparables: " +
+                "Neither argument of this method was a Comparable: " +
                 o1.getClass().getName() + " and " + o2.getClass().getName()
                 );
         }

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to