OSDN Git Service

Capture generic errors and log the others.
authorRandy Baumgarte <randy@fbn.cx>
Thu, 30 Dec 2010 11:40:34 +0000 (06:40 -0500)
committerRandy Baumgarte <randy@fbn.cx>
Sat, 1 Jan 2011 23:40:42 +0000 (18:40 -0500)
src/cx/fbn/nevernote/threads/IndexRunner.java

index a02b61f..1ace4c0 100644 (file)
@@ -144,8 +144,7 @@ public class IndexRunner extends QObject implements Runnable {
                                        reindexNote();\r
                                }\r
                        } catch (InterruptedException e) {\r
-                               // TODO Auto-generated catch block\r
-                               e.printStackTrace();\r
+                               logger.log(logger.LOW, "Thread interrupted exception: " +e.getMessage());\r
                        }\r
                }\r
                logger.log(logger.EXTREME, "Shutting down database");\r
@@ -317,19 +316,19 @@ public class IndexRunner extends QObject implements Runnable {
                } catch (java.lang.ClassCastException e) {\r
                        logger.log(logger.LOW, "Cast exception: " +e.getMessage());\r
                } catch (FileNotFoundException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "FileNotFound  exception: " +e.getMessage());\r
                } catch (IOException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "IO  exception: " +e.getMessage());\r
                } catch (SAXException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "SAX  exception: " +e.getMessage());\r
                } catch (TikaException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Tika  exception: " +e.getMessage());\r
                } catch (Exception e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Unknown  exception: " +e.getMessage());\r
+               } catch (java.lang.NoSuchMethodError e) {\r
+                       logger.log(logger.LOW, "NoSuchMethod error: " +e.getMessage());\r
+               } catch (Error e) {\r
+                       logger.log(logger.LOW, "Unknown error: " +e.getMessage());\r
                }\r
        }\r
 \r
@@ -359,19 +358,19 @@ public class IndexRunner extends QObject implements Runnable {
                } catch (java.lang.ClassCastException e) {\r
                        logger.log(logger.LOW, "Cast exception: " +e.getMessage());\r
                } catch (FileNotFoundException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "FileNotFound  exception: " +e.getMessage());\r
                } catch (IOException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "IO  exception: " +e.getMessage());\r
                } catch (SAXException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "SAX  exception: " +e.getMessage());\r
                } catch (TikaException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Tika  exception: " +e.getMessage());\r
                } catch (Exception e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Unknown  exception: " +e.getMessage());\r
+               } catch (java.lang.NoSuchMethodError e) {\r
+                       logger.log(logger.LOW, "NoSuchMethod error: " +e.getMessage());\r
+               } catch (Error e) {\r
+                       logger.log(logger.LOW, "Unknown error: " +e.getMessage());\r
                }\r
        }\r
 \r
@@ -401,19 +400,19 @@ public class IndexRunner extends QObject implements Runnable {
                } catch (java.lang.ClassCastException e) {\r
                        logger.log(logger.LOW, "Cast exception: " +e.getMessage());\r
                } catch (FileNotFoundException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "FileNotFound  exception: " +e.getMessage());\r
                } catch (IOException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "IO  exception: " +e.getMessage());\r
                } catch (SAXException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "SAX  exception: " +e.getMessage());\r
                } catch (TikaException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Tika  exception: " +e.getMessage());\r
                } catch (Exception e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Unknown  exception: " +e.getMessage());\r
+               } catch (java.lang.NoSuchMethodError e) {\r
+                       logger.log(logger.LOW, "NoSuchMethod error: " +e.getMessage());\r
+               } catch (Error e) {\r
+                       logger.log(logger.LOW, "Unknown error: " +e.getMessage());\r
                }\r
        }\r
 \r
@@ -444,15 +443,19 @@ public class IndexRunner extends QObject implements Runnable {
                } catch (java.lang.ClassCastException e) {\r
                        logger.log(logger.LOW, "Cast exception: " +e.getMessage());\r
                } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "FileNotFound  exception: " +e.getMessage());\r
                } catch (IOException e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "IO  exception: " +e.getMessage());\r
                } catch (SAXException e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "SAX  exception: " +e.getMessage());\r
                } catch (TikaException e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Tika  exception: " +e.getMessage());\r
                } catch (Exception e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Unknown  exception: " +e.getMessage());\r
+               } catch (java.lang.NoSuchMethodError e) {\r
+                       logger.log(logger.LOW, "NoSuchMethod error: " +e.getMessage());\r
+               } catch (Error e) {\r
+                       logger.log(logger.LOW, "Unknown error: " +e.getMessage());\r
                }\r
        }\r
        \r
@@ -482,19 +485,19 @@ public class IndexRunner extends QObject implements Runnable {
                } catch (java.lang.ClassCastException e) {\r
                        logger.log(logger.LOW, "Cast exception: " +e.getMessage());\r
                } catch (FileNotFoundException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "FileNotFound  exception: " +e.getMessage());\r
                } catch (IOException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "IO  exception: " +e.getMessage());\r
                } catch (SAXException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "SAX  exception: " +e.getMessage());\r
                } catch (TikaException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Tika  exception: " +e.getMessage());\r
                } catch (Exception e) {\r
-                       e.printStackTrace();\r
+                       logger.log(logger.LOW, "Unknown  exception: " +e.getMessage());\r
+               } catch (java.lang.NoSuchMethodError e) {\r
+                       logger.log(logger.LOW, "NoSuchMethod error: " +e.getMessage());\r
+               } catch (Error e) {\r
+                       logger.log(logger.LOW, "Unknown error: " +e.getMessage());\r
                }\r
        }\r
        \r
@@ -506,7 +509,7 @@ public class IndexRunner extends QObject implements Runnable {
                newFile.write(d.getBody());\r
                newFile.close();\r
                return newFile;\r
-       }\r
+       } \r
 \r
        \r
        private String removeEnCrypt(String content) {\r