Buggy code:
public class NetworkUtils { private static final String TAG = NetworkUtils . class . getSimpleName ( ) ; private Context mContext ; private BaseNetworkWrapper mWrapper ; public NetworkUtils ( Context context ) { } public void getGuestToken ( final ISparkResponse < AccessTokenResponse > onGuestTokenResponse ) { } public void getAccessToken ( AuthCodeRequest authCode , final ISparkResponse < AccessTokenResponse > onAccessTokenResponse ) { } public void getAuthorizationCode ( final ISparkResponse < AccessTokenResponse > onAccessTokenResponse ) { } public void getRefreshToken ( RefreshAccessTokenRequest refreshCode , final ISparkResponse < AccessTokenResponse > onRefreshTokenResponse ) { } public void callWithUpdateRefreshToken ( final Runnable action , final ISparkResponse < ? > onResponse ) { } public void callWithUpdateRefreshToken ( final Runnable action , final ISparkResponse < ? > onResponse , boolean checkToken ) { } public void getAsset ( final AssetRequest asset , final ISparkResponse < AssetResponse > onAssetResponse ) { } public void getAssets ( final ISparkResponse < AssetsListResponse > onAssetResponse ) { } public void getMemberAssets ( final MemberRequest member , final ISparkResponse < AssetsListResponse > onAssetResponse ) { } public void getMember ( final MemberRequest member , final ISparkResponse < MemberResponse > onMemberResponse ) { } public boolean isGuestTokenType ( final ISparkResponse < ? > onResponse ) { } public void createAsset ( final AssetRequest asset , final ISparkResponse < AssetResponse > onCreateAssetResponse ) { } public void createFile ( final FileRequest file , final ISparkResponse < FilesResponse > onSparkResponse ) { } public void registerPrinter ( final PrinterRegisterRequest printer , final ISparkResponse < PrinterRegisterResponse > onSparkResponse ) { } public void unregisterPrinter ( final PrinterUnregisterRequest printer , final ISparkResponse < Object > onSparkResponse ) { } public void createJob ( final CreateJobRequest printerJob , final ISparkResponse < CreateJobResponse > onSparkResponse ) { } public void commandSend ( final CommandSendRequest command , final ISparkResponse < CommandSendResponse > onSparkResponse ) { } public void jobStatus ( final PrinterJobStatusRequest jobStatus , final ISparkResponse < PrinterJobStatusResponse > onSparkResponse ) { } private void initAndShowWebview ( final ISparkResponse < AccessTokenResponse > onAccessTokenResponse ) { Uri . Builder builder = new Uri . Builder ( ) ; <START_BUG> builder . scheme ( SPARK_SCHEME ) . authority ( Utils . getBaseURL ( ) ) . appendPath ( API_AUTHORIZE ) . appendQueryParameter ( SPARK_LOGIN_REQUEST_PARAM_RESPONSE_TYPE , SPARK_LOGIN_REQUEST_VALUE_RESPONSE_TYPE ) . appendQueryParameter ( SPARK_LOGIN_REQUEST_PARAM_CLIENT_ID , MemoryManager . getInstance ( ) . getAppKey ( ) ) . appendQueryParameter ( SPARK_LOGIN_REQUEST_PARAM_REDIRECT_URI , SPARK_BOGUS_REDIRECT_URL ) ; <END_BUG> Uri uri = builder . build ( ) ; final String initialUrl = URLDecoder . decode ( uri . toString ( ) ) ; LoginWebView webView = new LoginWebView ( mContext ) ; if ( MemoryManager . getInstance ( ) . getDebugMode ( ) ) { DebugModeUtils . logDebugMessage ( NetworkUtils . TAG , "Logging<seq2seq4repair_space>into<seq2seq4repair_space>Spark<seq2seq4repair_space>with<seq2seq4repair_space>URL:" , initialUrl ) ; } webView . loadUrl ( initialUrl ) ; final Dialog dialog = webView . getDialog ( mContext ) ; dialog . show ( ) ; View mainView = View . inflate ( mContext , layout_login_dialog , null ) ; RelativeLayout relativeWrapper = ( ( RelativeLayout ) ( mainView . findViewById ( realtive_webview_wrapper ) ) ) ; RelativeLayout . LayoutParams lp = new RelativeLayout . LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . MATCH_PARENT ) ; relativeWrapper . addView ( webView , lp ) ; dialog . setContentView ( mainView ) ; webView . setWebViewAccessInvoke ( new IOnWebViewAccessInvoke ( ) { @ Override public void onWebViewAccessInvoke ( String url ) { dialog . dismiss ( ) ; loadURLAuthorizationCode ( url , onAccessTokenResponse ) ; } } ) ; } private void loadURLAuthorizationCode ( String url , ISparkResponse < AccessTokenResponse > onAccessTokenResponse ) { } }

Fix:
builder . scheme ( SPARK_SCHEME ) . authority ( Utils . getBaseURLNoScheme ( ) ) . appendPath ( API_AUTHORIZE ) . appendQueryParameter ( SPARK_LOGIN_REQUEST_PARAM_RESPONSE_TYPE , SPARK_LOGIN_REQUEST_VALUE_RESPONSE_TYPE ) . appendQueryParameter ( SPARK_LOGIN_REQUEST_PARAM_CLIENT_ID , MemoryManager . getInstance ( ) . getAppKey ( ) ) . appendQueryParameter ( SPARK_LOGIN_REQUEST_PARAM_REDIRECT_URI , SPARK_BOGUS_REDIRECT_URL ) ;