Source:
private void refreshTokenWithoutCache(final String refreshToken, final String clientId, final String resource, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.setCorrelationId(getRequestCorrelationId()); Logger.v(TAG, "Refresh token without cache"); if (StringExtensions.IsNullOrBlank(refreshToken)) { throw new IllegalArgumentException("Refresh token is not provided"); } if (StringExtensions.IsNullOrBlank(clientId)) { throw new IllegalArgumentException("ClientId is not provided"); } if (externalCallback == null) { throw new IllegalArgumentException("Callback is not provided"); } final CallbackHandler callbackHandle = new CallbackHandler(getHandler(), externalCallback); sThreadExecutor.submit(new Runnable() { @Override public void run() { final URL authorityUrl = StringExtensions.getUrl(mAuthority); if (authorityUrl == null) { callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL)); return; } final AuthenticationRequest request = new AuthenticationRequest(mAuthority, resource, clientId, getRequestCorrelationId()); request.setSilent(true); final RefreshItem refreshItem = new RefreshItem(refreshToken); if (mValidateAuthority) { Logger.v(TAG, "Validating authority"); try { if (validateAuthority(authorityUrl)) { Logger.v(TAG, "Authority is validated" + authorityUrl.toString()); } else { Logger.v( TAG, "Call callback since instance is invalid:" + authorityUrl.toString()); callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_INSTANCE)); return; } } catch (Exception exc) { Logger.e(TAG, "Authority validation is failed", ExceptionExtensions.getExceptionMessage(exc), ADALError.SERVER_INVALID_REQUEST, exc); callbackHandle .onError(new AuthenticationException( ADALError.SERVER_INVALID_REQUEST, "Authority validation is failed")); return; } } final AuthenticationResult authResult; try { authResult = getTokenWithRefreshToken(null, false, request, refreshItem, false); } catch (final AuthenticationException authException) { callbackHandle.onError(authException); return; } callbackHandle.onSuccess(authResult); } }); }

Target:
private void refreshTokenWithoutCache(final String refreshToken, final String clientId, final String resource, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.setCorrelationId(getRequestCorrelationId()); Logger.v(TAG, "Refresh token without cache"); if (StringExtensions.IsNullOrBlank(refreshToken)) { throw new IllegalArgumentException("Refresh token is not provided"); } if (StringExtensions.IsNullOrBlank(clientId)) { throw new IllegalArgumentException("ClientId is not provided"); } if (externalCallback == null) { throw new IllegalArgumentException("Callback is not provided"); } final CallbackHandler callbackHandle = new CallbackHandler(getHandler(), externalCallback); sThreadExecutor.execute(new Runnable() { @Override public void run() { final URL authorityUrl = StringExtensions.getUrl(mAuthority); if (authorityUrl == null) { callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL)); return; } final AuthenticationRequest request = new AuthenticationRequest(mAuthority, resource, clientId, getRequestCorrelationId()); request.setSilent(true); final RefreshItem refreshItem = new RefreshItem(refreshToken); if (mValidateAuthority) { Logger.v(TAG, "Validating authority"); if (validateAuthority(authorityUrl)) { Logger.v(TAG, "Authority is validated" + authorityUrl.toString()); } else { Logger.v( TAG, "Call callback since instance is invalid:" + authorityUrl.toString()); callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_INSTANCE)); return; } } final AuthenticationResult authResult; try { authResult = getTokenWithRefreshToken(null, false, request, refreshItem, false); } catch (final AuthenticationException authException) { callbackHandle.onError(authException); return; } callbackHandle.onSuccess(authResult); } }); }