Create a separate api object for modifications sync

This prevents the same HTTPClient being re-used across different
threads, causing problems

Long-term fix needed, however
This commit is contained in:
YuviPanda 2013-03-28 04:14:18 +05:30
parent 1816f792f8
commit 8a7966687a

View file

@ -44,10 +44,9 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
return; return;
} }
CommonsApplication app = (CommonsApplication)getContext().getApplicationContext();
String authCookie; String authCookie;
try { try {
authCookie = AccountManager.get(app).blockingGetAuthToken(account, "", false); authCookie = AccountManager.get(getContext()).blockingGetAuthToken(account, "", false);
} catch (OperationCanceledException e) { } catch (OperationCanceledException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (IOException e) { } catch (IOException e) {
@ -56,7 +55,7 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
MWApi api = app.getApi(); MWApi api = CommonsApplication.createMWApi();
api.setAuthCookie(authCookie); api.setAuthCookie(authCookie);
String editToken; String editToken;