OSDN Git Service

Add additional debug messages.
authorRandy Baumgarte <randy@fbn.cx>
Mon, 31 Oct 2011 13:43:02 +0000 (09:43 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Mon, 31 Oct 2011 13:43:02 +0000 (09:43 -0400)
src/cx/fbn/nevernote/threads/SyncRunner.java

index 68dbd02..7526577 100644 (file)
@@ -1842,7 +1842,7 @@ public class SyncRunner extends QObject implements Runnable {
        //* Begin syncing shared notebooks \r
        //******************************************\r
     private void syncLinkedNotebooks() {\r
-       logger.log(logger.MEDIUM, "Authenticating Shared Notebooks");\r
+       logger.log(logger.MEDIUM, "Authenticating linked Notebooks");\r
        status.message.emit(tr("Synchronizing shared notebooks."));\r
        List<LinkedNotebook> books = conn.getLinkedNotebookTable().getAll();\r
        \r
@@ -1852,6 +1852,7 @@ public class SyncRunner extends QObject implements Runnable {
                if (errorSharedNotebooksIgnored.containsKey(books.get(i).getGuid()))\r
                        break;\r
                try {\r
+                       logger.log(logger.EXTREME, "Checking notebook: " +books.get(i).getShareName());\r
                                long lastSyncDate = conn.getLinkedNotebookTable().getLastSequenceDate(books.get(i).getGuid());\r
                                int lastSequenceNumber = conn.getLinkedNotebookTable().getLastSequenceNumber(books.get(i).getGuid());\r
 \r
@@ -1870,18 +1871,19 @@ public class SyncRunner extends QObject implements Runnable {
                                        linkedAuthResult = linkedNoteStore.authenticateToSharedNotebook(books.get(i).getShareKey(), authToken);\r
                                        logger.log(logger.EXTREME, "Authentication Token" +linkedAuthResult.getAuthenticationToken());\r
                                } else {\r
-                                       logger.log(logger.EXTREME, "Share key is null ");\r
+                                       logger.log(logger.EXTREME, "Share key is null");\r
                                        linkedAuthResult = new AuthenticationResult();\r
                                        linkedAuthResult.setAuthenticationToken("");\r
                                }\r
                                SyncState linkedSyncState = \r
                                        linkedNoteStore.getLinkedNotebookSyncState(linkedAuthResult.getAuthenticationToken(), books.get(i));\r
                                if (linkedSyncState.getUpdateCount() > lastSequenceNumber) {\r
+                                       logger.log(logger.EXTREME, "Remote changes found");\r
                                        if (lastSyncDate < linkedSyncState.getFullSyncBefore()) {\r
                                                lastSequenceNumber = 0;\r
                                        } \r
+                                       logger.log(logger.EXTREME, "Calling syncLinkedNotebook for " +books.get(i).getShareName());\r
                                        syncLinkedNotebook(linkedNoteStore, books.get(i), \r
-                                                       //lastSequenceNumber, linkedSyncState.getUpdateCount(), linkedAuthResult.getAuthenticationToken());\r
                                                        lastSequenceNumber, linkedSyncState.getUpdateCount(), authToken);\r
                                }\r
                        \r
@@ -2012,8 +2014,10 @@ public class SyncRunner extends QObject implements Runnable {
                if (notebooks != null) {\r
                        for (int i=0; i<notebooks.size() && keepRunning; i++) {\r
                                try {\r
+                                       logger.log(logger.EXTREME, "auth token:" +linkedAuthResult.getAuthenticationToken());\r
                                        if (!linkedAuthResult.getAuthenticationToken().equals("")) {\r
                                                SharedNotebook s = noteStore.getSharedNotebookByAuth(linkedAuthResult.getAuthenticationToken());\r
+                                               logger.log(logger.EXTREME, "share key:"+s.getShareKey() +" notebookGuid" +s.getNotebookGuid());\r
                                                conn.getLinkedNotebookTable().setNotebookGuid(s.getShareKey(), s.getNotebookGuid());\r
                                                readOnly = !s.isNotebookModifiable();\r
                                        } else {\r
@@ -2070,11 +2074,16 @@ public class SyncRunner extends QObject implements Runnable {
 \r
        // Synchronize changes locally done to linked notes\r
        private void syncLocalLinkedNoteChanges(Client noteStore, LinkedNotebook book) {\r
+               logger.log(logger.EXTREME, "Entering SyncRunner.synclocalLinkedNoteChanges");\r
                String notebookGuid = conn.getLinkedNotebookTable().getNotebookGuid(book.getGuid());\r
+               logger.log(logger.EXTREME, "Finding changes for " +book.getShareName() +":" +book.getGuid() + ":" +notebookGuid);\r
                List<Note> notes = conn.getNoteTable().getDirtyLinked(notebookGuid);\r
+               logger.log(logger.EXTREME, "Number of changes found: " +notes.size());\r
                for (int i=0; i<notes.size(); i++) {\r
+                       logger.log(logger.EXTREME, "Calling syncLocalNote with key " +linkedAuthResult.getAuthenticationToken());\r
                        syncLocalNote(noteStore, notes.get(i), linkedAuthResult.getAuthenticationToken());\r
                }\r
+               logger.log(logger.EXTREME, "Leaving SyncRunner.synclocalLinkedNoteChanges");\r
        }\r
 \r
 }\r