Bug 1258789 - Add if & return for WhitespaceAround. r=grisha
MozReview-Commit-ID: HcWrFHy2CeP
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -50,13 +50,13 @@
</module>
<module name="OuterTypeFilename"/> <!-- `class Lol` only in Lol.java -->
<module name="WhitespaceAfter">
<!-- TODO: (bug 1263059) Remove specific tokens to enable CAST check. -->
<property name="tokens" value="COMMA, SEMI"/>
</module>
<module name="WhitespaceAround">
<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_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN"/>
</module>
</module>
</module>
--- a/mobile/android/base/java/org/mozilla/gecko/ContactService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/ContactService.java
@@ -941,17 +941,17 @@ public class ContactService implements G
Log.i(LOGTAG, "Removing contact with ID: " + rawContactId);
} catch (JSONException e) {
// We can't continue without a raw contact ID
sendCallbackToJavascript("Android:Contact:Remove:Return:KO", requestID, null, null);
return;
}
String returnStatus = "KO";
- if(deleteContact(rawContactId)) {
+ if (deleteContact(rawContactId)) {
returnStatus = "OK";
}
sendCallbackToJavascript("Android:Contact:Remove:Return:" + returnStatus, requestID,
new String[] {"contactID"}, new Object[] {rawContactId});
}
private void saveContact(final JSONObject contactOptions, final String requestID) {
--- a/mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
@@ -218,15 +218,15 @@ public class DownloadsIntegration implem
@Override
public void onMediaScannerConnected() {
mScanner.scanFile(mFile, mMimeType);
}
@Override
public void onScanCompleted(String path, Uri uri) {
- if(path.equals(mFile)) {
+ if (path.equals(mFile)) {
mScanner.disconnect();
mScanner = null;
}
}
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/NotificationHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/NotificationHelper.java
@@ -203,17 +203,17 @@ public final class NotificationHelper im
return pi;
}
private PendingIntent buildButtonClickPendingIntent(JSONObject message, JSONObject action) {
Uri.Builder builder = getNotificationBuilder(message, BUTTON_EVENT);
try {
// Action name must be in query uri, otherwise buttons pending intents
// would be collapsed.
- if(action.has(ACTION_ID_ATTR)) {
+ if (action.has(ACTION_ID_ATTR)) {
builder.appendQueryParameter(ACTION_ID_ATTR, action.getString(ACTION_ID_ATTR));
} else {
Log.i(LOGTAG, "button event with no name");
}
} catch (JSONException ex) {
Log.i(LOGTAG, "buildNotificationPendingIntent, error parsing", ex);
}
final Intent notificationIntent = buildNotificationIntent(message, builder);
--- a/mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
@@ -180,17 +180,17 @@ class SearchEngineRow extends AnimatedHe
final int patternLength = pattern.length();
int indexOfMatch = 0;
int lastIndexOfMatch = 0;
while(indexOfMatch != -1) {
indexOfMatch = string.indexOf(pattern, lastIndexOfMatch);
lastIndexOfMatch = indexOfMatch + patternLength;
- if(indexOfMatch != -1) {
+ if (indexOfMatch != -1) {
mOccurrences.add(indexOfMatch);
}
}
}
/**
* Sets the content for the suggestion view.
*
--- a/mobile/android/base/java/org/mozilla/gecko/tabqueue/TabQueueHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabqueue/TabQueueHelper.java
@@ -172,17 +172,17 @@ public class TabQueueHelper {
// Since JSONArray.remove was only added in API 19, we have to use two arrays in order to remove.
for (int i = 0; i < jsonArray.length(); i++) {
try {
url = jsonArray.getString(i);
} catch (JSONException e) {
url = "";
}
- if(!TextUtils.isEmpty(url) && !urlToRemove.equals(url)) {
+ if (!TextUtils.isEmpty(url) && !urlToRemove.equals(url)) {
newArray.put(url);
}
}
profile.writeFile(filename, newArray.toString());
final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
prefs.edit().putInt(PREF_TAB_QUEUE_COUNT, newArray.length()).apply();
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -177,17 +177,17 @@ public class DateTimePicker extends Fram
} else {
throw new IllegalArgumentException();
}
}
setDate(mTempDate);
if (mDayEnabled) {
mDaySpinner.setMaxValue(mCurrentDate.getActualMaximum(Calendar.DAY_OF_MONTH));
}
- if(mWeekEnabled) {
+ if (mWeekEnabled) {
mWeekSpinner.setMaxValue(mCurrentDate.getActualMaximum(Calendar.WEEK_OF_YEAR));
}
updateCalendar();
updateSpinners();
notifyDateChanged();
}
private void setTempDate(int field, int oldVal, int newVal, int min, int max) {