List of usage examples for android.accounts OperationCanceledException getMessage
public String getMessage()
From source file:com.he5ed.lib.cloudprovider.apis.BoxApi.java
@Override public synchronized void prepareApi(OnPrepareListener prepareListener) { mPrepareListener = prepareListener;//from www . j a v a2 s .c o m AccountManager.get(mContext).getAuthToken(mAccount, CloudProvider.AUTH_TYPE, false, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { mAccessToken = future.getResult().getString(AccountManager.KEY_AUTHTOKEN); validateAccessToken(); } catch (OperationCanceledException e) { e.printStackTrace(); Log.e(TAG, e.getMessage()); if (mPrepareListener != null) mPrepareListener.onPrepareFail(e); } catch (IOException e) { e.printStackTrace(); Log.e(TAG, e.getMessage()); if (mPrepareListener != null) mPrepareListener.onPrepareFail(e); } catch (AuthenticatorException e) { e.printStackTrace(); Log.e(TAG, e.getMessage()); if (mPrepareListener != null) mPrepareListener.onPrepareFail(e); } } }, null); }
From source file:com.he5ed.lib.cloudprovider.apis.CloudDriveApi.java
@Override public synchronized void prepareApi(BaseApi.OnPrepareListener prepareListener) { mPrepareListener = prepareListener;/*from w w w . jav a 2 s . c o m*/ AccountManager.get(mContext).getAuthToken(mAccount, CloudProvider.AUTH_TYPE, false, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { mAccessToken = future.getResult().getString(AccountManager.KEY_AUTHTOKEN); validateAccessToken(); } catch (OperationCanceledException e) { e.printStackTrace(); Log.e(TAG, e.getMessage()); if (mPrepareListener != null) mPrepareListener.onPrepareFail(e); } catch (IOException e) { e.printStackTrace(); Log.e(TAG, e.getMessage()); if (mPrepareListener != null) mPrepareListener.onPrepareFail(e); } catch (AuthenticatorException e) { e.printStackTrace(); Log.e(TAG, e.getMessage()); if (mPrepareListener != null) mPrepareListener.onPrepareFail(e); } } }, null); }
From source file:org.klnusbaum.udj.network.EventCommService.java
private void enterEvent(Intent intent, AccountManager am, Account account, boolean attemptReauth) { if (!Utils.isNetworkAvailable(this)) { doLoginFail(am, account, EventJoinError.NO_NETWORK_ERROR); return;/* w w w .ja v a2 s . c o m*/ } long userId, eventId; String authToken; //TODO hanle error if account isn't provided try { userId = Long.valueOf(am.getUserData(account, Constants.USER_ID_DATA)); //TODO handle if event id isn't provided authToken = am.blockingGetAuthToken(account, "", true); eventId = intent.getLongExtra(Constants.EVENT_ID_EXTRA, Constants.NO_EVENT_ID); } catch (OperationCanceledException e) { Log.e(TAG, "Operation canceled exception in EventCommService"); doLoginFail(am, account, EventJoinError.AUTHENTICATION_ERROR); return; } catch (AuthenticatorException e) { Log.e(TAG, "Authenticator exception in EventCommService"); doLoginFail(am, account, EventJoinError.AUTHENTICATION_ERROR); return; } catch (IOException e) { Log.e(TAG, "IO exception in EventCommService"); doLoginFail(am, account, EventJoinError.AUTHENTICATION_ERROR); return; } try { ServerConnection.joinEvent(eventId, userId, authToken); setEventData(intent, am, account); ContentResolver cr = getContentResolver(); UDJEventProvider.eventCleanup(cr); HashMap<Long, Long> previousRequests = ServerConnection.getAddRequests(userId, eventId, authToken); UDJEventProvider.setPreviousAddRequests(cr, previousRequests); JSONObject previousVotes = ServerConnection.getVoteRequests(userId, eventId, authToken); UDJEventProvider.setPreviousVoteRequests(cr, previousVotes); Intent joinedEventIntent = new Intent(Constants.JOINED_EVENT_ACTION); am.setUserData(account, Constants.LAST_EVENT_ID_DATA, String.valueOf(eventId)); am.setUserData(account, Constants.EVENT_STATE_DATA, String.valueOf(Constants.IN_EVENT)); sendBroadcast(joinedEventIntent); } catch (IOException e) { Log.e(TAG, "IO exception when joining event"); Log.e(TAG, e.getMessage()); doLoginFail(am, account, EventJoinError.SERVER_ERROR); } catch (JSONException e) { Log.e(TAG, "JSON exception when joining event"); Log.e(TAG, e.getMessage()); doLoginFail(am, account, EventJoinError.SERVER_ERROR); } catch (AuthenticationException e) { handleLoginAuthException(intent, am, account, authToken, attemptReauth); } catch (EventOverException e) { Log.e(TAG, "Event Over Exception when joining event"); //Log.e(TAG, e.getMessage()); doLoginFail(am, account, EventJoinError.EVENT_OVER_ERROR); } catch (AlreadyInEventException e) { Log.e(TAG, "Already In Event Exception when joining event"); try { ServerConnection.leaveEvent(e.getEventId(), userId, authToken); enterEvent(intent, am, account, true); } catch (AuthenticationException f) { handleLoginAuthException(intent, am, account, authToken, attemptReauth); } catch (IOException f) { Log.e(TAG, "IO exception when attempting to leave one event before " + "joining another"); Log.e(TAG, f.getMessage()); doLoginFail(am, account, EventJoinError.SERVER_ERROR); } } }