mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 727121 - Attempt to trick Java 1.7 compiler into not being stupid. r=rnewman
This commit is contained in:
parent
96dde74717
commit
706ff25991
@ -38,6 +38,8 @@
|
||||
|
||||
package org.mozilla.gecko.sync.setup.activities;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.sync.jpake.JPakeClient;
|
||||
@ -268,11 +270,29 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected JSONObject makeAccountJSON(String username, String password,
|
||||
String syncKey, String serverURL) {
|
||||
|
||||
JSONObject jAccount = new JSONObject();
|
||||
|
||||
// Hack to try to keep Java 1.7 from complaining about unchecked types,
|
||||
// despite the presence of SuppressWarnings.
|
||||
HashMap<String, String> fields = (HashMap<String, String>) jAccount;
|
||||
|
||||
fields.put(Constants.JSON_KEY_SYNCKEY, syncKey);
|
||||
fields.put(Constants.JSON_KEY_ACCOUNT, username);
|
||||
fields.put(Constants.JSON_KEY_PASSWORD, password);
|
||||
fields.put(Constants.JSON_KEY_SERVER, serverURL);
|
||||
|
||||
Log.d(LOG_TAG, "Extracted account data: " + jAccount.toJSONString());
|
||||
return jAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device has finished key exchange, waiting for remote device to set up or
|
||||
* link to a Sync account. Display "waiting for other device" dialog.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onPaired() {
|
||||
if (!pairWithPin) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@ -300,13 +320,7 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
|
||||
String syncKey = mAccountManager.getUserData(account, Constants.OPTION_SYNCKEY);
|
||||
String serverURL = mAccountManager.getUserData(account, Constants.OPTION_SERVER);
|
||||
|
||||
JSONObject jAccount = new JSONObject();
|
||||
jAccount.put(Constants.JSON_KEY_SYNCKEY, syncKey);
|
||||
jAccount.put(Constants.JSON_KEY_ACCOUNT, username);
|
||||
jAccount.put(Constants.JSON_KEY_PASSWORD, password);
|
||||
jAccount.put(Constants.JSON_KEY_SERVER, serverURL);
|
||||
|
||||
Log.d(LOG_TAG, "Extracted account data: " + jAccount.toJSONString());
|
||||
JSONObject jAccount = makeAccountJSON(username, password, syncKey, serverURL);
|
||||
try {
|
||||
jClient.sendAndComplete(jAccount);
|
||||
} catch (JPakeNoActivePairingException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user