[jsword-svn] r1439 - trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Sat Jun 23 21:21:11 MST 2007


Author: dmsmith
Date: 2007-06-23 21:21:11 -0700 (Sat, 23 Jun 2007)
New Revision: 1439

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
Log:
Created a hack for a data bug in the NET module.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java	2007-06-24 03:53:22 UTC (rev 1438)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java	2007-06-24 04:21:11 UTC (rev 1439)
@@ -55,7 +55,14 @@
         DataPolice.setKey(key);
         Element ele = null;
         Exception ex = null;
-        String clean = XMLUtil.cleanAllEntities(plain);
+        String clean = plain;
+
+        // FIXME(dms): this is a major HACK handling a problem with a badly encoded module.
+        if (book.getInitials().startsWith("NET") && plain.endsWith("</div>")) //$NON-NLS-1$ //$NON-NLS-2$
+        {
+            clean = clean.substring(0, plain.length() - 6);
+        }
+
         try
         {
             ele = parse(clean);
@@ -68,10 +75,28 @@
         {
             ex = e;
         }
-        finally
+
+        if (ele == null)
         {
-            // Make sure that other places don't report this problem
-            DataPolice.setKey(null);
+            clean = XMLUtil.cleanAllEntities(clean);
+    
+            try
+            {
+                ele = parse(clean);
+            }
+            catch (JDOMException e)
+            {
+                ex = e;
+            }
+            catch (IOException e)
+            {
+                ex = e;
+            }
+            finally
+            {
+                // Make sure that other places don't report this problem
+                DataPolice.setKey(null);
+            }
         }
 
         if (ex != null)




More information about the jsword-svn mailing list