Source:
String callback(final URL requestUrl) throws OAuthAuthenticationException, InvalidKeySpecException, NoSuchAlgorithmException { try { final GenericUrl callbackUrl = new GenericUrl(requestUrl.toString()); if (callbackUrl.getFirst(OAUTH_TOKEN_PARAM_KEY) == null) { throw new OAuthAuthenticationException("Missing oauth_token parameter"); } if (callbackUrl.getFirst(OAUTH_VERIFIER_PARAM_KEY) == null) { throw new OAuthAuthenticationException("Missing oauth_verifier parameter"); } final String state = (String)callbackUrl.getFirst(STATE_PARAM_KEY); String requestType = getRequestTypeFromStateParameter(state); String signatureMethod = getSignatureMethodFromStateParameter(state); final String oauthTemporaryToken = (String)callbackUrl.getFirst(OAUTH_TOKEN_PARAM_KEY); OAuthGetAccessToken getAccessToken; if (requestType != null && "post".equals(requestType.toLowerCase())) { getAccessToken = new OAuthPostAccessToken(accessTokenUri); } else { getAccessToken = new OAuthGetAccessToken(accessTokenUri); } getAccessToken.consumerKey = clientId; getAccessToken.temporaryToken = oauthTemporaryToken; getAccessToken.verifier = (String)callbackUrl.getFirst(OAUTH_VERIFIER_PARAM_KEY); getAccessToken.transport = httpTransport; if (signatureMethod != null && "rsa".equals(signatureMethod.toLowerCase())) { getAccessToken.signer = getOAuthRsaSigner(); } else { getAccessToken.signer = getOAuthHmacSigner(clientSecret, sharedTokenSecrets.remove(oauthTemporaryToken)); } final OAuthCredentialsResponse credentials = getAccessToken.execute(); String userId = getUserFromStateParameter(state); credentialsStoreLock.lock(); try { final OAuthCredentialsResponse currentCredentials = credentialsStore.get(userId); if (currentCredentials == null) { credentialsStore.put(userId, credentials); } else { currentCredentials.token = credentials.token; currentCredentials.tokenSecret = credentials.tokenSecret; } } finally { credentialsStoreLock.unlock(); } return userId; } catch (final IOException e) { throw new OAuthAuthenticationException(e); } }

Target:
String callback(final URL requestUrl) throws OAuthAuthenticationException { try { final GenericUrl callbackUrl = new GenericUrl(requestUrl.toString()); if (callbackUrl.getFirst(OAUTH_TOKEN_PARAM_KEY) == null) { throw new OAuthAuthenticationException("Missing oauth_token parameter"); } if (callbackUrl.getFirst(OAUTH_VERIFIER_PARAM_KEY) == null) { throw new OAuthAuthenticationException("Missing oauth_verifier parameter"); } final String state = (String)callbackUrl.getFirst(STATE_PARAM_KEY); String requestMethod = getParameterFromState(state, REQUEST_METHOD_PARAM_KEY); String signatureMethod = getParameterFromState(state, SIGNATURE_METHOD_PARAM_KEY); final String oauthTemporaryToken = (String)callbackUrl.getFirst(OAUTH_TOKEN_PARAM_KEY); OAuthGetAccessToken getAccessToken; if (requestMethod != null && "post".equals(requestMethod.toLowerCase())) { getAccessToken = new OAuthPostAccessToken(accessTokenUri); } else { getAccessToken = new OAuthGetAccessToken(accessTokenUri); } getAccessToken.consumerKey = clientId; getAccessToken.temporaryToken = oauthTemporaryToken; getAccessToken.verifier = (String)callbackUrl.getFirst(OAUTH_VERIFIER_PARAM_KEY); getAccessToken.transport = httpTransport; if (signatureMethod != null && "rsa".equals(signatureMethod.toLowerCase())) { getAccessToken.signer = getOAuthRsaSigner(); } else { getAccessToken.signer = getOAuthHmacSigner(clientSecret, sharedTokenSecrets.remove(oauthTemporaryToken)); } final OAuthCredentialsResponse credentials = getAccessToken.execute(); String userId = getParameterFromState(state, USER_ID_PARAM_KEY); credentialsStoreLock.lock(); try { final OAuthCredentialsResponse userId2Credential = credentialsStore.get(userId); if (userId2Credential == null) { credentialsStore.put(userId, credentials); } else { userId2Credential.token = credentials.token; userId2Credential.tokenSecret = credentials.tokenSecret; } } finally { credentialsStoreLock.unlock(); } return userId; } catch (Exception e) { throw new OAuthAuthenticationException(e.getMessage()); } }