[jsword-svn] r2302 - trunk/jsword-web/src/main/java/org/crosswire/jsword/view/web

dmsmith at crosswire.org dmsmith at crosswire.org
Mon Mar 11 05:39:35 MST 2013


Author: dmsmith
Date: 2013-03-11 05:39:34 -0700 (Mon, 11 Mar 2013)
New Revision: 2302

Modified:
   trunk/jsword-web/src/main/java/org/crosswire/jsword/view/web/DownloadSet.java
Log:
Improve download page

Modified: trunk/jsword-web/src/main/java/org/crosswire/jsword/view/web/DownloadSet.java
===================================================================
--- trunk/jsword-web/src/main/java/org/crosswire/jsword/view/web/DownloadSet.java	2013-03-11 04:38:24 UTC (rev 2301)
+++ trunk/jsword-web/src/main/java/org/crosswire/jsword/view/web/DownloadSet.java	2013-03-11 12:39:34 UTC (rev 2302)
@@ -46,6 +46,7 @@
 public class DownloadSet implements Comparable<DownloadSet> {
     public static final String BIN_ZIP = "-bin.zip";
     public static final String BIN_TGZ = "-bin.tar.gz";
+    public static final String LATEST  = "latest-bin.tar.gz";
     public static final String SRC_ZIP = "-src.zip";
     public static final String SRC_TGZ = "-src.tar.gz";
     public static final String DOC_ZIP = "-doc.zip";
@@ -57,6 +58,7 @@
     public static DownloadSet[] getDownloadSets(String localprefix, String webprefix, boolean datesort) throws IOException {
         File dir = new File(localprefix);
         if (!dir.isDirectory()) {
+            log.error("{} is not a directory", localprefix);
             throw new IOException(MessageFormat.format("{0} is not a directory", localprefix));
         }
 
@@ -64,8 +66,11 @@
         File[] files = dir.listFiles(new FileFilter() {
             public boolean accept(File file) {
                 String name = file.getName();
-                log.debug("found {}", name);
-                return file.canRead() && name.startsWith(TEST_PREFIX) && name.endsWith(TEST_SUFFIX);
+                log.debug("Examine file: {}", name);
+                return file.canRead()
+                        && name.startsWith(TEST_PREFIX)
+                        && name.endsWith(BIN_TGZ)
+                        && !name.endsWith(LATEST);
             }
         });
 
@@ -73,7 +78,7 @@
         for (int i = 0; i < files.length; i++) {
             String name = files[i].getName();
             log.debug("adding {}", name);
-            String sets = name.substring(TEST_PREFIX.length(), name.length() - TEST_SUFFIX.length());
+            String sets = name.substring(TEST_PREFIX.length(), name.length() - BIN_TGZ.length());
             reply.add(new DownloadSet(localprefix, webprefix, sets, datesort));
         }
 
@@ -92,9 +97,7 @@
         log.debug("ctor {}", webprefix);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /* (non-Javadoc)
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
     public int compareTo(DownloadSet that) {
@@ -156,7 +159,6 @@
     private String setname;
 
     private static final String TEST_PREFIX = "jsword-";
-    private static final String TEST_SUFFIX = BIN_ZIP;
 
     private static final NumberFormat NF = NumberFormat.getNumberInstance();
     private static final String VERSION_DATE = "yyyyMMdd";




More information about the jsword-svn mailing list