OSDN Git Service

T29566
authorYuji Konishi <yuji.k64613@gmail.com>
Sat, 15 Sep 2012 04:34:11 +0000 (13:34 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Sat, 15 Sep 2012 04:34:11 +0000 (13:34 +0900)
source/workspace/EverFolder/gen/com/yuji/ef/R.java
source/workspace/EverFolder/src/com/yuji/ef/BookListActivity.java
source/workspace/EverFolder/src/com/yuji/ef/EverFolderActivity.java
source/workspace/EverFolder/src/com/yuji/ef/Initialize.java
source/workspace/EverFolder/src/com/yuji/ef/exception/EfException.java

index 507b743..33e5eef 100644 (file)
@@ -60,9 +60,9 @@ public final class R {
         public static final int setting=0x7f030004;
     }
     public static final class string {
-        public static final int ErrorLogin=0x7f050024;
-        public static final int ErrorSystem=0x7f050025;
-        public static final int ErrorUpdate=0x7f050023;
+        public static final int ErrorLogin=0x7f050027;
+        public static final int ErrorSystem=0x7f050028;
+        public static final int ErrorUpdate=0x7f050026;
         public static final int MenuAdd=0x7f05001f;
         public static final int MenuCut=0x7f05001d;
         public static final int MenuDelete=0x7f050020;
@@ -72,8 +72,8 @@ public final class R {
         public static final int app_name=0x7f050000;
         public static final int cancelButton=0x7f050003;
         public static final int closeButton=0x7f050004;
-        public static final int dialogErrorTitle=0x7f050026;
-        public static final int dialogSystemError=0x7f050027;
+        public static final int dialogErrorTitle=0x7f050023;
+        public static final int dialogSystemError=0x7f050024;
         public static final int mainAddMsg=0x7f050008;
         public static final int mainConfirmMsg=0x7f050006;
         public static final int mainConfirmTitle=0x7f050005;
@@ -99,7 +99,7 @@ public final class R {
         public static final int settingUpdateMsg=0x7f05000f;
         public static final int settingUpdateTimeTitle=0x7f05001c;
         public static final int settingUpdateTitle=0x7f05001a;
-        public static final int toastSystem=0x7f050028;
+        public static final int toastSystem=0x7f050025;
         public static final int yesButton=0x7f050001;
     }
 }
index e7b85b3..d374fa4 100644 (file)
@@ -55,7 +55,7 @@ public class BookListActivity extends BaseActivity {
                                                dao.updateSelected(item, selected);\r
                                        }\r
                                        catch (Exception e){\r
-                                               EfException.msg(R.string.ErrorSystem);\r
+                                               EfException.msg(R.string.ErrorSystem, e);\r
                                        }\r
                                }\r
                        });\r
index 9631cb5..841853b 100644 (file)
@@ -197,7 +197,7 @@ public class EverFolderActivity extends BaseActivity implements LockListener {
                        leftButton.setTextSize(fSize);
                        rightButton.setTextSize(fSize);
                } catch (Exception e) {
-                       EfException.msg(R.string.ErrorSystem);
+                       EfException.msg(R.string.ErrorSystem, e);
                }
        }
 
@@ -446,7 +446,8 @@ public class EverFolderActivity extends BaseActivity implements LockListener {
                NodeDao dao = (NodeDao) NodeCacheDao.getInstance();
                top = dao.searchRoot();
                if (top == null) {
-                       EfException.msg(R.string.ErrorSystem);
+                       EfException.msg(R.string.ErrorSystem, new EfException(
+                                       EfError.SYSTEM));
                        return;
                }
                updateList(top);
@@ -780,7 +781,7 @@ public class EverFolderActivity extends BaseActivity implements LockListener {
                                db.endTransaction();
                        }
                } catch (EfException e) {
-                       EfException.msg(R.string.ErrorSystem);
+                       EfException.msg(R.string.ErrorSystem, e);
                } finally {
                        updateList();
                }
@@ -821,7 +822,7 @@ public class EverFolderActivity extends BaseActivity implements LockListener {
 
                        updateList();
                } catch (EfException e) {
-                       EfException.msg(R.string.ErrorSystem);
+                       EfException.msg(R.string.ErrorSystem, e);
                }
        }
 
@@ -921,8 +922,8 @@ public class EverFolderActivity extends BaseActivity implements LockListener {
                                leftButton.setEnabled(false);
                                rightButton.setEnabled(false);
                        }
-               } catch (Throwable e) {
-                       EfException.msg(R.string.ErrorSystem);
+               } catch (Exception e) {
+                       EfException.msg(R.string.ErrorSystem, e);
                }
        }
 
index 7f0879e..0d74941 100644 (file)
@@ -35,7 +35,7 @@ public class Initialize {
                        
                        isInit = false;
                } catch (Exception e) {
-                       EfException.msg(R.string.ErrorSystem);
+                       EfException.msg(R.string.ErrorSystem, e);
                        throw new EfException(EfError.INIT);
                }
        }
index 429fb64..d143e45 100644 (file)
@@ -23,17 +23,48 @@ public class EfException extends Exception {
        }
 
        public static void msg(int id){
+               msg(id, null);
+       }
+       
+       public static void msg(int id, Exception e){
                String msg = Initialize.getContext().getString(id);
+               if (e != null){
+                       msg += getMessageInfo(e);
+               }
                msg(msg);
        }
-       
+
        public static void msg(String msg){
+               msg(msg, null);
+       }
+       
+       public static void msg(String msg, Exception e){
+               if (e != null){
+                       msg += getMessageInfo(e);
+               }
                Intent intent = new Intent(Constant.ACTION_MESSAGE);
                intent.putExtra(Constant.ACTION_MESSAGE_MESSAGE, msg);
                Initialize.getContext().sendBroadcast(intent);
        }
-       
+
        public static void msg(Context context, String msg) {
+               msg(context, msg, null);
+       }
+       
+       public static void msg(Context context, String msg, Exception e) {
+               if (e != null){
+                       msg += getMessageInfo(e);
+               }
                Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
        }
+       
+       public static String getMessageInfo(Exception e){
+               StackTraceElement[] st = e.getStackTrace();
+               StackTraceElement elem = st[0];
+               String clazz = elem.getClassName();
+               String method = elem.getMethodName();
+               int line = elem.getLineNumber();
+               
+               return " [" + clazz + " " + method + "() " + line + "]";
+       }
 }