[sword-svn] r142 - trunk/app/src/org/crosswire/flashcards

Apache apache at www.crosswire.org
Thu Dec 13 23:29:04 MST 2007


Author: 
Date: 2007-12-13 23:29:04 -0700 (Thu, 13 Dec 2007)
New Revision: 142

Modified:
   trunk/app/src/org/crosswire/flashcards/LessonManager.java
Log:
Fixed a java 6 webstart bug


Modified: trunk/app/src/org/crosswire/flashcards/LessonManager.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonManager.java	2007-12-14 05:51:50 UTC (rev 141)
+++ trunk/app/src/org/crosswire/flashcards/LessonManager.java	2007-12-14 06:29:04 UTC (rev 142)
@@ -145,6 +145,7 @@
                JarURLConnection jarConnection = (JarURLConnection) connection;
                try {
 
+/*
                     String uri = jarConnection.getJarFileURL().toString();
                     //stupid bug with webstart
                     if ((uri.startsWith("file:")) && (!uri.startsWith("file:/"))) {
@@ -154,9 +155,11 @@
 //                                     "Text Edit", JOptionPane.OK_OPTION) ;
 
                     loadJarLessonSets(new File(new java.net.URI(uri)));
+*/
+                    loadJarLessonSets(jarConnection.getJarFile());
                }
                catch (Exception e) {
-                   Debug.error(this.getClass().getName(), e.getMessage());
+                   e.printStackTrace();
                }
           }
      }
@@ -189,6 +192,20 @@
           JarFile jjarFile = null;
           try {
                jjarFile = new JarFile(jarFile);
+               loadJarLessonSets(jjarFile);
+          }
+          catch (IOException e2) {
+              e2.printStackTrace();
+          }
+     }
+
+
+     /**
+      * Load lesson sets from the jar file
+      */
+     private void loadJarLessonSets(JarFile jjarFile) {
+
+          try {
                Enumeration entries = jjarFile.entries();
                while (entries.hasMoreElements()) {
                     JarEntry jarEntry = (JarEntry) entries.nextElement();
@@ -198,13 +215,13 @@
                          entryName = entryName.substring(0, entryName.length() - 1);
                          if (entryName.startsWith(LESSON_ROOT) && !entryName.equals(LESSON_ROOT) && !entryName.endsWith("/audio")) {
                               // let the description be just the directory name and not the path
-                              add(new ComplexLessonSet("jar:" + jarFile.getCanonicalFile().toURL().toString() + "!/" + entryName));
+                              add(new ComplexLessonSet("jar:" + new File(jjarFile.getName()).getCanonicalFile().toURL().toString() + "!/" + entryName));
                          }
                     }
                }
           }
           catch (IOException e2) {
-              Debug.error(this.getClass().getName(), e2.getMessage());
+              e2.printStackTrace();
           }
      }
 




More information about the sword-cvs mailing list