[jsword-svn] r1447 - trunk/jsword/src/main/java/org/crosswire/jsword/book/sword

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Mon Jun 25 09:05:25 MST 2007


Author: dmsmith
Date: 2007-06-25 09:05:24 -0700 (Mon, 25 Jun 2007)
New Revision: 1447

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
Log:
Checked for an error that should never happen: modules with a bad DataPath in the conf.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java	2007-06-24 14:12:41 UTC (rev 1446)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookMetaData.java	2007-06-25 16:05:24 UTC (rev 1447)
@@ -192,13 +192,23 @@
      */
     public void setLibrary(URI library)
     {
+        // Currently all DATA_PATH entries end in / to indicate dirs or not to indicate file prefixes
+        String datapath = getProperty(ConfigEntryType.DATA_PATH);
+        int lastSlash = datapath.lastIndexOf('/');
+
+        // There were modules that did not have a valid datapath.
+        // This should not be necessary
+        if (lastSlash == -1)
+        {
+            return;
+        }
+
+        datapath = datapath.substring(0, lastSlash);
+        URI location = NetUtil.lengthenURI(library, datapath);
+
         cet.add(ConfigEntryType.LIBRARY_URL, library.toString());
         super.setLibrary(library);
 
-        // Currently all DATA_PATH entries end in / to indicate dirs or not to indicate file prefixes
-        String datapath = getProperty(ConfigEntryType.DATA_PATH);
-        datapath = datapath.substring(0, datapath.lastIndexOf('/'));
-        URI location = NetUtil.lengthenURI(library, datapath);
         cet.add(ConfigEntryType.LOCATION_URL, location.toString());
         super.setLocation(location);
     }




More information about the jsword-svn mailing list