OSDN Git Service

loggerを修正した
authoryuki <kimaira7@gmail.com>
Wed, 6 Nov 2013 02:31:54 +0000 (11:31 +0900)
committeryuki <kimaira7@gmail.com>
Wed, 6 Nov 2013 02:31:54 +0000 (11:31 +0900)
src/cx/fbn/nevernote/gui/RensoNoteList.java
src/cx/fbn/nevernote/threads/ENRelatedNotesRunner.java
src/cx/fbn/nevernote/threads/ENThumbnailRunner.java

index bdb5eeb..6a1f2fe 100644 (file)
@@ -42,6 +42,7 @@ import com.trolltech.qt.gui.QMenu;
 import cx.fbn.nevernote.Global;
 import cx.fbn.nevernote.NeverNote;
 import cx.fbn.nevernote.sql.DatabaseConnection;
+import cx.fbn.nevernote.threads.CounterRunner;
 import cx.fbn.nevernote.threads.ENRelatedNotesRunner;
 import cx.fbn.nevernote.threads.ENThumbnailRunner;
 import cx.fbn.nevernote.threads.SyncRunner;
@@ -82,13 +83,15 @@ public class RensoNoteList extends QListWidget {
                this.guid = new String();
                mergedHistory = new HashMap<String, Integer>();
                enRelatedNotesCache = new HashMap<String, List<String>>();
-               this.enRelatedNotesRunner = new ENRelatedNotesRunner(this.syncRunner, this.logger);
+               this.enRelatedNotesRunner = new ENRelatedNotesRunner(this.syncRunner, "enRelatedNotesRunner.log");
                this.enRelatedNotesRunner.enRelatedNotesSignal.getENRelatedNotesFinished.connect(this, "enRelatedNotesComplete()");
                this.enRelatedNotesRunner.limitSignal.rateLimitReached.connect(parent, "informRateLimit(Integer)");
                this.enRelatedNotesThread = new QThread(enRelatedNotesRunner, "ENRelatedNotes Thread");
                this.getEnRelatedNotesThread().start();
                
-               this.enThumbnailRunner = new ENThumbnailRunner(this.logger, this.conn);
+               this.enThumbnailRunner = new ENThumbnailRunner("enThumbnailRunner.log", CounterRunner.NOTEBOOK, 
+                                       Global.getDatabaseUrl(), Global.getIndexDatabaseUrl(), Global.getResourceDatabaseUrl(), Global.getBehaviorDatabaseUrl(),
+                                       Global.getDatabaseUserid(), Global.getDatabaseUserPassword(), Global.cipherPassword);
                this.enThumbnailRunner.enThumbnailSignal.getENThumbnailFinished.connect(this, "enThumbnailComplete(String)");
                this.enThumbnailRunner.limitSignal.rateLimitReached.connect(parent, "informRateLimit(Integer)");
                this.enThumbnailThread = new QThread(enThumbnailRunner, "ENThumbnail Thread");
index 8c0cee8..dab861a 100644 (file)
@@ -53,8 +53,8 @@ public class ENRelatedNotesRunner extends QObject implements Runnable{
        private volatile LinkedBlockingQueue<Pair<String, List<String>>> resultQueue;   // ペア<元ノートguid, 関連ノートguidリスト>を溜めておくキュー
        public volatile LimitSignal                                     limitSignal;
        
-       public ENRelatedNotesRunner(SyncRunner syncRunner, ApplicationLogger logger) {
-               this.logger = logger;
+       public ENRelatedNotesRunner(SyncRunner syncRunner, String logname) {
+               this.logger = new ApplicationLogger(logname);
                this.syncRunner = syncRunner;
                this.enRelatedNotesSignal = new ENRelatedNotesSignal();
                this.mutex = new QMutex();
index e9d434d..312fe83 100644 (file)
@@ -63,9 +63,9 @@ public class ENThumbnailRunner extends QObject implements Runnable{
        private volatile User                                                   user;
        private volatile String                                                 serverUrl;
        
-       public ENThumbnailRunner(ApplicationLogger logger, DatabaseConnection conn) {
-               this.logger = logger;
-               this.conn = conn;
+       public ENThumbnailRunner(String logname, int t, String u, String i, String r, String b, String uid, String pswd, String cpswd) {
+               this.logger = new ApplicationLogger(logname);
+               this.conn = new DatabaseConnection(logger, u, i, r, b, uid, pswd, cpswd, 0);
                this.enThumbnailSignal = new ENThumbnailSignal();
                this.mutex = new QMutex();
                this.keepRunning = true;
@@ -126,6 +126,7 @@ public class ENThumbnailRunner extends QObject implements Runnable{
        try {
                        aes.decrypt(new FileInputStream(Global.getFileManager().getHomeDirFile("oauth.txt")));
                } catch (FileNotFoundException e) {
+                       logger.log(logger.HIGH, "Evernoteサムネイル取得中に例外発生:FileNotFoundException");
                        e.printStackTrace();
                }
                String authString = aes.getString();
@@ -154,12 +155,15 @@ public class ENThumbnailRunner extends QObject implements Runnable{
                        byte[] bytes = EntityUtils.toByteArray(response.getEntity());
                        data = new QByteArray(bytes);
                } catch (UnsupportedEncodingException e) {
+                       logger.log(logger.HIGH, "Evernoteサムネイル取得中に例外発生:UnsupportedEncodingException");
                        e.printStackTrace();
                        return null;
                } catch (ClientProtocolException e) {
+                       logger.log(logger.HIGH, "Evernoteサムネイル取得中に例外発生:ClientProtocolException");
                        e.printStackTrace();
                        return null;
                } catch (IOException e) {
+                       logger.log(logger.HIGH, "Evernoteサムネイル取得中に例外発生:IOException");
                        e.printStackTrace();
                        return null;
                } finally {