Buggy code:
public class AuthorizationService { public static final String SCOPE_OPENID = "openid" ; public static final String SCOPE_PROFILE = "profile" ; public static final String SCOPE_EMAIL = "email" ; public static final String SCOPE_ADDRESS = "address" ; @ VisibleForTesting static final String CLIENT_ID = "client_id" ; @ VisibleForTesting static final String SCOPE = "scope" ; @ VisibleForTesting static final String RESPONSE_MODE = "response_mode" ; @ VisibleForTesting static final String RESPONSE_TYPE = "response_type" ; @ VisibleForTesting static final String REDIRECT_URI = "redirect_uri" ; @ VisibleForTesting static final String STATE = "state" ; @ VisibleForTesting static final String CODE = "code" ; @ VisibleForTesting static final String GRANT_TYPE = "grant_type" ; @ VisibleForTesting static final String GRANT_TYPE_AUTH_CODE = "authorization_code" ; @ VisibleForTesting Context mContext ; @ NonNull private final AuthorizationService . UrlBuilder mUrlBuilder ; @ NonNull private final BrowserHandler mBrowserHandler ; private boolean mDisposed = false ; public AuthorizationService ( @ NonNull Context context ) { } @ VisibleForTesting AuthorizationService ( @ NonNull Context context , @ NonNull AuthorizationService . UrlBuilder urlBuilder , @ NonNull BrowserHandler browserHandler ) { } public Builder createCustomTabsIntentBuilder ( ) { } public void performAuthorizationRequest ( @ NonNull AuthorizationRequest request , @ NonNull PendingIntent resultHandlerIntent ) { } public void performAuthorizationRequest ( @ NonNull AuthorizationRequest request , @ NonNull PendingIntent resultHandlerIntent , @ NonNull CustomTabsIntent customTabsIntent ) { } public void performTokenRequest ( @ NonNull net . openid . appauth . TokenRequest request , @ NonNull AuthorizationService . TokenResponseCallback callback ) { } public void dispose ( ) { } private void checkNotDisposed ( ) { } private class TokenRequestTask extends AsyncTask < Void , Void , JSONObject > { private Uri mRequestUri ; private TokenRequest mRequest ; private AuthorizationService . TokenResponseCallback mCallback ; private AuthorizationException mException ; TokenRequestTask ( Uri requestUri , net . openid . appauth . TokenRequest request , AuthorizationService . TokenResponseCallback callback ) { } @ Override protected JSONObject doInBackground ( Void ... voids ) { } @ Override protected void onPostExecute ( JSONObject json ) { if ( ( mException ) != null ) { mCallback . onTokenRequestCompleted ( null , mException ) ; return ; } if ( json . has ( PARAM_ERROR ) ) { AuthorizationException ex ; try { String error = json . getString ( PARAM_ERROR ) ; ex = AuthorizationException . fromOAuthTemplate ( TokenRequestErrors . byString ( error ) , error , json . getString ( PARAM_ERROR_DESCRIPTION ) , UriUtil . parseUriIfAvailable ( json . getString ( PARAM_ERROR_URI ) ) ) ; } catch ( JSONException jsonEx ) { ex = AuthorizationException . fromTemplate ( JSON_DESERIALIZATION_ERROR , jsonEx ) ; } mCallback . onTokenRequestCompleted ( null , ex ) ; return ; } TokenResponse response ; try { <START_BUG> response = new TokenResponse . Builder ( mRequest ) . fromJson ( json ) . build ( ) ; <END_BUG> } catch ( JSONException jsonEx ) { mCallback . onTokenRequestCompleted ( null , AuthorizationException . fromTemplate ( JSON_DESERIALIZATION_ERROR , jsonEx ) ) ; return ; } Logger . debug ( "Token<seq2seq4repair_space>exchange<seq2seq4repair_space>with<seq2seq4repair_space>%s<seq2seq4repair_space>completed" , mRequest . configuration . tokenEndpoint ) ; mCallback . onTokenRequestCompleted ( response , null ) ; } } public interface TokenResponseCallback { void onTokenRequestCompleted ( @ Nullable TokenResponse response , @ Nullable AuthorizationException ex ) { } } @ VisibleForTesting interface UrlBuilder { URL buildUrlFromString ( String uri ) throws IOException { } } static class DefaultUrlBuilder implements AuthorizationService . UrlBuilder { public static final AuthorizationService . DefaultUrlBuilder INSTANCE = new AuthorizationService . DefaultUrlBuilder ( ) ; DefaultUrlBuilder ( ) { } public URL buildUrlFromString ( String uri ) throws IOException { } } }

Fix:
response = new TokenResponse . Builder ( mRequest ) . fromResponseJson ( json ) . build ( ) ;