[jsword-svn] r1319 - trunk/jsword/src/main/java/org/crosswire/jsword/passage

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Sun May 6 17:50:51 MST 2007


Author: dmsmith
Date: 2007-05-06 17:50:49 -0700 (Sun, 06 May 2007)
New Revision: 1319

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java
Log:
Fixed a GenBook bug that caused stack overflow


Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java	2007-05-06 15:36:35 UTC (rev 1318)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractKeyList.java	2007-05-07 00:50:49 UTC (rev 1319)
@@ -210,6 +210,18 @@
     {
         Key that = (Key) obj;
 
+        if (this == that)
+        {
+            return 0;
+        }
+
+        if (that == null)
+        {
+            // he is empty, we are not so he is greater
+            return -1;
+        }
+
+
         int ret = this.getName().compareTo(that.getName());
 
         if (ret != 0)
@@ -217,6 +229,7 @@
             return ret;
         }
 
+        // Compare the contents.
         Iterator thisIter = this.iterator();
         Iterator thatIter = that.iterator();
 
@@ -250,7 +263,7 @@
             return -1;
         }
 
-        return thisfirst.compareTo(thatfirst);
+        return thisfirst.getName().compareTo(thatfirst.getName());
     }
 
     /* (non-Javadoc)




More information about the jsword-svn mailing list