[jsword-svn] r1791 - in trunk/jsword/src: main/java/org/crosswire/jsword/bridge test/java/org/crosswire/jsword/bridge

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Thu Apr 10 14:04:40 MST 2008


Author: dmsmith
Date: 2008-04-10 14:04:38 -0700 (Thu, 10 Apr 2008)
New Revision: 1791

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/bridge/DwrBridge.java
   trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java
Log:
Fixed a bug in DwrBridge, preventing lookup in a dictionary.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/bridge/DwrBridge.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/bridge/DwrBridge.java	2008-04-10 03:13:09 UTC (rev 1790)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/bridge/DwrBridge.java	2008-04-10 21:04:38 UTC (rev 1791)
@@ -261,17 +261,22 @@
         }
         else
         {
-            key = book.createEmptyKeyList();
+            key = book.getKey(reference);
             
-            Iterator iter = book.getKey(reference).iterator();
-            int count = 0;
-            while (iter.hasNext())
+            // Do we need to trim?
+            if (key.getCardinality() > maxKeyCount)
             {
-                if (++count >= maxKeyCount)
+                Iterator iter = key.iterator();
+                key = book.createEmptyKeyList();
+                int count = 0;
+                while (iter.hasNext())
                 {
-                    break;
+                    if (++count >= maxKeyCount)
+                    {
+                        break;
+                    }
+                    key.addAll((Key) iter.next());
                 }
-                key.addAll((Key) iter.next());
             }
         }
 

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java	2008-04-10 03:13:09 UTC (rev 1790)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/bridge/DwrBridgeTest.java	2008-04-10 21:04:38 UTC (rev 1791)
@@ -59,7 +59,7 @@
             String verse = dwrBridge.getOSISString("KJV", "Gen 1:1", 100); //$NON-NLS-1$ //$NON-NLS-2$
             assertEquals(verse, "<div><title type=\"x-gen\">Genesis 1:1</title><verse osisID=\"Gen.1.1\"><w lemma=\"strong:H07225\">In the beginning</w> <w lemma=\"strong:H0430\">God</w> <w lemma=\"strong:H0853 strong:H01254\" morph=\"strongMorph:TH8804\">created</w> <w lemma=\"strong:H08064\">the heaven</w> <w lemma=\"strong:H0853\">and</w> <w lemma=\"strong:H0776\">the earth</w>.</verse></div>"); //$NON-NLS-1$
             String hdef = dwrBridge.getOSISString("StrongsHebrew", "H07225", 100); //$NON-NLS-1$ //$NON-NLS-2$
-            assertEquals(hdef, "H07225"); //$NON-NLS-1$
+            assertEquals(hdef, "<div><title>07225</title> 7225  re'shiyth  ray-sheeth'\r<lb></lb>\r<lb></lb> from the same as 7218; the first, in place, time, order or\r<lb></lb> rank (specifically, a firstfruit):--beginning, chief(-est),\r<lb></lb> first(-fruits, part, time), principal thing.\r<lb></lb> see HEBREW for 07218</div>"); //$NON-NLS-1$
         }
         catch (BookException e)
         {




More information about the jsword-svn mailing list