[jsword-svn] r2117 - in trunk/jsword/src/main: java/org/crosswire/jsword/book/sword resources

dmsmith at crosswire.org dmsmith at crosswire.org
Sat Mar 12 14:34:29 MST 2011


Author: dmsmith
Date: 2011-03-12 14:34:29 -0700 (Sat, 12 Mar 2011)
New Revision: 2117

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GenBookBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java
   trunk/jsword/src/main/resources/JSMsg.properties
   trunk/jsword/src/main/resources/JSMsg_fa.properties
   trunk/jsword/src/main/resources/JSMsg_in.properties
   trunk/jsword/src/main/resources/JSMsg_zh.properties
Log:
JS-177 Fix a null pointer exception in GenBookBackend. Now throws a BookException.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GenBookBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GenBookBackend.java	2011-03-12 20:30:34 UTC (rev 2116)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/GenBookBackend.java	2011-03-12 21:34:29 UTC (rev 2117)
@@ -56,12 +56,8 @@
         index = new TreeKeyIndex(sbmd);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.crosswire.common.activate.Activatable#activate(org.crosswire.common
-     * .activate.Lock)
+    /* (non-Javadoc)
+     * @see org.crosswire.common.activate.Activatable#activate(org.crosswire.common.activate.Lock)
      */
     public final void activate(Lock lock) {
         Activator.activate(index);
@@ -92,12 +88,8 @@
         active = true;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.crosswire.common.activate.Activatable#deactivate(org.crosswire.common
-     * .activate.Lock)
+    /* (non-Javadoc)
+     * @see org.crosswire.common.activate.Activatable#deactivate(org.crosswire.common.activate.Lock)
      */
     public final void deactivate(Lock lock) {
         try {
@@ -115,13 +107,6 @@
         Activator.deactivate(index);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.crosswire.jsword.passage.Key#contains(org.crosswire.jsword.passage
-     * .Key)
-     */
     @Override
     public boolean contains(Key key) {
         checkActive();
@@ -146,13 +131,6 @@
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.crosswire.jsword.book.sword.AbstractBackend#getRawText(org.crosswire
-     * .jsword.passage.Key, java.lang.String)
-     */
     @Override
     public String getRawText(Key key) throws BookException {
         checkActive();
@@ -160,6 +138,14 @@
         try {
             DataPolice.setKey(key);
             TreeNode node = find(key);
+
+            if (node == null) {
+                // TRANSLATOR: Error condition: Indicates that something could not be found in the book.
+                // {0} is a placeholder for the unknown key.
+                // {1} is the short name of the book
+                throw new BookException(JSMsg.gettext("No entry for ''{0}'' in {1}.", key.getName(), getBookMetaData().getInitials()));
+            }
+
             byte[] userData = node.getUserData();
 
             // Some entries may be empty.
@@ -230,11 +216,6 @@
         return null;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.crosswire.jsword.book.sword.AbstractBackend#readIndex()
-     */
     @Override
     public Key readIndex() {
         SwordBookMetaData bmd = getBookMetaData();
@@ -251,17 +232,11 @@
         return reply;
     }
 
-    /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.sword.AbstractBackend#setAliasKey(org.crosswire.jsword.passage.Key, org.crosswire.jsword.passage.Key)
-     */
     @Override
     public void setAliasKey(Key alias, Key source) throws IOException {
         throw new UnsupportedOperationException();
     }
 
-    /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.sword.AbstractBackend#setRawText(org.crosswire.jsword.passage.Key, java.lang.String)
-     */
     @Override
     public void setRawText(Key key, String text) throws BookException, IOException {
         throw new UnsupportedOperationException();

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java	2011-03-12 20:30:34 UTC (rev 2116)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordGenBook.java	2011-03-12 21:34:29 UTC (rev 2117)
@@ -215,7 +215,7 @@
         // TRANSLATOR: Error condition: Indicates that something could not be found in the book.
         // {0} is a placeholder for the unknown key.
         // {1} is the short name of the book
-        throw new NoSuchKeyException(JSMsg.gettext("No entry for \'{0}\' in {1}.", text, getInitials()));
+        throw new NoSuchKeyException(JSMsg.gettext("No entry for ''{0}'' in {1}.", text, getInitials()));
     }
 
     /* (non-Javadoc)

Modified: trunk/jsword/src/main/resources/JSMsg.properties
===================================================================
--- trunk/jsword/src/main/resources/JSMsg.properties	2011-03-12 20:30:34 UTC (rev 2116)
+++ trunk/jsword/src/main/resources/JSMsg.properties	2011-03-12 21:34:29 UTC (rev 2117)
@@ -33,7 +33,7 @@
 Major\ Prophets=Major Prophets
 Maps=Maps
 Minor\ Prophets=Minor Prophets
-No\ entry\ for\ '{0}'\ in\ {1}.=No entry for '{0}' in {1}.
+No\ entry\ for\ ''{0}''\ in\ {1}.=No entry for ''{0}'' in {1}.
 Not\ a\ valid\ Strong's\ Number\ "{0}"=Not a valid Strong\\'s Number "{0}"
 Optimizing=Optimizing
 Other=Other

Modified: trunk/jsword/src/main/resources/JSMsg_fa.properties
===================================================================
--- trunk/jsword/src/main/resources/JSMsg_fa.properties	2011-03-12 20:30:34 UTC (rev 2116)
+++ trunk/jsword/src/main/resources/JSMsg_fa.properties	2011-03-12 21:34:29 UTC (rev 2117)
@@ -33,7 +33,7 @@
 Major\ Prophets=\u0646\u0628\u06CC\u0647\u0627\u06CC \u0628\u0632\u0631\u06AF
 Maps=\u0646\u0642\u0634\u0629\u0647\u0627
 Minor\ Prophets=\u0646\u0628\u06CC\u0647\u0627\u06CC \u06A9\u0648\u062C\u06A9
-No\ entry\ for\ '{0}'\ in\ {1}.='{0}' \u0648\u0686\u0648\u062F \u0646\u062F\u0631\u062F \u062F\u0631 {1}.
+No\ entry\ for\ ''{0}''\ in\ {1}.=''{0}'' \u0648\u0686\u0648\u062F \u0646\u062F\u0631\u062F \u062F\u0631 {1}.
 Optimizing=\u0645\u0646\u0627\u0633\u0628 \u06A9\u0631\u062F\u0646
 Other=\u062F\u06CC\u06AF\u0627\u0631
 Pentateuch=\u062A\u0648\u0631\u0627\u062A
@@ -43,7 +43,7 @@
 Search\ failed.=\u0686\u0633\u062A\u0686\u0648 \u0645\u0634\u06A9\u0644 \u067E\u06CC\u062F\u0627 \u06A9\u0631\u062F.
 Show\ this\ warning\ every\ time\ the\ Internet\ is\ accessed.=\u0647\u0631 \u0648\u0642\u062A \u06A9\u0647 \u0628\u0647 \u0627\u06CC\u0646\u062A\u0631\u0646\u062A \u0648\u0632\u0644 \u0634\u0648\u06CC\u062F \u060C \u0627\u0632 \u0634\u0645\u0627 \u0633\u0627\u0639\u0644 \u06A9\u0646\u06CC\u0645\u061F 
 Syntax\ Error\:\ Invalid\ passage\ "{0}"=\:\u0627\u06CC\u0646 \u0642\u0633\u0645\u062A \u0648\u062C\u0648\u062F \u0646\u062F\u0631\u062F\:"{0}"
-The\ following\ verses\ have\ errors\ and\ could\ not\ be\ indexed\\\\n{0}=\u0627\u0646 \u0627\u06CC\u0627\u062A \u0645\u0634\u06A9\u0644 \u062F\u0631\u0646\u062F \u0648 \u0627\u0646\u062F\u06A9\u0633 \u0646\u0634\u062F\u0647\u200C\u0627\u0646\u062F\n{0}
+The\ following\ verses\ have\ errors\ and\ could\ not\ be\ indexed\\\\\\\\n{0}=\u0627\u0646 \u0627\u06CC\u0627\u062A \u0645\u0634\u06A9\u0644 \u062F\u0631\u0646\u062F \u0648 \u0627\u0646\u062F\u06A9\u0633 \u0646\u0634\u062F\u0647\u200C\u0627\u0646\u062F\n{0}
 Unable\ to\ delete\:\ {0}={0} \u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646 \u063A\u06CC\u0631 \u0645\u0645\u06A9\u0646
 Unable\ to\ find\:\ {0}={0} \u067E\u06CC\u062F\u0627 \u0646\u06A9\u0631\u062F\u0645
 Unable\ to\ save\ the\ book's\ unlock\ key.=\u06A9\u0644\u06CC\u062F \u0627\u06CC\u0646 \u06A9\u062A\u0627\u0628 \u0627\u0646\u0628\u0627\u0631 \u0646\u0634\u062F

Modified: trunk/jsword/src/main/resources/JSMsg_in.properties
===================================================================
--- trunk/jsword/src/main/resources/JSMsg_in.properties	2011-03-12 20:30:34 UTC (rev 2116)
+++ trunk/jsword/src/main/resources/JSMsg_in.properties	2011-03-12 21:34:29 UTC (rev 2117)
@@ -1,45 +1,46 @@
+
 A\ verse\ range\ cannot\ have\ more\ than\ 2\ parts.\ (Parts\ are\ separated\ by\ {0})\ Given\ {1}=Batasan ayat tidak dapat mempunyai lebih dari 2 bagian. (Bagian di pisahkan dengan {0}) Given {1}
-Bible\ called\ "{0}"\ could\ not\ be\ found. = Biblika "{0}" tidak dapat ditemukan.
-Biblical\ Texts = Teks Biblika
+Bible\ called\ "{0}"\ could\ not\ be\ found.=Biblika "{0}" tidak dapat ditemukan.
+Biblical\ Texts=Teks Biblika
 Book\ and\ chapter\ are\ missing=Kitab dan pasal tidak di temukan
 Book\ is\ missing=Kitab tidak di temukan
 Cannot\ understand\ {0}\ as\ a\ chapter\ or\ verse.=Tidak dapat menguraikan {0} sebagai pasal atau ayat.
-Chapter\ should\ be\ between\ {0}\ and\ {1,number,integer}\ for\ {2}\ (given\ {3,number,integer}). = Pasal seharusnya antara {0} dan {1,number,integer} untuk {2} (given {3,number,integer}).
-Commentaries = Komentar
-Commentary\ called\ "{0}"\ could\ not\ be\ found. = Komentar "{0}" tidak dapat ditemukan.
+Chapter\ should\ be\ between\ {0}\ and\ {1,number,integer}\ for\ {2}\ (given\ {3,number,integer}).=Pasal seharusnya antara {0} dan {1,number,integer} untuk {2} (given {3,number,integer}).
+Commentaries=Komentar
+Commentary\ called\ "{0}"\ could\ not\ be\ found.=Komentar "{0}" tidak dapat ditemukan.
 Copying\ config\ file=Mengkopi berkas config
-Cults\ /\ Unorthodox\ /\ Questionable\ Materials = Aliran / Tidak Lazim / Meragukan
-Daily\ Devotionals = Renungan Harian
-Dictionaries = Kamus
-Dictionary\ called\ "{0}"\ could\ not\ be\ found. = Kamus "{0}" tidak dapat ditemukan.
+Cults\ /\ Unorthodox\ /\ Questionable\ Materials=Aliran / Tidak Lazim / Meragukan
+Daily\ Devotionals=Renungan Harian
+Dictionaries=Kamus
+Dictionary\ called\ "{0}"\ could\ not\ be\ found.=Kamus "{0}" tidak dapat ditemukan.
 Done=Selesai
 Downloading\ files=Mengunduh berkas
-Error\ reading\ {0} = Gagal membaca {0}
-Essays = Esai
-General\ Books = Buku Umum
-Glossaries = Daftar Istilah
-Gospels\ And\ Acts = Injil Dan Kis
-History = Sejarah
-Images = Gambar
+Error\ reading\ {0}=Gagal membaca {0}
+Essays=Esai
+General\ Books=Buku Umum
+Glossaries=Daftar Istilah
+Gospels\ And\ Acts=Injil Dan Kis
+History=Sejarah
+Images=Gambar
 Initializing=Inisialisasi
 Installing\ book\:\ {0}=Menginstall buku\: {0}
-Key\ not\ found\ {0} = Kunci tidak ditemukan {0}
-Letters = Surat
-Major\ Prophets = Nabi Besar
-Maps = Peta
-Minor\ Prophets = Nabi Kecil
-No\ entry\ for\ '{0}'\ in\ {1}. = Tidak ada entri untuk '{0}' di {1}.
-Other = Lain lain
-Pentateuch = 5 Kitab Musa
-Poetry = Puisi
-Readings = Membaca
-Revelation = Wahyu
-Show\ this\ warning\ every\ time\ the\ Internet\ is\ accessed. = Tampilkan peringatan ini setiap kali akan melalukan koneksi Internet..
-Syntax\ Error\:\ Invalid\ passage\ "{0}" = Kesalahan sintaksis: Invalid passage "{0}"
+Key\ not\ found\ {0}=Kunci tidak ditemukan {0}
+Letters=Surat
+Major\ Prophets=Nabi Besar
+Maps=Peta
+Minor\ Prophets=Nabi Kecil
+No\ entry\ for\ ''{0}''\ in\ {1}.=Tidak ada entri untuk ''{0}'' di {1}.
+Other=Lain lain
+Pentateuch=5 Kitab Musa
+Poetry=Puisi
+Readings=Membaca
+Revelation=Wahyu
+Show\ this\ warning\ every\ time\ the\ Internet\ is\ accessed.=Tampilkan peringatan ini setiap kali akan melalukan koneksi Internet..
+Syntax\ Error\:\ Invalid\ passage\ "{0}"=Kesalahan sintaksis\: Invalid passage "{0}"
 Too\ many\ parts\ to\ the\ Verse.\ (Parts\ are\ separated\ by\ any\ of\ {0})=Terlalu banyak bagian dalam ayat. (Bagian dapat di dipisahkan dengan {0})
-Unable\ to\ delete\:\ {0} = Gagal menghapus: {0}
+Unable\ to\ delete\:\ {0}=Gagal menghapus\: {0}
 Unable\ to\ find\:\ {0}=Tidak dapat menemukan\: {0}
-Unable\ to\ save\ the\ book's\ unlock\ key. = Gagal menyimpan kata kunci untuk buku.
-Verse\ should\ be\ between\ {0}\ and\ {1,number,integer}\ for\ {2}\ {3,number,integer}\ (given\ {4,number,integer}). = Ayat seharusnya antara {0} dan {1,number,integer} untuk {2} {3,number,integer} (given {4,number,integer}).
-You\ are\ about\ to\ access\ the\ Internet.\ Are\ you\ sure\ you\ want\ to\ do\ this? = Anda akan melakukan koneksi melalaui Internet. Apakah anda yakin mau melakukan ini?
+Unable\ to\ save\ the\ book's\ unlock\ key.=Gagal menyimpan kata kunci untuk buku.
+Verse\ should\ be\ between\ {0}\ and\ {1,number,integer}\ for\ {2}\ {3,number,integer}\ (given\ {4,number,integer}).=Ayat seharusnya antara {0} dan {1,number,integer} untuk {2} {3,number,integer} (given {4,number,integer}).
+You\ are\ about\ to\ access\ the\ Internet.\ Are\ you\ sure\ you\ want\ to\ do\ this?=Anda akan melakukan koneksi melalaui Internet. Apakah anda yakin mau melakukan ini?
 {0,number,integer}\ {0,choice,0\#verses|1\#verse|1<verses}\ in\ {1,number,integer}\ {1,choice,0\#books|1\#book|1<books}={0,number,integer} {0,choice,0\#verses|1\#verse|1<verses} in {1,number,integer} {1,choice,0\#books|1\#book|1<books}

Modified: trunk/jsword/src/main/resources/JSMsg_zh.properties
===================================================================
--- trunk/jsword/src/main/resources/JSMsg_zh.properties	2011-03-12 20:30:34 UTC (rev 2116)
+++ trunk/jsword/src/main/resources/JSMsg_zh.properties	2011-03-12 21:34:29 UTC (rev 2117)
@@ -1,27 +1,24 @@
-Bible\ called\ "{0}"\ could\ not\ be\ found. = Bible called "{0}" could not be found.
-Biblical\ Texts = \u8056\u7D93
-Commentaries = \u8A55\u8AD6
-Commentary\ called\ "{0}"\ could\ not\ be\ found. = Commentary called "{0}" could not be found.
+
+Biblical\ Texts=\u8056\u7D93
+Commentaries=\u8A55\u8AD6
 Copying\ config\ file=\u8986\u88FD\u8A2D\u5B9A\u6A94
-Cults\ /\ Unorthodox\ /\ Questionable\ Materials = \u72C2\u71B1 / \u975E\u6B63\u7D71 / \u4E0D\u53EF\u53D6\u7684
-Daily\ Devotionals = \u6BCF\u65E5\u8B80\u7D93
-Dictionaries = \u5B57\u5178
-Dictionary\ called\ "{0}"\ could\ not\ be\ found. = Dictionary called "{0}" could not be found.
+Cults\ /\ Unorthodox\ /\ Questionable\ Materials=\u72C2\u71B1 / \u975E\u6B63\u7D71 / \u4E0D\u53EF\u53D6\u7684
+Daily\ Devotionals=\u6BCF\u65E5\u8B80\u7D93
+Dictionaries=\u5B57\u5178
 Downloading\ files=\u6B63\u5728\u4E0B\u8F09\u6A94\u6848
-General\ Books = \u666E\u904D\u7684\u66F8\u7C4D
-Glossaries = \u8A5E\u532F\u8868
-Gospels\ And\ Acts = \u798f\u97f3\u66f8
-History = \u6b77\u53f2\u66f8
+General\ Books=\u666E\u904D\u7684\u66F8\u7C4D
+Glossaries=\u8A5E\u532F\u8868
+Gospels\ And\ Acts=\u798F\u97F3\u66F8
+History=\u6B77\u53F2\u66F8
 Initializing=\u521D\u59CB\u5316
 Installing\ book\:\ {0}=\u6B63\u5728\u5B89\u88DD\u66F8\u7C4D\: {0}
-Key\ not\ found\ {0} = Key not found {0}
-Letters = \u4f7f\u5f92\u66f8\u4fe1
-Major\ Prophets = \u5927\u5148\u77e5\u66f8
-Minor\ Prophets = \u5c0f\u5148\u77e5\u66f8
-Other = \u5176\u4ED6
-Pentateuch = \u6469\u897f\u4e94\u7d93
-Poetry = \u8a69\u6b4c\u66f8
-Readings = \u95B1\u8B80
-Revelation = \u555f\u793a\u9304
+Letters=\u4F7F\u5F92\u66F8\u4FE1
+Major\ Prophets=\u5927\u5148\u77E5\u66F8
+Minor\ Prophets=\u5C0F\u5148\u77E5\u66F8
+Other=\u5176\u4ED6
+Pentateuch=\u6469\u897F\u4E94\u7D93
+Poetry=\u8A69\u6B4C\u66F8
+Readings=\u95B1\u8B80
+Revelation=\u555F\u793A\u9304
 Unable\ to\ find\:\ {0}=\u7121\u6CD5\u627E\u5230\: {0}
 You\ are\ about\ to\ access\ the\ Internet.\ Are\ you\ sure\ you\ want\ to\ do\ this?=\u4F60\u5C07\u8981\u9032\u5165\u7DB2\u8DEF.\u78BA\u5B9A\u6216\u5426?




More information about the jsword-svn mailing list