svn commit: r935371 - in /ofbiz/trunk/framework/base/src/org/ofbiz/base/lang: ComparableRange.java test/ComparableRangeTests.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r935371 - in /ofbiz/trunk/framework/base/src/org/ofbiz/base/lang: ComparableRange.java test/ComparableRangeTests.java

adrianc
Author: adrianc
Date: Sun Apr 18 17:39:22 2010
New Revision: 935371

URL: http://svn.apache.org/viewvc?rev=935371&view=rev
Log:
Fixed a bug in ComparableRange.equals method, added test for same.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/ComparableRange.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/test/ComparableRangeTests.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/ComparableRange.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/ComparableRange.java?rev=935371&r1=935370&r2=935371&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/ComparableRange.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/ComparableRange.java Sun Apr 18 17:39:22 2010
@@ -73,7 +73,7 @@ public class ComparableRange<T extends C
         try {
             ComparableRange that = (ComparableRange) obj;
             return this.start.equals(that.start()) && this.end.equals(that.end());
-        } catch (ClassCastException e) {}
+        } catch (Exception e) {}
         return false;
     }
 

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/test/ComparableRangeTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/test/ComparableRangeTests.java?rev=935371&r1=935370&r2=935371&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/test/ComparableRangeTests.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/test/ComparableRangeTests.java Sun Apr 18 17:39:22 2010
@@ -76,6 +76,7 @@ public class ComparableRangeTests extend
         assertEquals(label + ":a-b equals b-a", first, new ComparableRange<T>(b, a));
         assertEquals(label + ":a-b.compareTo(new b-a)", 0, first.compareTo(new ComparableRange<T>(b, a)));
         assertNotEquals(label + ":a-b not-equal other", first, ComparableRangeTests.class);
+        assertFalse(label + ":a-d equals null", all.equals(null));
         ClassCastException caught = null;
         try {
             ((Comparable) first).compareTo(ComparableRangeTests.class);