[jsword-svn] r1152 - in trunk/jsword: etc/eclipse src/main/java/org/crosswire/jsword/book src/main/java/org/crosswire/jsword/book/basic src/main/java/org/crosswire/jsword/book/filter src/main/java/org/crosswire/jsword/book/filter/gbf src/main/java/org/crosswire/jsword/book/filter/osis src/main/java/org/crosswire/jsword/book/filter/thml src/main/java/org/crosswire/jsword/book/install src/main/java/org/crosswire/jsword/book/install/sword src/main/java/org/crosswire/jsword/book/readings src/main/java/org/crosswire/jsword/book/sword src/main/java/org/crosswire/jsword/examples src/main/java/org/crosswire/jsword/index src/main/java/org/crosswire/jsword/index/lucene src/main/java/org/crosswire/jsword/index/query src/main/java/org/crosswire/jsword/index/search src/main/java/org/crosswire/jsword/passage src/main/java/org/crosswire/jsword/util src/main/java/org/crosswire/jsword/versification src/test/java src/test/java/org/crosswire/jsword/book/test src/test/java/org/crosswire/jsword/passage

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Tue Oct 10 16:32:07 MST 2006


Author: dmsmith
Date: 2006-10-10 16:30:55 -0700 (Tue, 10 Oct 2006)
New Revision: 1152

Modified:
   trunk/jsword/etc/eclipse/jsword-ant-all.launch
   trunk/jsword/src/main/java/org/crosswire/jsword/book/BookFilters.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/BookSet.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/install/InstallManager.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BookType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GZIPBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java
   trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryBuilderFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryDecoratorFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/search/SearcherFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.properties
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
   trunk/jsword/src/main/java/org/crosswire/jsword/util/ConverterFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
   trunk/jsword/src/test/java/Bench.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java
   trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
Log:
Fixing bugs reported by findbugs.

Modified: trunk/jsword/etc/eclipse/jsword-ant-all.launch
===================================================================
--- trunk/jsword/etc/eclipse/jsword-ant-all.launch	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/etc/eclipse/jsword-ant-all.launch	2006-10-10 23:30:55 UTC (rev 1152)
@@ -3,11 +3,18 @@
 <stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
 <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.5.0-sun-1.5.0.08"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/jsword}"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
 <stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_TYPE_ID" value="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_NAME" value="jdk-1.4.2"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jsword"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_NAME" value="java-1.5.0-sun-1.5.0.08"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/jsword/build.xml"/>
+</listAttribute>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/jsword/build.xml}"/>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/jsword}"/>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
 </launchConfiguration>

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookFilters.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookFilters.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookFilters.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,6 +21,7 @@
  */
 package org.crosswire.jsword.book;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
@@ -353,7 +354,7 @@
                     test.property = Book.class.getMethod(gettername, (Class[]) null);
                     test.result = parts[1];
                 }
-                catch (Exception ex)
+                catch (NoSuchMethodException ex)
                 {
                     throw new IllegalArgumentException("Missing property: " + parts[0] + " in Book"); //$NON-NLS-1$ //$NON-NLS-2$
                 }
@@ -380,11 +381,21 @@
                         return false;
                     }
                 }
-                catch (Exception ex)
+                catch (IllegalArgumentException e)
                 {
-                    log.warn("Error while testing property " + test.property.getName() + " on " + book.getName(), ex); //$NON-NLS-1$ //$NON-NLS-2$
+                    log.warn("Error while testing property " + test.property.getName() + " on " + book.getName(), e); //$NON-NLS-1$ //$NON-NLS-2$
                     return false;
                 }
+                catch (IllegalAccessException e)
+                {
+                    log.warn("Error while testing property " + test.property.getName() + " on " + book.getName(), e); //$NON-NLS-1$ //$NON-NLS-2$
+                    return false;
+                }
+                catch (InvocationTargetException e)
+                {
+                    log.warn("Error while testing property " + test.property.getName() + " on " + book.getName(), e); //$NON-NLS-1$ //$NON-NLS-2$
+                    return false;
+                }
             }
 
             return true;
@@ -395,7 +406,7 @@
         /**
          *
          */
-        class Test
+        static class Test
         {
             protected String result;
             protected Method property;
@@ -405,5 +416,5 @@
     /**
      * The log stream
      */
-    protected static final Logger log = Logger.getLogger(BookFilters.class);
+    static final Logger log = Logger.getLogger(BookFilters.class);
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookSet.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookSet.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookSet.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -25,7 +25,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -40,7 +39,7 @@
  *      The copyright to this program is held by it's authors.
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
-public class BookSet extends ArrayList implements List, Set
+public class BookSet extends ArrayList implements Set
 {
     public BookSet()
     {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,6 +21,7 @@
  */
 package org.crosswire.jsword.book;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -388,38 +389,48 @@
      */
     protected void autoRegister()
     {
-        // URL predicturl = Project.instance().getWritablePropertiesURL("books"); //$NON-NLS-1$
-        // Job job = JobManager.createJob(Msg.JOB_TITLE.toString(), predicturl, null, true);
+        // URL predicturl =
+        // Project.instance().getWritablePropertiesURL("books"); //$NON-NLS-1$
+        // Job job = JobManager.createJob(Msg.JOB_TITLE.toString(), predicturl,
+        // null, true);
 
-        try
+        // This will classload them all and they will register themselves.
+        Class[] types = ClassUtil.getImplementors(BookDriver.class);
+
+        log.debug("begin auto-registering " + types.length + " drivers:"); //$NON-NLS-1$ //$NON-NLS-2$
+
+        for (int i = 0; i < types.length; i++)
         {
-            // This will classload them all and they will register themselves.
-            Class[] types = ClassUtil.getImplementors(BookDriver.class);
+            // job.setProgress(Msg.JOB_DRIVER.toString() +
+            // ClassUtils.getShortClassName(types[i]));
 
-            log.debug("begin auto-registering " + types.length + " drivers:"); //$NON-NLS-1$ //$NON-NLS-2$
-
-            for (int i = 0; i < types.length; i++)
+            try
             {
-                //job.setProgress(Msg.JOB_DRIVER.toString() + ClassUtils.getShortClassName(types[i]));
-
-                try
-                {
-                    Method driverInstance = types[i].getMethod("instance", new Class[0]); //$NON-NLS-1$
-//                    Object retval = driverInstance.invoke(null, new Object[0]);
-                    BookDriver driver = (BookDriver) driverInstance.invoke(null, new Object[0]); //types[i].newInstance();
-                    registerDriver(driver);
-                }
-                catch (Exception ex)
-                {
-                    Reporter.informUser(Books.class, ex);
-                }
+                Method driverInstance = types[i].getMethod("instance", new Class[0]); //$NON-NLS-1$
+                BookDriver driver = (BookDriver) driverInstance.invoke(null, new Object[0]); // types[i].newInstance();
+                registerDriver(driver);
             }
+            catch (NoSuchMethodException e)
+            {
+                Reporter.informUser(Books.class, e);
+            }
+            catch (IllegalArgumentException e)
+            {
+                Reporter.informUser(Books.class, e);
+            }
+            catch (IllegalAccessException e)
+            {
+                Reporter.informUser(Books.class, e);
+            }
+            catch (InvocationTargetException e)
+            {
+                Reporter.informUser(Books.class, e);
+            }
+            catch (BookException e)
+            {
+                Reporter.informUser(Books.class, e);
+            }
         }
-        catch (Exception ex)
-        {
-            log.debug("Unexpected exception: " + ex); //$NON-NLS-1$
-            // job.ignoreTimings();
-        }
     }
 
     /**
@@ -448,7 +459,7 @@
     /**
      * The log stream
      */
-    protected static final Logger log = Logger.getLogger(Books.class);
+    private static final Logger log = Logger.getLogger(Books.class);
 
     /**
      * The singleton instance.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/DataPolice.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -95,5 +95,5 @@
     /**
      * The log stream
      */
-    protected static final Logger log = Logger.getLogger(DataPolice.class);
+    private static final Logger log = Logger.getLogger(DataPolice.class);
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/OSISUtil.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -755,19 +755,11 @@
     private static void recurseChildren(Element ele, StringBuffer buffer)
     {
         // ele is a JDOM Element that might have a getContent() method
-        try
+        Iterator contentIter = ele.getContent().iterator();
+        while (contentIter.hasNext())
         {
-            Iterator contentIter = ele.getContent().iterator();
-            while (contentIter.hasNext())
-            {
-                Object sub = contentIter.next();
-                recurseElement(sub, buffer);
-            }
+            Object sub = contentIter.next();
+            recurseElement(sub, buffer);
         }
-        catch (Exception ex)
-        {
-            // We can continue, but we should report a problem
-            log.error("Error interrogating: " + ele.getClass().getName(), ex); //$NON-NLS-1$
-        }
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -54,6 +54,11 @@
  */
 public abstract class AbstractBook implements Book
 {
+    public AbstractBook(BookMetaData bmd)
+    {
+        setBookMetaData(bmd);
+    }
+
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.Book#getBookMetaData()
      */
@@ -125,7 +130,7 @@
      */
     public BookDriver getDriver()
     {
-        return bmd.getDriver();
+        return bmd == null ? null : bmd.getDriver();
     }
 
     /* (non-Javadoc)
@@ -133,7 +138,7 @@
      */
     public String getDriverName()
     {
-        return bmd.getDriverName();
+        return bmd == null ? null : bmd.getDriverName();
     }
 
     /* (non-Javadoc)
@@ -316,23 +321,22 @@
                 return;
             }
 
-            if (listeners != null)
+            Object[] listenerList = listeners.getListenerList();
+            for (int i = 0; i <= listenerList.length - 2; i += 2)
             {
-                Object[] listenerList = listeners.getListenerList();
-                for (int i = 0; i <= listenerList.length - 2; i += 2)
+                if (listenerList[i] == PropertyChangeListener.class)
                 {
-                    if (listenerList[i] == PropertyChangeListener.class)
-                    {
-                        IndexStatusEvent ev = new IndexStatusEvent(this, newStatus);
-                        IndexStatusListener li = (IndexStatusListener) listenerList[i + 1];
-                        li.statusChanged(ev);
-                    }
+                    IndexStatusEvent ev = new IndexStatusEvent(this, newStatus);
+                    IndexStatusListener li = (IndexStatusListener) listenerList[i + 1];
+                    li.statusChanged(ev);
                 }
             }
         }
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.crosswire.jsword.book.BookMetaData#toOSIS()
      */
     public Document toOSIS()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractPassageBook.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -27,8 +27,10 @@
 import org.crosswire.common.util.Logger;
 import org.crosswire.jsword.book.BookData;
 import org.crosswire.jsword.book.BookException;
+import org.crosswire.jsword.book.BookMetaData;
 import org.crosswire.jsword.book.OSISUtil;
 import org.crosswire.jsword.book.filter.Filter;
+import org.crosswire.jsword.book.filter.FilterException;
 import org.crosswire.jsword.passage.Key;
 import org.crosswire.jsword.passage.KeyFactory;
 import org.crosswire.jsword.passage.KeyUtil;
@@ -50,6 +52,11 @@
  */
 public abstract class AbstractPassageBook extends AbstractBook
 {
+    public AbstractPassageBook(BookMetaData bmd)
+    {
+        super(bmd);
+    }
+
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.Book#getData(org.crosswire.jsword.passage.Key)
      */
@@ -97,7 +104,7 @@
             BookData bdata = new BookData(osis, this, key);
             return bdata;
         }
-        catch (Exception ex)
+        catch (FilterException ex)
         {
             throw new BookException(Msg.FILTER_FAIL, ex);
         }
@@ -191,7 +198,7 @@
         {
             return getKey(name);
         }
-        catch (Exception e)
+        catch (NoSuchKeyException e)
         {
             return createEmptyKeyList();
         }
@@ -222,39 +229,32 @@
     {
         assert key != null;
 
-        try
+        StringBuffer buffer = new StringBuffer();
+
+        // For all the ranges in this Passage
+        Passage ref = KeyUtil.getPassage(key);
+        Iterator rit = ref.rangeIterator(RestrictionType.CHAPTER);
+
+        while (rit.hasNext())
         {
-            StringBuffer buffer = new StringBuffer();
+            VerseRange range = (VerseRange) rit.next();
 
-            // For all the ranges in this Passage
-            Passage ref = KeyUtil.getPassage(key);
-            Iterator rit = ref.rangeIterator(RestrictionType.CHAPTER);
-
-            while (rit.hasNext())
+            // For all the verses in this range
+            Iterator vit = range.iterator();
+            while (vit.hasNext())
             {
-                VerseRange range = (VerseRange) rit.next();
+                Verse verse = (Verse) vit.next();
+                String txt = getText(verse);
 
-                // For all the verses in this range
-                Iterator vit = range.iterator();
-                while (vit.hasNext())
+                // If the verse is empty then we shouldn't add the verse
+                if (txt.length() > 0)
                 {
-                    Verse verse = (Verse) vit.next();
-                    String txt = getText(verse);
-
-                    // If the verse is empty then we shouldn't add the verse
-                    if (txt.length() > 0)
-                    {
-                        buffer.append(txt);
-                        buffer.append('\n');
-                    }
+                    buffer.append(txt);
+                    buffer.append('\n');
                 }
             }
+        }
 
-            return buffer.toString();
-        }
-        catch (Exception ex)
-        {
-            throw new BookException(Msg.FILTER_FAIL, ex);
-        }
+        return buffer.toString();
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/FilterFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -73,10 +73,14 @@
             Class cdeft = (Class) map.remove("default"); //$NON-NLS-1$
             deft = (Filter) cdeft.newInstance();
         }
-        catch (Exception ex)
+        catch (InstantiationException e)
         {
-            log.fatal("Failed to get default filter, will attempt to use first", ex); //$NON-NLS-1$
+            log.fatal("Failed to get default filter, will attempt to use first", e); //$NON-NLS-1$
         }
+        catch (IllegalAccessException e)
+        {
+            log.fatal("Failed to get default filter, will attempt to use first", e); //$NON-NLS-1$
+        }
 
         // the lookup table
         for (Iterator it = map.entrySet().iterator(); it.hasNext(); )
@@ -88,10 +92,14 @@
                 Filter instance = (Filter) clazz.newInstance();
                 addFilter((String) entry.getKey(), instance);
             }
-            catch (Exception ex)
+            catch (InstantiationException ex)
             {
                 log.error("Failed to add filter", ex); //$NON-NLS-1$
             }
+            catch (IllegalAccessException ex)
+            {
+                log.error("Failed to add filter", ex); //$NON-NLS-1$
+            }
         }
 
         // if the default didn't work then make a stab at an answer

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/gbf/GBFTags.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -721,10 +721,10 @@
     /**
      * To convert strings into Biblical keys.
      */
-    protected static final KeyFactory KEY_FACTORY = PassageKeyFactory.instance();
+    static final KeyFactory KEY_FACTORY = PassageKeyFactory.instance();
 
     /**
      * To create OSIS DOM nodes.
      */
-    protected static final OSISFactory OSIS_FACTORY = OSISUtil.factory();
+    static final OSISFactory OSIS_FACTORY = OSISUtil.factory();
 }

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	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -53,49 +53,69 @@
     {
         DataPolice.setKey(key);
         Element ele = null;
+        Exception ex = null;
         try
         {
             ele = parse(XMLUtil.cleanAllEntities(plain));
         }
-        catch (Exception ex1)
+        catch (JDOMException e)
         {
-            DataPolice.report("Parse failed: " + ex1.getMessage() + //$NON-NLS-1$
-                              "\non: " + plain); //$NON-NLS-1$
-
-            // So just try to strip out all XML looking things
-            String shawn = XMLUtil.cleanAllTags(plain);
-
-            try
-            {
-                ele = parse(shawn);
-            }
-            catch (Exception ex2)
-            {
-                log.warn("Could not fix it by cleaning tags: " + ex2.getMessage()); //$NON-NLS-1$
-
-                try
-                {
-                    ele = OSISUtil.factory().createP();
-                    ele.addContent(plain);
-                }
-                catch (Exception ex4)
-                {
-                    log.warn("no way. say it ain't so! " + ex4.getMessage()); //$NON-NLS-1$
-                }
-            }
+            ex = e;
         }
+        catch (IOException e)
+        {
+            ex = e;
+        }
         finally
         {
-            if (ele == null)
+            if (ex != null)
             {
-                ele = OSISUtil.factory().createP();
+                DataPolice.report("Parse failed: " + ex.getMessage() + //$NON-NLS-1$
+                                  "\non: " + plain); //$NON-NLS-1$
             }
             // Make sure that other places don't report this problem
             DataPolice.setKey(null);
         }
+
+        if (ex != null)
+        {
+            ele = cleanTags(plain);
+        }
+
+        if (ele == null)
+        {
+            ele = OSISUtil.factory().createP();
+        }
+
         return ele.removeContent();
     }
 
+    private Element cleanTags(String plain)
+    {
+        // So just try to strip out all XML looking things
+        String shawn = XMLUtil.cleanAllTags(plain);
+        Exception ex = null;
+        try
+        {
+            return parse(shawn);
+        }
+        catch (JDOMException e)
+        {
+            ex = e;
+        }
+        catch (IOException e)
+        {
+            ex = e;
+        }
+
+        if (ex != null)
+        {
+            log.warn("Could not fix it by cleaning tags: " + ex.getMessage()); //$NON-NLS-1$
+        }
+
+        return null;
+    }
+
     /**
      * If the string is invalid then we might want to have more than one
      * crack at parsing it

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -25,7 +25,6 @@
 import java.io.StringReader;
 import java.util.List;
 
-import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
@@ -62,53 +61,81 @@
     {
         DataPolice.setKey(key);
         Element ele = null;
+        Exception ex = null;
         try
         {
             ele = parse(XMLUtil.cleanAllEntities(plain));
         }
-        catch (Exception ex1)
+        catch (SAXException e)
         {
-            DataPolice.report("Parse failed: " + ex1.getMessage() + //$NON-NLS-1$
-                              "\non: " + plain); //$NON-NLS-1$
-
-            // So just try to strip out all XML looking things
-            String shawn = XMLUtil.cleanAllTags(plain);
-
-            try
-            {
-                ele = parse(shawn);
-            }
-            catch (Exception ex2)
-            {
-                log.warn("Could not fix it by cleaning tags: " + ex2.getMessage()); //$NON-NLS-1$
-
-                try
-                {
-                    ele = OSISUtil.factory().createP();
-                    ele.addContent(plain);
-                }
-                catch (Exception ex4)
-                {
-                    log.warn("no way. say it ain't so! " + ex4.getMessage()); //$NON-NLS-1$
-                }
-            }
+            ex = e;
         }
+        catch (IOException e)
+        {
+            ex = e;
+        }
+        catch (ParserConfigurationException e)
+        {
+            ex = e;
+        }
         finally
         {
-            if (ele == null)
+            if (ex != null)
             {
-                ele = OSISUtil.factory().createP();
+                DataPolice.report("Parse failed: " + ex.getMessage() + //$NON-NLS-1$
+                                  "\non: " + plain); //$NON-NLS-1$
             }
             // Make sure that other places don't report this problem
             DataPolice.setKey(null);
         }
+
+        if (ex != null)
+        {
+            ele = cleanTags(plain);
+        }
+
+        if (ele == null)
+        {
+            ele = OSISUtil.factory().createP();
+        }
+
         return ele.removeContent();
     }
 
+    private Element cleanTags(String plain)
+    {
+        // So just try to strip out all XML looking things
+        String shawn = XMLUtil.cleanAllTags(plain);
+        Exception ex = null;
+        try
+        {
+            return parse(shawn);
+        }
+        catch (SAXException e)
+        {
+            ex = e;
+        }
+        catch (IOException e)
+        {
+            ex = e;
+        }
+        catch (ParserConfigurationException e)
+        {
+            ex = e;
+        }
+
+        if (ex != null)
+        {
+            log.warn("Could not fix it by cleaning tags: " + ex.getMessage()); //$NON-NLS-1$
+        }
+
+        return null;
+    }
+
     /**
      * Parse a string by creating a StringReader and all the other gubbins.
      */
-    private Element parse(String toparse) throws FactoryConfigurationError, ParserConfigurationException, SAXException, IOException
+    private Element parse(String toparse) throws ParserConfigurationException, SAXException, IOException
     {
         // We need to create a root element to house our document fragment
         StringReader in = new StringReader("<" + RootTag.TAG_ROOT + ">" + toparse + "</" + RootTag.TAG_ROOT + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/install/InstallManager.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/install/InstallManager.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/install/InstallManager.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -83,10 +83,14 @@
                         internalAdd(name, installer);
                     }
                 }
-                catch (Exception ex)
+                catch (InstantiationException e)
                 {
-                    Reporter.informUser(this, ex);
+                    Reporter.informUser(this, e);
                 }
+                catch (IllegalAccessException e)
+                {
+                    Reporter.informUser(this, e);
+                }
             }
         }
         catch (IOException ex)
@@ -160,10 +164,14 @@
                     return name;
                 }
             }
-            catch (Exception ex)
+            catch (InstantiationException e)
             {
-                log.warn("Failed to instansiate installer factory: " + name + "=" + factclazz.getName(), ex); //$NON-NLS-1$ //$NON-NLS-2$
+                log.warn("Failed to instantiate installer factory: " + name + "=" + factclazz.getName(), e); //$NON-NLS-1$ //$NON-NLS-2$
             }
+            catch (IllegalAccessException e)
+            {
+                log.warn("Failed to instantiate installer factory: " + name + "=" + factclazz.getName(), e); //$NON-NLS-1$ //$NON-NLS-2$
+            }
         }
 
         log.warn("Failed to find factory name for " + installer.toString() + " among the " + factories.size() + " factories."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -204,17 +212,20 @@
      */
     public InstallerFactory getInstallerFactory(String name)
     {
+        Class clazz = (Class) factories.get(name);
         try
         {
-            Class clazz = (Class) factories.get(name);
-            InstallerFactory ifactory = (InstallerFactory) clazz.newInstance();
-            return ifactory;
+            return (InstallerFactory) clazz.newInstance();
         }
-        catch (Exception ex)
+        catch (InstantiationException e)
         {
-            assert false : ex;
-            return null;
+            assert false : e;
         }
+        catch (IllegalAccessException e)
+        {
+            assert false : e;
+        }
+        return null;
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -41,6 +41,7 @@
 import org.crosswire.common.util.Reporter;
 import org.crosswire.jsword.book.Book;
 import org.crosswire.jsword.book.BookDriver;
+import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.book.Books;
 import org.crosswire.jsword.book.basic.AbstractBookList;
 import org.crosswire.jsword.book.install.InstallException;
@@ -203,11 +204,21 @@
                     }
 
                 }
-                catch (Exception ex)
+                catch (IOException e)
                 {
-                    Reporter.informUser(this, ex);
+                    Reporter.informUser(this, e);
                     job.ignoreTimings();
                 }
+                catch (InstallException e)
+                {
+                    Reporter.informUser(this, e);
+                    job.ignoreTimings();
+                }
+                catch (BookException e)
+                {
+                    Reporter.informUser(this, e);
+                    job.ignoreTimings();
+                }
                 finally
                 {
                     job.done();
@@ -255,10 +266,10 @@
         {
             download(job, directory + '/' + SEARCH_DIR, book.getInitials() + ZIP_SUFFIX, localDest);
         }
-        catch (Exception ex)
+        catch (InstallException ex)
         {
             job.ignoreTimings();
-            throw new InstallException(Msg.UNKNOWN_ERROR, ex);
+            throw ex;
         }
         finally
         {
@@ -338,7 +349,7 @@
                         Book book = new SwordBook(sbmd, null);
                         entries.put(book.getName(), book);
                     }
-                    catch (Exception ex)
+                    catch (IOException ex)
                     {
                         log.error("Failed to load config for entry: " + internal, ex); //$NON-NLS-1$
                     }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/HttpSwordInstaller.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -40,7 +40,7 @@
  * @author Joe Walker [joe at eireneh dot com]
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
-public class HttpSwordInstaller extends AbstractSwordInstaller implements Comparable
+public class HttpSwordInstaller extends AbstractSwordInstaller
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.install.Installer#getType()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -67,6 +67,8 @@
      */
     public ReadingsBook(ReadingsBookDriver driver, BookCategory type)
     {
+        super(null); // set the book metadata later
+
         String setname = ReadingsBookDriver.getReadingsSet();
 
         Locale defaultLocale = Locale.getDefault();
@@ -177,7 +179,7 @@
             BookData bdata = new BookData(osis, this, key);
             return bdata;
         }
-        catch (Exception ex)
+        catch (NoSuchKeyException ex)
         {
             throw new BookException(Msg.FILTER_FAIL, ex);
         }
@@ -201,7 +203,7 @@
         {
             return getKey(name);
         }
-        catch (Exception e)
+        catch (NoSuchKeyException e)
         {
             return createEmptyKeyList();
         }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -84,14 +84,7 @@
             throw new BookException(Msg.MISSING_FILE);
         }
 
-        try
-        {
-            return new File(loc.getFile()).getAbsolutePath();
-        }
-        catch (Exception e)
-        {
-            throw new BookException(Msg.MISSING_FILE, e);
-        }
+        return new File(loc.getFile()).getAbsolutePath();
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BookType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BookType.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/BookType.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -361,7 +361,8 @@
         {
             return CompressionType.fromString(cStr).getBackend(sbmd);
         }
-        throw new BookException(Msg.COMPRESSION_UNSUPPORTED, new Object[] { cStr });
+        assert false;
+        throw new BookException(Msg.COMPRESSION_UNSUPPORTED, new Object[] { "no compression given" }); //$NON-NLS-1$
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ConfigEntryTable.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -300,9 +300,19 @@
             {
                 encoding = ENCODING_UTF8;
             }
-            Writer writer = new OutputStreamWriter(new FileOutputStream(configFile), encoding);
-            writer.write(toConf());
-            writer.close();
+            Writer writer = null;
+            try
+            {
+                writer = new OutputStreamWriter(new FileOutputStream(configFile), encoding);
+                writer.write(toConf());
+            }
+            finally
+            {
+                if (writer != null)
+                {
+                    writer.close();
+                }
+            }
         }
     }
 
@@ -768,7 +778,8 @@
      * These are the elements that JSword requires.
      * They are a superset of those that Sword requires.
      */
-    public static final ConfigEntryType[] REQUIRED =
+    /* For documentation purposes at this time.
+    private static final ConfigEntryType[] REQUIRED =
     {
         ConfigEntryType.INITIALS,
         ConfigEntryType.DESCRIPTION,
@@ -776,8 +787,9 @@
         ConfigEntryType.DATA_PATH,
         ConfigEntryType.MOD_DRV,
     };
+    */
 
-    public static final ConfigEntryType[] BASIC_INFO =
+    private static final ConfigEntryType[] BASIC_INFO =
     {
         ConfigEntryType.INITIALS,
         ConfigEntryType.DESCRIPTION,
@@ -788,7 +800,7 @@
         ConfigEntryType.HISTORY,
     };
 
-    public static final ConfigEntryType[] LANG_INFO =
+    private static final ConfigEntryType[] LANG_INFO =
     {
         ConfigEntryType.LANGUAGE,
         ConfigEntryType.LANG,
@@ -798,7 +810,7 @@
         ConfigEntryType.GLOSSARY_TO,
     };
 
-    public static final ConfigEntryType[] COPYRIGHT_INFO =
+    private static final ConfigEntryType[] COPYRIGHT_INFO =
     {
         ConfigEntryType.ABOUT,
         ConfigEntryType.SHORT_PROMO,
@@ -816,14 +828,14 @@
         ConfigEntryType.TEXT_SOURCE,
     };
 
-    public static final ConfigEntryType[] FEATURE_INFO =
+    private static final ConfigEntryType[] FEATURE_INFO =
     {
         ConfigEntryType.FEATURE,
         ConfigEntryType.GLOBAL_OPTION_FILTER,
         ConfigEntryType.FONT,
     };
 
-    public static final ConfigEntryType[] SYSTEM_INFO =
+    private static final ConfigEntryType[] SYSTEM_INFO =
     {
         ConfigEntryType.DATA_PATH,
         ConfigEntryType.MOD_DRV,
@@ -835,7 +847,7 @@
         ConfigEntryType.DIRECTION,
     };
 
-    public static final ConfigEntryType[] HIDDEN =
+    private static final ConfigEntryType[] HIDDEN =
     {
         ConfigEntryType.CIPHER_KEY,
     };

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GZIPBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GZIPBackend.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GZIPBackend.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -25,6 +25,7 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
+import java.util.zip.DataFormatException;
 
 import org.crosswire.common.activate.Activator;
 import org.crosswire.common.activate.Lock;
@@ -313,10 +314,14 @@
             endsize = swordtoarch32(endsize);
             /**/
         }
-        catch (Exception ex)
+        catch (IOException e)
         {
-            throw new BookException(Msg.READ_FAIL, ex, new Object[] { verse.getName() });
+            throw new BookException(Msg.READ_FAIL, e, new Object[] { verse.getName() });
         }
+        catch (DataFormatException e)
+        {
+            throw new BookException(Msg.READ_FAIL, e, new Object[] { verse.getName() });
+        }
     }
 
     /* (non-Javadoc)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBook.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -49,7 +49,7 @@
      */
     public SwordBook(SwordBookMetaData sbmd, AbstractBackend backend)
     {
-        setBookMetaData(sbmd);
+        super(sbmd);
 
         this.sbmd = sbmd;
         this.backend = backend;

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookDriver.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -22,6 +22,7 @@
 package org.crosswire.jsword.book.sword;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -122,10 +123,14 @@
                         }
                     }
                 }
-                catch (Exception ex)
+                catch (IOException e)
                 {
-                    log.warn("Couldn't create SwordBookMetaData", ex); //$NON-NLS-1$
+                    log.warn("Couldn't create SwordBookMetaData", e); //$NON-NLS-1$
                 }
+                catch (BookException e)
+                {
+                    log.warn("Couldn't create SwordBookMetaData", e); //$NON-NLS-1$
+                }
             }
         }
         else
@@ -168,25 +173,13 @@
         List failures = FileUtil.delete(confFile);
         if (failures.size() == 0)
         {
-            // If the conf is gone, then we cannot get to the book
-            // and then we can download it again.
-            // But if the conf is present and the book is gone,
-            // then we get errors.
-            // Delete the download book's dir
-            try
+            URL loc = sbmd.getLocation();
+            if (loc != null)
             {
-                URL loc = sbmd.getLocation();
-                if (loc == null)
-                {
-                    throw new BookException(Msg.DELETE_FAILED, new Object [] {confFile});
-                }
                 File bookDir = new File(loc.getFile());
                 failures = FileUtil.delete(bookDir);
                 Books.installed().removeBook(dead);
             }
-            catch (Exception e)
-            {
-            }
 
         }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -25,6 +25,7 @@
 import java.io.FileInputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -66,7 +67,7 @@
             return;
         }
 
-        SwordBookPath.augmentPath = newDirs;
+        SwordBookPath.augmentPath = (File[]) newDirs.clone();
 
         // Now we need to (re)register ourselves
         Books.installed().registerDriver(SwordBookDriver.instance());
@@ -78,7 +79,7 @@
      */
     public static File[] getAugmentPath()
     {
-        return augmentPath;
+        return (File[]) augmentPath.clone();
     }
 
     /**
@@ -196,10 +197,12 @@
         File sysconfig = new File(swordConfDir, SWORD_GLOBAL_CONF);
         if (sysconfig.canRead())
         {
+            InputStream is = null;
             try
             {
                 Properties prop = new Properties();
-                prop.load(new FileInputStream(sysconfig));
+                is = new FileInputStream(sysconfig);
+                prop.load(is);
                 String datapath = prop.getProperty(DATA_PATH);
                 testDefaultPath(bookDirs, datapath);
                 datapath = prop.getProperty(AUGMENT_PATH);
@@ -209,6 +212,20 @@
             {
                 log.warn("Failed to read system config file", ex); //$NON-NLS-1$
             }
+            finally
+            {
+                if (is != null)
+                {
+                    try
+                    {
+                        is.close();
+                    }
+                    catch (IOException e)
+                    {
+                        log.warn("Failed to close system config file", e); //$NON-NLS-1$
+                    }
+                }
+            }
         }
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDictionary.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -35,6 +35,7 @@
 import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.book.OSISUtil;
 import org.crosswire.jsword.book.basic.AbstractBook;
+import org.crosswire.jsword.book.filter.FilterException;
 import org.crosswire.jsword.passage.DefaultKeyList;
 import org.crosswire.jsword.passage.Key;
 import org.crosswire.jsword.passage.NoSuchKeyException;
@@ -56,10 +57,14 @@
      */
     protected SwordDictionary(SwordBookMetaData sbmd, AbstractBackend backend)
     {
-        setBookMetaData(sbmd);
+        super(sbmd);
 
         this.sbmd = sbmd;
         this.backend = backend;
+        map = null;
+        set = null;
+        global = null;
+        active = false;
     }
 
     /* (non-Javadoc)
@@ -134,7 +139,7 @@
             BookData bdata = new BookData(osis, this, key);
             return bdata;
         }
-        catch (Exception ex)
+        catch (FilterException ex)
         {
             throw new BookException(Msg.FILTER_FAIL, ex);
         }
@@ -150,14 +155,7 @@
         assert key != null;
         assert backend != null;
 
-        try
-        {
-            return backend.getRawText(key);
-        }
-        catch (Exception ex)
-        {
-            throw new BookException(Msg.FILTER_FAIL, ex);
-        }
+        return backend.getRawText(key);
     }
 
     /* (non-Javadoc)
@@ -179,7 +177,7 @@
         {
             return getKey(name);
         }
-        catch (Exception e)
+        catch (NoSuchKeyException e)
         {
             return createEmptyKeyList();
         }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -356,9 +356,9 @@
             String ret = SwordUtil.decode(key, entryBytes, charset).trim();
             return ret;
         }
-        catch (Exception ex)
+        catch (IOException e)
         {
-            throw new BookException(Msg.READ_FAIL, ex);
+            throw new BookException(Msg.READ_FAIL, e);
         }
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -2921,30 +2921,28 @@
         }
         else if (moveP && inVerse)
         {
-            Verse v = null;
-
             try
             {
-                v = VerseFactory.fromString(osisID);
+                Verse v = VerseFactory.fromString(osisID);
+                if (v.getVerse() != 1)
+                {
+                    if (paragraphs.contains(osisID))
+                    {
+                        input = "<milestone type=\"x-p\" marker=\"\u00B6\"/>" + input; //$NON-NLS-1$
+                    }
+                    else
+                    {
+                        input = "<milestone type=\"x-extra-p\"/>" + input; //$NON-NLS-1$
+                    }
+                }
+                seenP = true;
+                moveP = false;
             }
             catch (NoSuchVerseException e)
             {
                 // does not happen
             }
 
-            if (v.getVerse() != 1)
-            {
-                if (paragraphs.contains(osisID))
-                {
-                    input = "<milestone type=\"x-p\" marker=\"\u00B6\"/>" + input; //$NON-NLS-1$
-                }
-                else
-                {
-                    input = "<milestone type=\"x-extra-p\"/>" + input; //$NON-NLS-1$
-                }
-            }
-            seenP = true;
-            moveP = false;
         }
 
         if (inVerse && paragraphs.contains(osisID) && !seenP)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/DictToOsis.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -96,9 +96,19 @@
 
             buildDocumentClose(buf);
 
-            Writer writer = new OutputStreamWriter(new FileOutputStream(bmd.getInitials() + ".xml"), "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
-            writer.write(buf.toString());
-            writer.close();
+            Writer writer = null;
+            try
+            {
+                writer = new OutputStreamWriter(new FileOutputStream(bmd.getInitials() + ".xml"), "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
+                writer.write(buf.toString());
+            }
+            finally
+            {
+                if (writer != null)
+                {
+                    writer.close();
+                }
+            }
             XMLProcess parser = new XMLProcess();
 //            parser.getFeatures().setFeatureStates("-s", "-f", "-va", "-dv"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
             parser.parse(bmd.getInitials() + ".xml"); //$NON-NLS-1$

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexManagerFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,6 +21,8 @@
  */
 package org.crosswire.jsword.index;
 
+import java.io.IOException;
+
 import org.crosswire.common.util.ClassUtil;
 import org.crosswire.common.util.Logger;
 
@@ -69,9 +71,25 @@
             Class impl = ClassUtil.getImplementor(IndexManager.class);
             instance = (IndexManager) impl.newInstance();
         }
-        catch (Exception ex)
+        catch (IOException e)
         {
-            log.error("createIndexManager failed", ex); //$NON-NLS-1$
+            log.error("createIndexManager failed", e); //$NON-NLS-1$
         }
+        catch (ClassCastException e)
+        {
+            log.error("createIndexManager failed", e); //$NON-NLS-1$
+        }
+        catch (ClassNotFoundException e)
+        {
+            log.error("createIndexManager failed", e); //$NON-NLS-1$
+        }
+        catch (IllegalAccessException e)
+        {
+            log.error("createIndexManager failed", e); //$NON-NLS-1$
+        }
+        catch (InstantiationException e)
+        {
+            log.error("createIndexManager failed", e); //$NON-NLS-1$
+        }
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -34,6 +34,7 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.search.Hits;
 import org.apache.lucene.search.IndexSearcher;
@@ -157,7 +158,7 @@
 
             }
         }
-        catch (Exception ex)
+        catch (IOException ex)
         {
             job.ignoreTimings();
             throw new BookException(Msg.LUCENE_INIT, ex);
@@ -230,10 +231,18 @@
                     }
                 }
             }
-            catch (Exception ex)
+            catch (IOException e)
             {
-                throw new BookException(Msg.SEARCH_FAILED, ex);
+                throw new BookException(Msg.SEARCH_FAILED, e);
             }
+            catch (NoSuchVerseException e)
+            {
+                throw new BookException(Msg.SEARCH_FAILED, e);
+            }
+            catch (ParseException e)
+            {
+                throw new BookException(Msg.SEARCH_FAILED, e);
+            }
             finally
             {
                 Activator.deactivate(this);

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -114,10 +114,14 @@
                         INDEXES.put(book, index);
                     }
                 }
-                catch (Exception ex)
+                catch (IOException e)
                 {
-                    Reporter.informUser(LuceneIndexManager.this, ex);
+                    Reporter.informUser(LuceneIndexManager.this, e);
                 }
+                catch (BookException e)
+                {
+                    Reporter.informUser(LuceneIndexManager.this, e);
+                }
                 finally
                 {
                     book.setIndexStatus(finalStatus);

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryBuilderFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryBuilderFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryBuilderFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,6 +21,8 @@
  */
 package org.crosswire.jsword.index.query;
 
+import java.io.IOException;
+
 import org.crosswire.common.util.ClassUtil;
 import org.crosswire.common.util.Logger;
 
@@ -68,9 +70,25 @@
             Class impl = ClassUtil.getImplementor(QueryBuilder.class);
             instance = (QueryBuilder) impl.newInstance();
         }
-        catch (Exception ex)
+        catch (IOException e)
         {
-            log.error("create QueryBuilder failed", ex); //$NON-NLS-1$
+            log.error("create QueryBuilder failed", e); //$NON-NLS-1$
         }
+        catch (ClassCastException e)
+        {
+            log.error("create QueryBuilder failed", e); //$NON-NLS-1$
+        }
+        catch (ClassNotFoundException e)
+        {
+            log.error("create QueryBuilder failed", e); //$NON-NLS-1$
+        }
+        catch (InstantiationException e)
+        {
+            log.error("create QueryBuilder failed", e); //$NON-NLS-1$
+        }
+        catch (IllegalAccessException e)
+        {
+            log.error("create QueryBuilder failed", e); //$NON-NLS-1$
+        }
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryDecoratorFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryDecoratorFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/query/QueryDecoratorFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,6 +21,8 @@
  */
 package org.crosswire.jsword.index.query;
 
+import java.io.IOException;
+
 import org.crosswire.common.util.ClassUtil;
 import org.crosswire.common.util.Logger;
 
@@ -68,9 +70,25 @@
             Class impl = ClassUtil.getImplementor(QueryDecorator.class);
             instance = (QueryDecorator) impl.newInstance();
         }
-        catch (Exception ex)
+        catch (IOException e)
         {
-            log.error("create Query Decorator failed", ex); //$NON-NLS-1$
+            log.error("create QueryDecorator failed", e); //$NON-NLS-1$
         }
+        catch (ClassCastException e)
+        {
+            log.error("create QueryDecorator failed", e); //$NON-NLS-1$
+        }
+        catch (ClassNotFoundException e)
+        {
+            log.error("create QueryDecorator failed", e); //$NON-NLS-1$
+        }
+        catch (InstantiationException e)
+        {
+            log.error("create QueryDecorator failed", e); //$NON-NLS-1$
+        }
+        catch (IllegalAccessException e)
+        {
+            log.error("create QueryDecorator failed", e); //$NON-NLS-1$
+        }
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/search/SearcherFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/search/SearcherFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/search/SearcherFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,9 +21,12 @@
  */
 package org.crosswire.jsword.index.search;
 
+import java.io.IOException;
+
 import org.crosswire.common.util.ClassUtil;
 import org.crosswire.common.util.Logger;
 import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.index.Index;
 import org.crosswire.jsword.index.IndexManager;
 import org.crosswire.jsword.index.IndexManagerFactory;
@@ -60,11 +63,31 @@
 
             return parser;
         }
-        catch (Exception ex)
+        catch (IOException e)
         {
-            log.error("createSearcher failed", ex); //$NON-NLS-1$
+            log.error("createSearcher failed", e); //$NON-NLS-1$
             throw new InstantiationException();
         }
+        catch (BookException e)
+        {
+            log.error("createSearcher failed", e); //$NON-NLS-1$
+            throw new InstantiationException();
+        }
+        catch (ClassCastException e)
+        {
+            log.error("createSearcher failed", e); //$NON-NLS-1$
+            throw new InstantiationException();
+        }
+        catch (ClassNotFoundException e)
+        {
+            log.error("createSearcher failed", e); //$NON-NLS-1$
+            throw new InstantiationException();
+        }
+        catch (IllegalAccessException e)
+        {
+            log.error("createSearcher failed", e); //$NON-NLS-1$
+            throw new InstantiationException();
+        }
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -217,6 +217,10 @@
          */
         public Verse createStartVerse(String original, VerseRange verseRangeBasis, String[] parts) throws NoSuchVerseException
         {
+            if (verseRangeBasis == null)
+            {
+                throw new NoSuchVerseException(Msg.ACCURACY_BOOK);
+            }
             int book = verseRangeBasis.getEnd().getBook();
             int chapter = getChapter(book, parts[0]);
             int verse = getVerse(book, chapter, parts[1]);
@@ -260,6 +264,10 @@
          */
         public Verse createStartVerse(String original, VerseRange verseRangeBasis, String[] parts) throws NoSuchVerseException
         {
+            if (verseRangeBasis == null)
+            {
+                throw new NoSuchVerseException(Msg.ACCURACY_BOOK);
+            }
             int book = verseRangeBasis.getEnd().getBook();
             int chapter = getChapter(book, parts[0]);
             return new Verse(original, book, chapter, 1);
@@ -302,6 +310,10 @@
          */
         public Verse createStartVerse(String original, VerseRange verseRangeBasis, String[] parts) throws NoSuchVerseException
         {
+            if (verseRangeBasis == null)
+            {
+                throw new NoSuchVerseException(Msg.ACCURACY_BOOK_CHAPTER);
+            }
             int book = verseRangeBasis.getEnd().getBook();
             int chapter = verseRangeBasis.getEnd().getChapter();
             int verse = getVerse(book, chapter, parts[0]);
@@ -555,9 +567,9 @@
         StringBuffer buffer = new StringBuffer(original);
         for (int i = 0; i < parts.length; i++)
         {
-            buffer.append(", ").append(parts[i]);//$NON-NLS-1$
+            buffer.append(", ").append(parts[i]); //$NON-NLS-1$
         }
-        return new NoSuchVerseException(Msg.VERSE_PARTS, new Object[] { buffer.toString() });        
+        return new NoSuchVerseException(Msg.VERSE_PARTS, new Object[] { buffer.toString() });
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -36,7 +36,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class DefaultKeyList extends AbstractKeyList implements Key
+public class DefaultKeyList extends AbstractKeyList
 {
     /**
      * Simple ctor

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -32,6 +32,9 @@
  */
 public final class Msg extends MsgBase
 {
+    static final Msg ACCURACY_BOOK = new Msg("AccuracyType.Book"); //$NON-NLS-1$
+    static final Msg ACCURACY_BOOK_CHAPTER = new Msg("AccuracyType.BookChapter"); //$NON-NLS-1$
+
     static final Msg TALLY_ERROR_ENUM = new Msg("PassageTally.ErrorEnum"); //$NON-NLS-1$
     static final Msg TALLY_ERROR_ORDER = new Msg("PassageTally.ErrorOrder"); //$NON-NLS-1$
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.properties
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.properties	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Msg.properties	2006-10-10 23:30:55 UTC (rev 1152)
@@ -5,6 +5,9 @@
 # The MessageName should be mixed case, with a leading capital.
 # It should have no spaces or other punctuation (e.g. _, -, ', ...)
 
+AccuracyType.Book=Book is missing
+AccuracyType.BookChapter=Book and chapter are missing
+
 PassageTally.ErrorEnum=nextElement() has not been called yet.
 PassageTally.ErrorOrder=Ordering must be one of ORDER_BIBLICAL or ORDER_TALLY
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -91,7 +91,7 @@
         {
             return getKey(name);
         }
-        catch (Exception e)
+        catch (NoSuchKeyException e)
         {
             return createEmptyKeyList();
         }
@@ -119,7 +119,7 @@
 
             return whole;
         }
-        catch (Exception ex)
+        catch (NoSuchKeyException ex)
         {
             assert false : ex;
             return createPassage();

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -195,62 +195,56 @@
 
         StringBuffer retcode = new StringBuffer();
 
-        try
+        if (order == ORDER_BIBLICAL)
         {
-            if (order == ORDER_BIBLICAL)
+            Iterator it = rangeIterator(RestrictionType.NONE);
+            Verse current = null;
+            while (it.hasNext())
             {
-                Iterator it = rangeIterator(RestrictionType.NONE);
-                Verse current = null;
-                while (it.hasNext())
-                {
-                    VerseRange range = (VerseRange) it.next();
-                    retcode.append(range.getName(current));
+                VerseRange range = (VerseRange) it.next();
+                retcode.append(range.getName(current));
 
-                    if (it.hasNext())
-                    {
-                        retcode.append(AbstractPassage.REF_PREF_DELIM);
-                    }
-
-                    current = range.getStart();
+                if (it.hasNext())
+                {
+                    retcode.append(AbstractPassage.REF_PREF_DELIM);
                 }
+
+                current = range.getStart();
             }
-            else
+        }
+        else
+        {
+            if (max_count == 0)
             {
-                if (max_count == 0)
-                {
-                    max_count = Integer.MAX_VALUE;
-                }
+                max_count = Integer.MAX_VALUE;
+            }
 
-                Iterator it = new OrderedVerseIterator(board);
-                Key current = null;
-                int count = 0;
+            Iterator it = new OrderedVerseIterator(board);
+            Key current = null;
+            int count = 0;
 
-                while (it.hasNext() && count < max_count)
-                {
-                    Key verse = (Key) it.next();
-                    retcode.append(verse.getName(current));
+            while (it.hasNext() && count < max_count)
+            {
+                Key verse = (Key) it.next();
+                retcode.append(verse.getName(current));
 
-                    current = verse;
-                    count++;
+                current = verse;
+                count++;
 
-                    if (it.hasNext() && count < max_count)
-                    {
-                        retcode.append(AbstractPassage.REF_PREF_DELIM);
-                    }
+                if (it.hasNext() && count < max_count)
+                {
+                    retcode.append(AbstractPassage.REF_PREF_DELIM);
                 }
             }
         }
-        catch (Exception ex)
-        {
-            assert false : ex;
-        }
 
         return retcode.toString();
     }
 
     /**
-     * A Human readable version of the PassageTally.
-     * Uses short books names, and the shortest possible rendering eg "Mat 3:1-4"
+     * A Human readable version of the PassageTally. Uses short books names, and
+     * the shortest possible rendering eg "Mat 3:1-4"
+     * 
      * @return a String containing a description of the verses
      */
     public String getNameAndTally()
@@ -273,37 +267,31 @@
             max_count = Integer.MAX_VALUE;
         }
 
-        try
+        OrderedVerseIterator it = new OrderedVerseIterator(board);
+        int count = 0;
+
+        while (it.hasNext() && count < max_count)
         {
-            OrderedVerseIterator it = new OrderedVerseIterator(board);
-            int count = 0;
+            Key verse = (Key) it.next();
+            retcode.append(verse.getName());
+            retcode.append(" ("); //$NON-NLS-1$
+            retcode.append(100 * it.lastRank() / max);
+            retcode.append("%)"); //$NON-NLS-1$
 
-            while (it.hasNext() && count < max_count)
-            {
-                Key verse = (Key) it.next();
-                retcode.append(verse.getName());
-                retcode.append(" ("); //$NON-NLS-1$
-                retcode.append(100 * it.lastRank() / max);
-                retcode.append("%)"); //$NON-NLS-1$
+            count++;
 
-                count++;
-
-                if (it.hasNext() && count < max_count)
-                {
-                    retcode.append(AbstractPassage.REF_PREF_DELIM);
-                }
+            if (it.hasNext() && count < max_count)
+            {
+                retcode.append(AbstractPassage.REF_PREF_DELIM);
             }
         }
-        catch (Exception ex)
-        {
-            assert false : ex;
-        }
 
         return retcode.toString();
     }
 
     /**
      * Iterate through the verse elements in the current sort order
+     * 
      * @return A verse Iterator
      */
     public Iterator iterator()
@@ -955,6 +943,7 @@
             }
 
             it = output.iterator();
+            last = null;
         }
 
         /* (non-Javadoc)
@@ -1096,6 +1085,7 @@
             }
 
             this.it = output.iterator();
+            last = null;
         }
 
         /* (non-Javadoc)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -376,7 +376,7 @@
     private static RestrictionType defaultBlurRestriction;
 
     /**
-     * The name of the PassageListType
+     * The name of the RestrictionType
      */
     private String name;
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -35,7 +35,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class SetKeyList extends AbstractKeyList implements Key
+public class SetKeyList extends AbstractKeyList
 {
     /**
      * Simple ctor

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -179,7 +179,7 @@
                 + Verse.VERSE_PREF_DELIM2
                 + verse;
         }
-        catch (Exception ex)
+        catch (NoSuchKeyException ex)
         {
             assert false : ex;
             return "!Error!"; //$NON-NLS-1$
@@ -193,7 +193,7 @@
      */
     public String getName(Key base)
     {
-        if (base == null)
+        if (base == null || !(base instanceof Verse))
         {
             return getName();
         }
@@ -237,7 +237,7 @@
 
             return String.valueOf(verse);
         }
-        catch (Exception ex)
+        catch (NoSuchKeyException ex)
         {
             assert false : ex;
             return "!Error!"; //$NON-NLS-1$

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/util/ConverterFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/ConverterFactory.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/ConverterFactory.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -55,11 +55,15 @@
             Converter converter = (Converter) clazz.newInstance();
             return converter;
         }
-        catch (Exception ex)
+        catch (InstantiationException e)
         {
-            assert false : ex;
-            return null;
+            assert false : e;
         }
+        catch (IllegalAccessException e)
+        {
+            assert false : e;
+        }
+        return null;
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -24,6 +24,7 @@
 import java.util.Locale;
 
 import org.crosswire.jsword.book.CaseType;
+import org.crosswire.jsword.passage.NoSuchKeyException;
 import org.crosswire.jsword.passage.NoSuchVerseException;
 
 /**
@@ -188,7 +189,7 @@
                 bookNum = englishBibleNames.getBookNumber(find);
             }
         }
-        return bookNum;        
+        return bookNum;
     }
 
     /**
@@ -507,7 +508,7 @@
 
             return ref;
         }
-        catch (Exception ex)
+        catch (NoSuchKeyException ex)
         {
             assert false : ex;
             return ref;
@@ -884,7 +885,7 @@
     /**
      * A singleton used to do initialization. Could be used to change static methods to non-static
      */
-    protected static final BibleInfo instance = new BibleInfo();
+    static final BibleInfo instance = new BibleInfo();
 
     /**
      * This is the code used to create ORDINAL_AT_START_OF_CHAPTER and

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -24,6 +24,7 @@
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.regex.Pattern;
 
@@ -239,7 +240,7 @@
 
         ResourceBundle resources = ResourceBundle.getBundle(BibleNames.class.getName(), locale, new CWClassLoader(BibleNames.class));
 
-        for (int i = 0; i < booksInBible; i++ )
+        for (int i = 0; i < booksInBible; i++)
         {
             Integer bookNum = new Integer(i + 1);
             String fullBook = getString(resources, FULL_KEY + (i + 1));
@@ -258,7 +259,7 @@
             String[] alternates = StringUtil.split(altBook, ',');
             altBooks[i] = alternates;
 
-            for (int j = 0; j < alternates.length; j++ )
+            for (int j = 0; j < alternates.length; j++)
             {
                 altBooksMap.put(alternates[j], bookNum);
             }
@@ -274,7 +275,7 @@
         {
             return resources.getString(key);
         }
-        catch (Exception e)
+        catch (MissingResourceException e)
         {
             assert false;
         }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -24,6 +24,7 @@
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.regex.Pattern;
 
@@ -124,7 +125,7 @@
         // Get all the OSIS standard book names
         ResourceBundle resources = ResourceBundle.getBundle(OSISNames.class.getName(), Locale.getDefault(), new CWClassLoader(OSISNames.class));
 
-        for (int i = 0; i < osisBooks.length; i++ )
+        for (int i = 0; i < osisBooks.length; i++)
         {
             osisBooks[i] = getString(resources, OSIS_KEY + (i + 1));
             osisMap.put(normalize(osisBooks[i]), new Integer(i + 1));
@@ -140,7 +141,7 @@
         {
             return resources.getString(key);
         }
-        catch (Exception e)
+        catch (MissingResourceException e)
         {
             assert false;
         }
@@ -153,7 +154,7 @@
     /**
      * A singleton used to do initialization. Could be used to change static methods to non-static
      */
-    protected static final OSISNames instance = new OSISNames();
+    static final OSISNames instance = new OSISNames();
 
     private static final String OSIS_KEY = "OSIS."; //$NON-NLS-1$
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -22,6 +22,7 @@
 package org.crosswire.jsword.versification;
 
 import java.util.Locale;
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
 import org.crosswire.common.util.CWClassLoader;
@@ -238,7 +239,7 @@
         {
             return resources.getString(key);
         }
-        catch (Exception e)
+        catch (MissingResourceException e)
         {
             assert false;
         }

Modified: trunk/jsword/src/test/java/Bench.java
===================================================================
--- trunk/jsword/src/test/java/Bench.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/test/java/Bench.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -5,6 +5,7 @@
 import org.crosswire.jsword.book.Book;
 import org.crosswire.jsword.book.BookFilters;
 import org.crosswire.jsword.book.Books;
+import org.crosswire.jsword.book.filter.FilterException;
 import org.crosswire.jsword.book.test.Speed;
 
 /**
@@ -30,34 +31,14 @@
             System.exit(1);
         }
 
-        try
-        {
-            List dicts = Books.installed().getBooks(BookFilters.getBibles());
-            version = (Book) dicts.get(0);
-        }
-        catch (Exception ex)
-        {
-            Reporter.informUser(Bench.class, ex);
+        List dicts = Books.installed().getBooks(BookFilters.getBibles());
+        version = (Book) dicts.get(0);
 
-            System.out.println("Failed to load version '" + args[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$
-            System.out.println("System message: " + ex); //$NON-NLS-1$
-            System.out.println(""); //$NON-NLS-1$
-            usage();
-            System.exit(1);
-        }
-
         Speed speed = new Speed(version);
         speed.run();
 
-        try
-        {
-            float time = speed.getBenchmark() / 1000;
-            System.out.println("CBench mark for '" + args[0] + "': " + time + "s"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        }
-        catch (Exception ex)
-        {
-            System.out.println("Benchmark failed. No timing available."); //$NON-NLS-1$
-        }
+        float time = speed.getBenchmark() / 1000;
+        System.out.println("CBench mark for '" + args[0] + "': " + time + "s"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
     /**

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/test/Speed.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -23,8 +23,10 @@
 
 import org.crosswire.common.util.Reporter;
 import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookException;
 import org.crosswire.jsword.passage.Key;
 import org.crosswire.jsword.passage.KeyUtil;
+import org.crosswire.jsword.passage.NoSuchKeyException;
 import org.crosswire.jsword.passage.Passage;
 import org.crosswire.jsword.passage.PassageTally;
 
@@ -97,17 +99,22 @@
 
             end_time = System.currentTimeMillis();
         }
-        catch (Exception ex)
+        catch (BookException ex)
         {
             Reporter.informUser(this, ex);
         }
+        catch (NoSuchKeyException ex)
+        {
+            Reporter.informUser(this, ex);
+        }
     }
 
     /**
      * Dummy display routine. We might want to add some XSL styling to this.
      * @param ref The passage to format for display
+     * @throws BookException 
      */
-    private void dummyDisplay(Passage ref) throws Exception
+    private void dummyDisplay(Passage ref) throws BookException
     {
         book.getData(ref);
     }

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java	2006-10-10 23:29:42 UTC (rev 1151)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java	2006-10-10 23:30:55 UTC (rev 1152)
@@ -21,10 +21,10 @@
  */
 package org.crosswire.jsword.passage;
 
+import junit.framework.TestCase;
+
 import org.crosswire.jsword.versification.BibleInfo;
 
-import junit.framework.TestCase;
-
 /**
  * JUnit Test.
  * 
@@ -209,9 +209,12 @@
             VerseFactory.fromString(null);
             fail();
         }
-        catch (Exception ex)
+        catch (NullPointerException ex)
         {
         }
+        catch (NoSuchKeyException ex)
+        {
+        }
         assertEquals(jude1, VerseFactory.fromString("jude 1")); //$NON-NLS-1$
         assertEquals(jude2, VerseFactory.fromString("jude 2")); //$NON-NLS-1$
         assertEquals(jude9, VerseFactory.fromString("jude 25")); //$NON-NLS-1$




More information about the jsword-svn mailing list