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

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Wed Aug 16 12:12:02 MST 2006


Author: dmsmith
Date: 2006-08-16 12:11:56 -0700 (Wed, 16 Aug 2006)
New Revision: 1118

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java
Log:
Better handle bad data in mods.d.tar.gz. There was a 0 length conf.

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-08-15 20:41:29 UTC (rev 1117)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/install/sword/AbstractSwordInstaller.java	2006-08-16 19:11:56 UTC (rev 1118)
@@ -306,10 +306,20 @@
                     try
                     {
                         int size = (int) entry.getSize();
+
+                        // Every now and then an empty entry sneaks in
+                        if (size == 0)
+                        {
+                            log.error("Empty entry: " + internal); //$NON-NLS-1$
+                            continue;
+                        }
+
                         byte[] buffer = new byte[size];
                         if (tin.read(buffer) != size)
                         {
-                            log.warn("Did not read all that was expected " + internal); //$NON-NLS-1$
+                            // This should not happen, but if it does then skip it.
+                            log.error("Did not read all that was expected " + internal); //$NON-NLS-1$
+                            continue;
                         }
 
                         if (internal.endsWith(SwordConstants.EXTENSION_CONF))
@@ -329,7 +339,7 @@
                     }
                     catch (Exception ex)
                     {
-                        log.warn("Failed to load config for entry: " + internal, ex); //$NON-NLS-1$
+                        log.error("Failed to load config for entry: " + internal, ex); //$NON-NLS-1$
                     }
                 }
             }




More information about the jsword-svn mailing list