]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Add text to all RuntimeExceptions.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sat, 27 Feb 2016 13:20:42 +0000 (14:20 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sat, 27 Feb 2016 13:20:42 +0000 (14:20 +0100)
src/com/hughes/android/dictionary/DictionaryManagerActivity.java
src/com/hughes/android/dictionary/HtmlDisplayActivity.java
src/com/hughes/android/dictionary/engine/HtmlEntry.java
src/com/hughes/android/dictionary/engine/TextEntry.java

index 3c4a0ea8318eba1a788cb33fa947b275dbb2892c..0d12ad0bef42c2214de7254edb2f3da0dba5064d 100644 (file)
@@ -664,7 +664,7 @@ public class DictionaryManagerActivity extends ActionBarActivity {
                         .getExternalStorageDirectory(), destFile)));
             }
         } catch (MalformedURLException e) {
-            throw new RuntimeException(e);
+            throw new RuntimeException("Download manager refuses download URL!", e);
         }
         downloadManager.enqueue(request);
         downloadButton.setText("X");
index b174da636ecd25a280cade683711217ab9570e53..bf8eda232284bb01bc876252851b191dff8d990a 100644 (file)
@@ -90,7 +90,7 @@ public final class HtmlDisplayActivity extends ActionBarActivity {
             // No way to get pure UTF-8 data into WebView\r
             html = Base64.encodeToString(html.getBytes("UTF-8"), Base64.DEFAULT);\r
         } catch (UnsupportedEncodingException e) {\r
-            throw new RuntimeException(e);\r
+            throw new RuntimeException("Missing UTF-8 support?!", e);\r
         }\r
         // Use loadURL to allow specifying a charset\r
         webView.loadUrl("data:text/html;charset=utf-8;base64," + html);\r
index 4d7b534cff0ef115a4e8ed08df00943ed55ea5a1..f5ea520992e5521e1e810f781432a2edbc677514 100644 (file)
@@ -246,7 +246,7 @@ public class HtmlEntry extends AbstractEntry implements Comparable<HtmlEntry> {
                 try {
                     html = new String(data.get(index), "UTF-8");
                 } catch (UnsupportedEncodingException e) {
-                    throw new RuntimeException(e);
+                    throw new RuntimeException("Dictionary HTML data corrupted", e);
                 }
                 htmlRef = new SoftReference<String>(html);
                 return html;
@@ -259,14 +259,14 @@ public class HtmlEntry extends AbstractEntry implements Comparable<HtmlEntry> {
                     raf.seek(offset);
                     raf.read(zipBytes);
                 } catch (IOException e) {
-                    throw new RuntimeException(e);
+                    throw new RuntimeException("Failed to read HTML data from dictionary", e);
                 }
             }
             try {
                 final byte[] bytes = StringUtil.unzipFully(zipBytes, numBytes);
                 html = new String(bytes, "UTF-8");
             } catch (IOException e) {
-                throw new RuntimeException(e);
+                throw new RuntimeException("Dictionary HTML data corrupted", e);
             }
             htmlRef = new SoftReference<String>(html);
             return html;
index 449d83dcd2b63741bc01628778823d0de243de03..88188ded58cbd4917fb59d4b4a9fbcc767e53bae 100644 (file)
@@ -33,7 +33,7 @@ public class TextEntry extends AbstractEntry implements RAFSerializable<TextEntr
             throws IOException {
         super(dictionary, raf, index);
         text = raf.readUTF();
-        throw new RuntimeException();
+        throw new RuntimeException("TextEntry constructor should be unreachable");
     }
 
     @Override