Bug 720325: add serialVersionUID for serializable WebSMS exception classes, r=blassey
authorVicamo Yang <vyang@mozilla.com>
Wed, 24 Oct 2012 21:37:21 +0800
changeset 111377 164d7dd54ee0864f9b9acff4de9448bf7e0a1256
parent 111376 46e58a7ec55e927fde50b1dcff0382039c23724c
child 111378 6c68ce017824b3090a30bfe9427b32fa6cdf4e84
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersblassey
bugs720325
milestone19.0a1
Bug 720325: add serialVersionUID for serializable WebSMS exception classes, r=blassey
embedding/android/GeckoSmsManager.java
mobile/android/base/GeckoSmsManager.java
--- a/embedding/android/GeckoSmsManager.java
+++ b/embedding/android/GeckoSmsManager.java
@@ -545,18 +545,16 @@ public class GeckoSmsManager
         Postman.getInstance().destroyEnvelope(envelopeId);
       }
 
       GeckoAppShell.notifySmsSendFailed(kUnknownError, aRequestId, aProcessId);
     }
   }
 
   public int saveSentMessage(String aRecipient, String aBody, long aDate) {
-    class IdTooHighException extends Exception { }
-
     try {
       ContentValues values = new ContentValues();
       values.put("address", aRecipient);
       values.put("body", aBody);
       values.put("date", aDate);
 
       ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
       Uri uri = cr.insert(kSmsSentContentUri, values);
@@ -588,21 +586,16 @@ public class GeckoSmsManager
       GetMessageRunnable(int aMessageId, int aRequestId, long aProcessId) {
         mMessageId = aMessageId;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class NotFoundException extends Exception { }
-        class UnmatchingIdException extends Exception { }
-        class TooManyResultsException extends Exception { }
-        class InvalidTypeException extends Exception { }
-
         Cursor cursor = null;
 
         try {
           ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
           Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
 
           cursor = cr.query(message, kRequiredMessageRows, null, null, null);
           if (cursor == null || cursor.getCount() == 0) {
@@ -675,18 +668,16 @@ public class GeckoSmsManager
       DeleteMessageRunnable(int aMessageId, int aRequestId, long aProcessId) {
         mMessageId = aMessageId;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class TooManyResultsException extends Exception { }
-
         try {
           ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
           Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
 
           int count = cr.delete(message, null, null);
 
           if (count > 1) {
             throw new TooManyResultsException();
@@ -728,19 +719,16 @@ public class GeckoSmsManager
         mDeliveryState = aDeliveryState;
         mReverse = aReverse;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class UnexpectedDeliveryStateException extends Exception { };
-        class InvalidTypeException extends Exception { }
-
         Cursor cursor = null;
         boolean closeCursor = true;
 
         try {
           // TODO: should use the |selectionArgs| argument in |ContentResolver.query()|.
           ArrayList<String> restrictions = new ArrayList<String>();
 
           if (mStartDate != 0) {
@@ -841,18 +829,16 @@ public class GeckoSmsManager
       GetNextMessageInListRunnable(int aListId, int aRequestId, long aProcessId) {
         mListId = aListId;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class UnexpectedDeliveryStateException extends Exception { };
-
         try {
           Cursor cursor = MessagesListManager.getInstance().get(mListId);
 
           if (!cursor.moveToNext()) {
             MessagesListManager.getInstance().remove(mListId);
             GeckoAppShell.notifyNoMessageInList(mRequestId, mProcessId);
             return;
           }
@@ -898,9 +884,33 @@ public class GeckoSmsManager
   public void stop() {
     GeckoApp.mAppContext.unregisterReceiver(this);
   }
 
   public void shutdown() {
     SmsIOThread.getInstance().interrupt();
     MessagesListManager.getInstance().clear();
   }
+
+  class IdTooHighException extends Exception {
+    private static final long serialVersionUID = 395697882128640L;
+  }
+
+  class InvalidTypeException extends Exception {
+    private static final long serialVersionUID = 23359904803795434L;
+  }
+
+  class NotFoundException extends Exception {
+    private static final long serialVersionUID = 266226999371957426L;
+  }
+
+  class TooManyResultsException extends Exception {
+    private static final long serialVersionUID = 48899777673841920L;
+  }
+
+  class UnexpectedDeliveryStateException extends Exception {
+    private static final long serialVersionUID = 5044567998961920L;
+  }
+
+  class UnmatchingIdException extends Exception {
+    private static final long serialVersionUID = 1935649715512128L;
+  }
 }
--- a/mobile/android/base/GeckoSmsManager.java
+++ b/mobile/android/base/GeckoSmsManager.java
@@ -538,18 +538,16 @@ public class GeckoSmsManager
         Postman.getInstance().destroyEnvelope(envelopeId);
       }
 
       GeckoAppShell.notifySmsSendFailed(kUnknownError, aRequestId, aProcessId);
     }
   }
 
   public int saveSentMessage(String aRecipient, String aBody, long aDate) {
-    class IdTooHighException extends Exception { }
-
     try {
       ContentValues values = new ContentValues();
       values.put("address", aRecipient);
       values.put("body", aBody);
       values.put("date", aDate);
 
       ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
       Uri uri = cr.insert(kSmsSentContentUri, values);
@@ -581,21 +579,16 @@ public class GeckoSmsManager
       GetMessageRunnable(int aMessageId, int aRequestId, long aProcessId) {
         mMessageId = aMessageId;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class NotFoundException extends Exception { }
-        class UnmatchingIdException extends Exception { }
-        class TooManyResultsException extends Exception { }
-        class InvalidTypeException extends Exception { }
-
         Cursor cursor = null;
 
         try {
           ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
           Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
 
           cursor = cr.query(message, kRequiredMessageRows, null, null, null);
           if (cursor == null || cursor.getCount() == 0) {
@@ -668,18 +661,16 @@ public class GeckoSmsManager
       DeleteMessageRunnable(int aMessageId, int aRequestId, long aProcessId) {
         mMessageId = aMessageId;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class TooManyResultsException extends Exception { }
-
         try {
           ContentResolver cr = GeckoApp.mAppContext.getContentResolver();
           Uri message = ContentUris.withAppendedId(kSmsContentUri, mMessageId);
 
           int count = cr.delete(message, null, null);
 
           if (count > 1) {
             throw new TooManyResultsException();
@@ -721,19 +712,16 @@ public class GeckoSmsManager
         mDeliveryState = aDeliveryState;
         mReverse = aReverse;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class UnexpectedDeliveryStateException extends Exception { };
-        class InvalidTypeException extends Exception { }
-
         Cursor cursor = null;
         boolean closeCursor = true;
 
         try {
           // TODO: should use the |selectionArgs| argument in |ContentResolver.query()|.
           ArrayList<String> restrictions = new ArrayList<String>();
 
           if (mStartDate != 0) {
@@ -834,18 +822,16 @@ public class GeckoSmsManager
       GetNextMessageInListRunnable(int aListId, int aRequestId, long aProcessId) {
         mListId = aListId;
         mRequestId = aRequestId;
         mProcessId = aProcessId;
       }
 
       @Override
       public void run() {
-        class UnexpectedDeliveryStateException extends Exception { };
-
         try {
           Cursor cursor = MessagesListManager.getInstance().get(mListId);
 
           if (!cursor.moveToNext()) {
             MessagesListManager.getInstance().remove(mListId);
             GeckoAppShell.notifyNoMessageInList(mRequestId, mProcessId);
             return;
           }
@@ -891,9 +877,33 @@ public class GeckoSmsManager
   public void stop() {
     GeckoApp.mAppContext.unregisterReceiver(this);
   }
 
   public void shutdown() {
     SmsIOThread.getInstance().interrupt();
     MessagesListManager.getInstance().clear();
   }
+
+  class IdTooHighException extends Exception {
+    private static final long serialVersionUID = 29935575131092050L;
+  }
+
+  class InvalidTypeException extends Exception {
+    private static final long serialVersionUID = 47436856832535912L;
+  }
+
+  class NotFoundException extends Exception {
+    private static final long serialVersionUID = 1940676816633984L;
+  }
+
+  class TooManyResultsException extends Exception {
+    private static final long serialVersionUID = 51883196784325305L;
+  }
+
+  class UnexpectedDeliveryStateException extends Exception {
+    private static final long serialVersionUID = 494122763684005716L;
+  }
+
+  class UnmatchingIdException extends Exception {
+    private static final long serialVersionUID = 158467542575633280L;
+  }
 }