Bug 713408 - Reduce log output from Profile Migrator. r=mfinkle
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Fri, 30 Dec 2011 02:40:56 +0100
changeset 84779 7da491d262a3692aed603c7b0b93613d7048b583
parent 84778 fe9f1fea02b8a324c4f08cca5832102f4b58f479
child 84780 aaf31de648913a9feaac42e4446521e830ad2df3
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs713408
milestone12.0a1
Bug 713408 - Reduce log output from Profile Migrator. r=mfinkle
mobile/android/base/ProfileMigrator.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -160,30 +160,25 @@ public class ProfileMigrator {
                 // inserted with places date
                 allowUpdate = true;
             } else {
                 long androidDate = androidHistory.get(url);
                 if (androidDate < date) {
                     // Places URL hit is newer than Android,
                     // allow it to be updated with places date
                     allowUpdate = true;
-                } else {
-                    Log.i(LOGTAG, "Android history is newer, not adding: " + url
-                          + " date: " + (new Date(date)).toString()
-                          + " android: " + (new Date(androidDate)).toString());
                 }
             }
 
             if (allowUpdate) {
                 BrowserDB.updateVisitedHistory(mCr, url);
                 BrowserDB.updateHistoryDate(mCr, url, date);
                 if (title != null) {
                     BrowserDB.updateHistoryTitle(mCr, url, title);
                 }
-                Log.i(LOGTAG, "Adding history: " + url);
             }
         }
 
         protected void migrateHistory(SQLiteDatabase db) {
             Map<String, Long> androidHistory = gatherAndroidHistory();
             final ArrayList<String> placesHistory = new ArrayList<String>();
 
             Cursor cursor = null;
@@ -198,18 +193,16 @@ public class ProfileMigrator {
                     cursor.getColumnIndexOrThrow(historyDate);
 
                 cursor.moveToFirst();
                 while (!cursor.isAfterLast()) {
                     String url = cursor.getString(urlCol);
                     String title = cursor.getString(titleCol);
                     // Convert from us (Places) to ms (Java, Android)
                     long date = cursor.getLong(dateCol) / (long)1000;
-                    Log.i(LOGTAG, "History: " + title + " URL: " + url
-                          + " time: " + (new Date(date)).toString());
                     addHistory(androidHistory, url, title, date);
                     placesHistory.add(url);
                     cursor.moveToNext();
                 }
 
                 cursor.close();
             } catch (SQLiteException e) {
                 if (cursor != null) {
@@ -226,17 +219,16 @@ public class ProfileMigrator {
                             GlobalHistory.getInstance().addToGeckoOnly(url);
                         }
                     }
              });
         }
 
         protected void addBookmark(String url, String title) {
             if (!BrowserDB.isBookmark(mCr, url)) {
-                Log.i(LOGTAG, "Adding bookmark: " + url);
                 if (title == null) {
                     title = url;
                 }
                 BrowserDB.addBookmark(mCr, title, url);
             }
         }
 
         protected void migrateBookmarks(SQLiteDatabase db) {
@@ -249,17 +241,16 @@ public class ProfileMigrator {
                         cursor.getColumnIndexOrThrow(bookmarkUrl);
                     final int titleCol =
                         cursor.getColumnIndexOrThrow(bookmarkTitle);
 
                     cursor.moveToFirst();
                     while (!cursor.isAfterLast()) {
                         String url = cursor.getString(urlCol);
                         String title = cursor.getString(titleCol);
-                        Log.i(LOGTAG, "Bookmark: " + title + " URL: " + url);
                         addBookmark(url, title);
                         cursor.moveToNext();
                     }
                 }
                 cursor.close();
             } catch (SQLiteException e) {
                 if (cursor != null) {
                     cursor.close();
@@ -269,19 +260,18 @@ public class ProfileMigrator {
             }
         }
 
         protected void addFavicon(String url, String mime, byte[] data) {
             ByteArrayInputStream byteStream = new ByteArrayInputStream(data);
             BitmapDrawable image = (BitmapDrawable) Drawable.createFromStream(byteStream, "src");
             try {
                 BrowserDB.updateFaviconForUrl(mCr, url, image);
-                Log.i(LOGTAG, "Favicon added: " + mime + " URL: " + url);
             } catch (SQLiteException e) {
-                Log.i(LOGTAG, "Favicon failed: " + mime + " URL: " + url
+                Log.i(LOGTAG, "Migrating favicon failed: " + mime + " URL: " + url
                       + " error:" + e.getMessage());
             }
         }
 
         protected void migrateFavicons(SQLiteDatabase db) {
             Cursor cursor = null;
             try {
                 cursor = db.rawQuery(faviconQuery,
@@ -344,16 +334,18 @@ public class ProfileMigrator {
                 migrateHistory(db);
                 migrateFavicons(db);
                 db.close();
 
                 // Clean up
                 dbFile.delete();
                 dbFileWal.delete();
                 dbFileShm.delete();
+
+                Log.i(LOGTAG, "Profile migration finished");
             } catch (SQLiteException e) {
                 if (db != null) {
                     db.close();
                 }
                 Log.i(LOGTAG, "Error on places database:" + e.getMessage());
                 return;
             }
         }