Bug 1258789 - Add rcurly and fix {} issues. r=grisha draft
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 13 Apr 2016 10:51:26 -0700
changeset 350422 6797dc55ab478d310f43a77badc83eabcedd0d6d
parent 350250 17d1c516fc4a52622615f82a930cddfbfe680435
child 350423 da676dcd95f836b6ef3ba4d8465ecaf74d1e15e8
push id15341
push usermichael.l.comella@gmail.com
push dateWed, 13 Apr 2016 18:23:14 +0000
reviewersgrisha
bugs1258789
milestone48.0a1
Bug 1258789 - Add rcurly and fix {} issues. r=grisha MozReview-Commit-ID: m2dF4mPC1u
mobile/android/app/checkstyle.xml
mobile/android/base/java/org/mozilla/gecko/ContactService.java
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/base/java/org/mozilla/gecko/GeckoNetworkManager.java
mobile/android/base/java/org/mozilla/gecko/lwt/LightweightTheme.java
mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
mobile/android/base/java/org/mozilla/gecko/util/Clipboard.java
mobile/android/base/java/org/mozilla/gecko/util/IOUtils.java
mobile/android/base/java/org/mozilla/gecko/widget/ContentSecurityDoorHanger.java
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -56,13 +56,13 @@
         <module name="WhitespaceAround">
             <property name="allowEmptyConstructors" value="true"/>
             <property name="allowEmptyMethods" value="true"/>
             <property name="allowEmptyTypes" value="true"/>
             <property name="allowEmptyLoops" value="true"/>
             <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN,
                     LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
                     LOR, LT, NOT_EQUAL, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND,
-                    PLUS, PLUS_ASSIGN, MOD, MOD_ASSIGN, LE, LAND, GT, GE"/>
+                    PLUS, PLUS_ASSIGN, MOD, MOD_ASSIGN, LE, LAND, GT, GE, RCURLY"/>
         </module>
     </module>
 
 </module>
--- a/mobile/android/base/java/org/mozilla/gecko/ContactService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/ContactService.java
@@ -652,17 +652,17 @@ public class ContactService implements G
             contact.put("properties", contactProperties);
         } catch (JSONException e) {
             throw new IllegalArgumentException(e);
         }
 
         if (DEBUG) {
             try {
                 Log.d(LOGTAG, "Got contact: " + contact.toString(3));
-            } catch (JSONException e) {}
+            } catch (JSONException e) { }
         }
 
         return contact;
     }
 
     private boolean bool(int integer) {
         return integer != 0;
     }
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1126,17 +1126,17 @@ public abstract class GeckoApp
         // GeckoLoader wants to dig some environment variables out of the
         // incoming intent, so pass it in here. GeckoLoader will do its
         // business later and dispose of the reference.
         GeckoLoader.setLastIntent(intent);
 
         // Workaround for <http://code.google.com/p/android/issues/detail?id=20915>.
         try {
             Class.forName("android.os.AsyncTask");
-        } catch (ClassNotFoundException e) {}
+        } catch (ClassNotFoundException e) { }
 
         MemoryMonitor.getInstance().init(getApplicationContext());
 
         // GeckoAppShell is tightly coupled to us, rather than
         // the app context, because various parts of Fennec (e.g.,
         // GeckoScreenOrientation) use GAS to access the Activity in
         // the guise of fetching a Context.
         // When that's fixed, `this` can change to
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
@@ -1292,17 +1292,17 @@ public class GeckoAppShell
             cmdlineReader = new BufferedReader(new FileReader(cmdlineFile));
             return cmdlineReader.readLine().trim();
         } catch (Exception ex) {
             return "";
         } finally {
             if (null != cmdlineReader) {
                 try {
                     cmdlineReader.close();
-                } catch (Exception e) {}
+                } catch (Exception e) { }
             }
         }
     }
 
     public static void listOfOpenFiles() {
         int pidColumn = -1;
         int nameColumn = -1;
 
@@ -1787,17 +1787,17 @@ public class GeckoAppShell
     @WrapForJNI(stubName = "InitCameraWrapper")
     static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
         ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
                     try {
                         if (getGeckoInterface() != null)
                             getGeckoInterface().enableCameraView();
-                    } catch (Exception e) {}
+                    } catch (Exception e) { }
                 }
             });
 
         // [0] = 0|1 (failure/success)
         // [1] = width
         // [2] = height
         // [3] = fps
         int[] result = new int[4];
@@ -1881,17 +1881,17 @@ public class GeckoAppShell
     @WrapForJNI
     static synchronized void closeCamera() {
         ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
                     try {
                         if (getGeckoInterface() != null)
                             getGeckoInterface().disableCameraView();
-                    } catch (Exception e) {}
+                    } catch (Exception e) { }
                 }
             });
         if (sCamera != null) {
             sCamera.stopPreview();
             sCamera.release();
             sCamera = null;
             sCameraBuffer = null;
         }
@@ -2205,17 +2205,17 @@ public class GeckoAppShell
                 connect(output);
                 ThreadUtils.postToBackgroundThread(
                     new Runnable() {
                         @Override
                         public void run() {
                             try {
                                 bitmap.compress(Bitmap.CompressFormat.PNG, 100, output);
                                 output.close();
-                            } catch (IOException ioe) {}
+                            } catch (IOException ioe) { }
                         }
                     });
                 mHaveConnected = true;
                 return super.read(buffer, byteOffset, byteCount);
             }
         }
     }
 
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoNetworkManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoNetworkManager.java
@@ -296,18 +296,17 @@ public class GeckoNetworkManager extends
         if (cm == null) {
             Log.e(LOGTAG, "Connectivity service does not exist");
             return ConnectionType.NONE;
         }
 
         NetworkInfo ni = null;
         try {
             ni = cm.getActiveNetworkInfo();
-        } catch (SecurityException se) {} // if we don't have the permission, fall through to null check
-
+        } catch (SecurityException se) { /* if we don't have the permission, fall through to null check */ }
         if (ni == null) {
             return ConnectionType.NONE;
         }
 
         switch (ni.getType()) {
         case ConnectivityManager.TYPE_BLUETOOTH:
             return ConnectionType.BLUETOOTH;
         case ConnectivityManager.TYPE_ETHERNET:
--- a/mobile/android/base/java/org/mozilla/gecko/lwt/LightweightTheme.java
+++ b/mobile/android/base/java/org/mozilla/gecko/lwt/LightweightTheme.java
@@ -138,17 +138,17 @@ public class LightweightTheme implements
                 stream = mApplication.getAssets().open(url.substring(ASSETS_PREFIX.length()));
                 return BitmapFactory.decodeStream(stream);
             } catch (IOException e) {
                 return null;
             } finally {
                 if (stream != null) {
                     try {
                         stream.close();
-                    } catch (IOException e) {}
+                    } catch (IOException e) { }
                 }
             }
         }
 
         private void onBitmapLoaded(final Bitmap bitmap) {
             ThreadUtils.postToUiThread(new Runnable() {
                 @Override
                 public void run() {
--- a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
@@ -604,22 +604,22 @@ public class UpdateService extends Inten
             showDownloadFailure();
 
             Log.e(LOGTAG, "failed to download update: ", e);
             return null;
         } finally {
             try {
                 if (input != null)
                     input.close();
-            } catch (java.io.IOException e) {}
+            } catch (java.io.IOException e) { }
 
             try {
                 if (output != null)
                     output.close();
-            } catch (java.io.IOException e) {}
+            } catch (java.io.IOException e) { }
 
             mDownloading = false;
 
             if (mWifiLock.isHeld()) {
                 mWifiLock.release();
             }
         }
     }
@@ -641,17 +641,17 @@ public class UpdateService extends Inten
             }
         } catch (java.io.IOException e) {
             Log.e(LOGTAG, "Failed to verify update package: ", e);
             return false;
         } finally {
             try {
                 if (input != null)
                     input.close();
-            } catch (java.io.IOException e) {}
+            } catch (java.io.IOException e) { }
         }
 
         String hex = Hex.encodeHexString(digest.digest());
         if (!hex.equals(getLastHashValue())) {
             Log.e(LOGTAG, "Package hash does not match");
             return false;
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/util/Clipboard.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/Clipboard.java
@@ -43,17 +43,17 @@ public final class Clipboard {
         }
 
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 String text = getClipboardTextImpl();
                 try {
                     sClipboardQueue.put(text != null ? text : "");
-                } catch (InterruptedException ie) {}
+                } catch (InterruptedException ie) { }
             }
         });
 
         try {
             return sClipboardQueue.take();
         } catch (InterruptedException ie) {
             return "";
         }
--- a/mobile/android/base/java/org/mozilla/gecko/util/IOUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/IOUtils.java
@@ -110,17 +110,17 @@ public class IOUtils {
 
         return newBytes;
     }
 
     public static void safeStreamClose(Closeable stream) {
         try {
             if (stream != null)
                 stream.close();
-        } catch (IOException e) {}
+        } catch (IOException e) { }
     }
 
     public static void copy(InputStream in, OutputStream out) throws IOException {
         byte[] buffer = new byte[4096];
         int len;
 
         while ((len = in.read(buffer)) != -1) {
             out.write(buffer, 0, len);
--- a/mobile/android/base/java/org/mozilla/gecko/widget/ContentSecurityDoorHanger.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/ContentSecurityDoorHanger.java
@@ -87,17 +87,17 @@ public class ContentSecurityDoorHanger e
                     mSecurityState.setTextColor(ContextCompat.getColor(getContext(), R.color.affirmative_green));
                 } else {
                     mMessage.setText(R.string.doorhanger_tracking_message_disabled);
                     mSecurityState.setText(R.string.doorhanger_tracking_state_disabled);
                     mSecurityState.setTextColor(ContextCompat.getColor(getContext(), R.color.rejection_red));
                 }
                 mMessage.setVisibility(VISIBLE);
                 mSecurityState.setVisibility(VISIBLE);
-            } catch (JSONException e) {}
+            } catch (JSONException e) { }
         }
     }
 
     @Override
     protected OnClickListener makeOnButtonClickListener(final int id, final String telemetryExtra) {
         return new Button.OnClickListener() {
             @Override
             public void onClick(View v) {