зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1081401: Remove unnecessary autoboxing (recalcitrant sync part). r=rnewman
This commit is contained in:
Родитель
9be397f431
Коммит
5da6492416
|
@ -42,7 +42,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
|
|||
private boolean shouldLogError(String logTag) {
|
||||
Boolean out = isErrorLoggable.get(logTag);
|
||||
if (out != null) {
|
||||
return out.booleanValue();
|
||||
return out;
|
||||
}
|
||||
out = Log.isLoggable(logTag, Log.ERROR);
|
||||
isErrorLoggable.put(logTag, out);
|
||||
|
@ -52,7 +52,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
|
|||
private boolean shouldLogWarn(String logTag) {
|
||||
Boolean out = isWarnLoggable.get(logTag);
|
||||
if (out != null) {
|
||||
return out.booleanValue();
|
||||
return out;
|
||||
}
|
||||
out = Log.isLoggable(logTag, Log.WARN);
|
||||
isWarnLoggable.put(logTag, out);
|
||||
|
@ -62,7 +62,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
|
|||
private boolean shouldLogInfo(String logTag) {
|
||||
Boolean out = isInfoLoggable.get(logTag);
|
||||
if (out != null) {
|
||||
return out.booleanValue();
|
||||
return out;
|
||||
}
|
||||
out = Log.isLoggable(logTag, Log.INFO);
|
||||
isInfoLoggable.put(logTag, out);
|
||||
|
@ -72,7 +72,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
|
|||
private boolean shouldLogDebug(String logTag) {
|
||||
Boolean out = isDebugLoggable.get(logTag);
|
||||
if (out != null) {
|
||||
return out.booleanValue();
|
||||
return out;
|
||||
}
|
||||
out = Log.isLoggable(logTag, Log.DEBUG);
|
||||
isDebugLoggable.put(logTag, out);
|
||||
|
@ -83,7 +83,7 @@ public class AndroidLevelCachingLogWriter extends LogWriter {
|
|||
public boolean shouldLogVerbose(String logTag) {
|
||||
Boolean out = isVerboseLoggable.get(logTag);
|
||||
if (out != null) {
|
||||
return out.booleanValue();
|
||||
return out;
|
||||
}
|
||||
out = Log.isLoggable(logTag, Log.VERBOSE);
|
||||
isVerboseLoggable.put(logTag, out);
|
||||
|
|
|
@ -91,6 +91,6 @@ public class FxAccountAgeLockoutHelper {
|
|||
FxAccountConstants.pii(LOG_TAG, "Passed age check: year text was found in item list but was not a number.");
|
||||
return true;
|
||||
}
|
||||
return passesAgeCheck(yearOfBirth.intValue());
|
||||
return passesAgeCheck(yearOfBirth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
|
|||
boolean verified = false; // In production, we're definitely not verified immediately upon creation.
|
||||
Boolean tempVerified = body.getBoolean(JSON_KEY_VERIFIED);
|
||||
if (tempVerified != null) {
|
||||
verified = tempVerified.booleanValue();
|
||||
verified = tempVerified;
|
||||
}
|
||||
byte[] sessionToken = Utils.hex2Byte(body.getString(JSON_KEY_SESSIONTOKEN));
|
||||
byte[] keyFetchToken = null;
|
||||
|
@ -154,10 +154,8 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
|
|||
LoginResponse loginResponse = new LoginResponse(new String(emailUTF8, "UTF-8"), uid, verified, sessionToken, keyFetchToken);
|
||||
|
||||
delegate.handleSuccess(loginResponse);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
delegate.handleError(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -172,7 +170,6 @@ public class FxAccountClient20 extends FxAccountClient10 implements FxAccountCli
|
|||
createAccount(emailUTF8, quickStretchedPW, true, false, "sync", delegate);
|
||||
} catch (Exception e) {
|
||||
invokeHandleError(delegate, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1197,7 +1197,7 @@ public class HealthReportDatabaseStorage implements HealthReportStorage {
|
|||
|
||||
@Override
|
||||
public void recordDailyLast(int env, int day, int field, int value) {
|
||||
this.recordDailyLast(env, day, field, Integer.valueOf(value), EVENTS_INTEGER);
|
||||
this.recordDailyLast(env, day, field, value, EVENTS_INTEGER);
|
||||
}
|
||||
|
||||
private void recordDailyDiscrete(int env, int day, int field, Object value, String table) {
|
||||
|
|
|
@ -189,7 +189,7 @@ public class HealthReportProvider extends ContentProvider {
|
|||
Object object = values.get("value");
|
||||
if (object instanceof Integer ||
|
||||
object instanceof Long) {
|
||||
storage.recordDailyLast(env, day, field.getID(), ((Integer) object).intValue());
|
||||
storage.recordDailyLast(env, day, field.getID(), (Integer) object);
|
||||
} else if (object instanceof String) {
|
||||
storage.recordDailyLast(env, day, field.getID(), (String) object);
|
||||
} else {
|
||||
|
@ -287,7 +287,7 @@ public class HealthReportProvider extends ContentProvider {
|
|||
private MeasurementFields getFieldSpecs(ContentValues values) {
|
||||
final ArrayList<FieldSpec> specs = new ArrayList<FieldSpec>(values.size());
|
||||
for (Entry<String, Object> entry : values.valueSet()) {
|
||||
specs.add(new FieldSpec(entry.getKey(), ((Integer) entry.getValue()).intValue()));
|
||||
specs.add(new FieldSpec(entry.getKey(), (Integer) entry.getValue()));
|
||||
}
|
||||
|
||||
return new MeasurementFields() {
|
||||
|
|
|
@ -236,7 +236,7 @@ public class ObsoleteDocumentTracker {
|
|||
if (!(o instanceof Long)) {
|
||||
continue;
|
||||
}
|
||||
if (((Long) o).longValue() > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
|
||||
if ((Long) o > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
|
||||
ids.put(key, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class PreferenceManagerCompat {
|
|||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) {
|
||||
if (method.getName().equals("onPreferenceTreeClick")) {
|
||||
return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]));
|
||||
return listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ public class AccountPickler {
|
|||
|
||||
public static ExtendedJSONObject toJSON(final AndroidFxAccount account, final long now) {
|
||||
final ExtendedJSONObject o = new ExtendedJSONObject();
|
||||
o.put(KEY_PICKLE_VERSION, Long.valueOf(PICKLE_VERSION));
|
||||
o.put(KEY_PICKLE_TIMESTAMP, Long.valueOf(now));
|
||||
o.put(KEY_PICKLE_VERSION, PICKLE_VERSION);
|
||||
o.put(KEY_PICKLE_TIMESTAMP, now);
|
||||
|
||||
o.put(KEY_ACCOUNT_VERSION, AndroidFxAccount.CURRENT_ACCOUNT_VERSION);
|
||||
o.put(KEY_ACCOUNT_TYPE, FxAccountConstants.ACCOUNT_TYPE);
|
||||
|
@ -188,7 +188,7 @@ public class AccountPickler {
|
|||
Long timestamp = json.getLong(KEY_PICKLE_TIMESTAMP);
|
||||
if (timestamp == null) {
|
||||
Logger.warn(LOG_TAG, "Did not find timestamp in pickle file; ignoring.");
|
||||
timestamp = Long.valueOf(-1);
|
||||
timestamp = -1L;
|
||||
}
|
||||
|
||||
Logger.info(LOG_TAG, "Un-pickled Android account named " + params.email + " (version " +
|
||||
|
|
|
@ -169,7 +169,7 @@ public class AndroidFxAccount {
|
|||
if (b == null) {
|
||||
return def;
|
||||
}
|
||||
return b.booleanValue();
|
||||
return b;
|
||||
}
|
||||
|
||||
protected byte[] getBundleDataBytes(String key) {
|
||||
|
|
|
@ -153,7 +153,7 @@ public class CryptoRecord extends Record {
|
|||
if (timestamp == null) {
|
||||
throw new RecordParseException("timestamp could not be parsed");
|
||||
}
|
||||
record.lastModified = timestamp.longValue();
|
||||
record.lastModified = timestamp;
|
||||
}
|
||||
if (jsonRecord.containsKey(KEY_SORTINDEX)) {
|
||||
// getLong tries to cast to Long, and might return null. We catch all
|
||||
|
|
|
@ -16,7 +16,7 @@ public class EngineSettings {
|
|||
public EngineSettings(ExtendedJSONObject object) {
|
||||
try {
|
||||
this.syncID = object.getString("syncID");
|
||||
this.version = object.getIntegerSafely("version").intValue();
|
||||
this.version = object.getIntegerSafely("version");
|
||||
} catch (Exception e ) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ public class ExtendedJSONObject {
|
|||
return (Integer) val;
|
||||
}
|
||||
if (val instanceof Long) {
|
||||
return Integer.valueOf(((Long) val).intValue());
|
||||
return ((Long) val).intValue();
|
||||
}
|
||||
if (val instanceof String) {
|
||||
return Integer.parseInt((String) val, 10);
|
||||
|
@ -243,7 +243,7 @@ public class ExtendedJSONObject {
|
|||
|
||||
// This is absurd.
|
||||
if (val instanceof Double) {
|
||||
double millis = ((Double) val).doubleValue() * 1000;
|
||||
double millis = ((Double) val) * 1000;
|
||||
return Double.valueOf(millis).longValue();
|
||||
}
|
||||
if (val instanceof Float) {
|
||||
|
|
|
@ -1014,7 +1014,7 @@ public class GlobalSession implements HttpResponseObserver {
|
|||
if (version == null) {
|
||||
continue; // Don't want this stage to be included in meta/global.
|
||||
}
|
||||
engineSettings = new EngineSettings(Utils.generateGuid(), version.intValue());
|
||||
engineSettings = new EngineSettings(Utils.generateGuid(), version);
|
||||
} catch (NoSuchStageException e) {
|
||||
// No trouble; Android Sync might not recognize this engine yet.
|
||||
// By default, version 0. Other clients will see the 0 version and reset/wipe accordingly.
|
||||
|
|
|
@ -98,6 +98,6 @@ public class InfoCollections {
|
|||
}
|
||||
|
||||
// Otherwise, we need an update if our modification time is stale.
|
||||
return (serverLastModified.longValue() > lastModified);
|
||||
return serverLastModified > lastModified;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ public class MetaGlobal implements SyncStorageRequestDelegate {
|
|||
Integer version = engineEntry.getIntegerSafely("version");
|
||||
Logger.trace(LOG_TAG, "Engine " + engineName + " has server version " + version);
|
||||
if (version == null ||
|
||||
version.intValue() == 0) {
|
||||
version == 0) {
|
||||
// Invalid version. Wipe the server.
|
||||
Logger.warn(LOG_TAG, "Malformed version " + version +
|
||||
" for " + engineName + ". Recording exception.");
|
||||
|
|
|
@ -411,8 +411,8 @@ public class SyncConfiguration {
|
|||
|
||||
// Our history checkbox drives form history, too.
|
||||
// We don't need to do this for enablement: that's done at retrieval time.
|
||||
if (selectedEngines.containsKey("history") && !selectedEngines.get("history").booleanValue()) {
|
||||
declined.add("forms");
|
||||
if (selectedEngines.containsKey("history") && !selectedEngines.get("history")) {
|
||||
declined.add("forms");
|
||||
}
|
||||
|
||||
String json = jObj.toJSONString();
|
||||
|
|
|
@ -171,8 +171,8 @@ public class AccountPickler {
|
|||
Integer timestamp = json.getIntegerSafely(Constants.JSON_KEY_TIMESTAMP);
|
||||
if (version == null || timestamp == null) {
|
||||
Logger.warn(LOG_TAG, "Did not find version or timestamp in pickle file; ignoring.");
|
||||
version = new Integer(-1);
|
||||
timestamp = new Integer(-1);
|
||||
version = -1;
|
||||
timestamp = -1;
|
||||
}
|
||||
|
||||
Logger.info(LOG_TAG, "Un-pickled Android account named " + params.username + " (version " + version + ", pickled at " + timestamp + ").");
|
||||
|
|
|
@ -55,13 +55,13 @@ public class ConfigurationMigrator {
|
|||
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof Boolean) {
|
||||
to.putBoolean(toKey, ((Boolean) value).booleanValue());
|
||||
to.putBoolean(toKey, (Boolean) value);
|
||||
} else if (value instanceof Float) {
|
||||
to.putFloat(toKey, ((Float) value).floatValue());
|
||||
to.putFloat(toKey, (Float) value);
|
||||
} else if (value instanceof Integer) {
|
||||
to.putInt(toKey, ((Integer) value).intValue());
|
||||
to.putInt(toKey, (Integer) value);
|
||||
} else if (value instanceof Long) {
|
||||
to.putLong(toKey, ((Long) value).longValue());
|
||||
to.putLong(toKey, (Long) value);
|
||||
} else if (value instanceof String) {
|
||||
to.putString(toKey, (String) value);
|
||||
} else {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class RepositorySessionBundle {
|
|||
|
||||
public void setTimestamp(long timestamp) {
|
||||
Logger.debug(LOG_TAG, "Setting timestamp to " + timestamp + ".");
|
||||
object.put(JSON_KEY_TIMESTAMP, Long.valueOf(timestamp));
|
||||
object.put(JSON_KEY_TIMESTAMP, timestamp);
|
||||
}
|
||||
|
||||
public void bumpTimestamp(long timestamp) {
|
||||
|
|
|
@ -470,7 +470,7 @@ public class Server11RepositorySession extends RepositorySession {
|
|||
if (body.containsKey("modified")) {
|
||||
Long modified = body.getTimestamp("modified");
|
||||
if (modified != null) {
|
||||
Logger.trace(LOG_TAG, "POST request success. Modified timestamp: " + modified.longValue());
|
||||
Logger.trace(LOG_TAG, "POST request success. Modified timestamp: " + modified);
|
||||
} else {
|
||||
Logger.warn(LOG_TAG, "POST success body contains malformed 'modified': " + body.toJSONString());
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
|
|||
Logger.warn(LOG_TAG, "Couldn't find local ID for GUID " + guid);
|
||||
return -1;
|
||||
}
|
||||
return id.longValue();
|
||||
return id;
|
||||
}
|
||||
|
||||
private String getGUID(Cursor cur) {
|
||||
|
@ -364,7 +364,7 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
|
|||
boolean changed = false;
|
||||
int i = 0;
|
||||
for (Entry<Long, ArrayList<String>> entry : guids.entrySet()) {
|
||||
long pos = entry.getKey().longValue();
|
||||
long pos = entry.getKey();
|
||||
int atPos = entry.getValue().size();
|
||||
|
||||
// If every element has a different index, and the indices are
|
||||
|
|
|
@ -682,7 +682,7 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
|||
if (recordToGuid == null) {
|
||||
createRecordToGuidMap();
|
||||
}
|
||||
return recordToGuid.get(Integer.valueOf(recordString.hashCode()));
|
||||
return recordToGuid.get(recordString.hashCode());
|
||||
}
|
||||
|
||||
protected void createRecordToGuidMap() throws NoGuidForIdException, NullCursorException, ParentNotFoundException {
|
||||
|
@ -702,7 +702,7 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
|||
if (record != null) {
|
||||
final String recordString = buildRecordString(record);
|
||||
if (recordString != null) {
|
||||
recordToGuid.put(Integer.valueOf(recordString.hashCode()), record.guid);
|
||||
recordToGuid.put(recordString.hashCode(), record.guid);
|
||||
}
|
||||
}
|
||||
cur.moveToNext();
|
||||
|
@ -760,7 +760,7 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
|||
if (recordToGuid == null) {
|
||||
createRecordToGuidMap();
|
||||
}
|
||||
recordToGuid.put(Integer.valueOf(recordString.hashCode()), guid);
|
||||
recordToGuid.put(recordString.hashCode(), guid);
|
||||
}
|
||||
|
||||
protected abstract Record prepareRecord(Record record);
|
||||
|
|
|
@ -143,7 +143,7 @@ public class BrowserContractHelpers extends BrowserContract {
|
|||
if (found == null) {
|
||||
return -1;
|
||||
}
|
||||
return found.intValue();
|
||||
return found;
|
||||
}
|
||||
|
||||
public static boolean isSupportedType(String type) {
|
||||
|
|
|
@ -314,7 +314,7 @@ public class SendTabActivity extends LocaleAwareActivity {
|
|||
@Override
|
||||
protected void onPostExecute(final Boolean success) {
|
||||
// We're allowed to update the UI from here.
|
||||
notifyAndFinish(success.booleanValue());
|
||||
notifyAndFinish(success);
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ public class SafeConstrainedServer11Repository extends ConstrainedServer11Reposi
|
|||
return false;
|
||||
}
|
||||
|
||||
Logger.info(LOG_TAG, "First sync for " + collection + ": " + c.intValue() + " items.");
|
||||
if (c.intValue() > fetchLimit) {
|
||||
Logger.info(LOG_TAG, "First sync for " + collection + ": " + c + " items.");
|
||||
if (c > fetchLimit) {
|
||||
Logger.warn(LOG_TAG, "Too many items to sync safely. Skipping.");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -125,14 +125,14 @@ public abstract class ServerSyncStage extends AbstractSessionManagingSyncStage i
|
|||
Integer version = getStorageVersion();
|
||||
if (version == null) {
|
||||
Logger.warn(LOG_TAG, "null storage version for " + this + "; using version 0.");
|
||||
version = Integer.valueOf(0);
|
||||
version = 0;
|
||||
}
|
||||
|
||||
SynchronizerConfiguration config = this.getConfig();
|
||||
if (config == null) {
|
||||
return new EngineSettings(null, version.intValue());
|
||||
return new EngineSettings(null, version);
|
||||
}
|
||||
return new EngineSettings(config.syncID, version.intValue());
|
||||
return new EngineSettings(config.syncID, version);
|
||||
}
|
||||
|
||||
protected abstract String getCollection();
|
||||
|
|
Загрузка…
Ссылка в новой задаче