Source:
<code>public boolean shouldOverrideUrlLoading(WebView view, String stringUrl) { try { final Uri url = Uri.parse(stringUrl); final SiteModel site = mSiteStore.getSiteByLocalId(AppPrefs.getSelectedSite()); final String loadedHost = url.getHost(); final String loadedPath = url.getPath(); final String currentSiteHost = Uri.parse(site.getUrl()).getHost(); if (loadedHost.equals(currentSiteHost) && loadedPath.equals(LOGIN_PATH) && stringUrl.contains(REDIRECT_PARAMETER)) { redirectPage = extractRedirect(stringUrl); loginToWPCom(view, site); return true; } else if (loadedHost.equals(currentSiteHost) && loadedPath.equals(ADMIN_PATH) && redirectPage != null) { view.loadUrl(redirectPage); redirectPage = null; return true; } else if (loadedHost.equals(WORDPRESS_COM_HOST) && loadedPath.equals(LOG_IN_PATH) && stringUrl.contains(REDIRECT_PARAMETER)) { redirectPage = extractRedirect(stringUrl); Intent loginIntent = new Intent(activity, LoginActivity.class); LoginMode.JETPACK_STATS.putInto(loginIntent); activity.startActivityForResult(loginIntent, REQUEST_CODE); return true; } else if (loadedHost.equals(JETPACK_DEEPLINK_URI.getHost()) && url.getScheme().equals(JETPACK_DEEPLINK_URI.getScheme())) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(url); activity.startActivity(intent); activity.finish(); flowFinished = true; AnalyticsTracker.track(AnalyticsTracker.Stat.STATS_SELECTED_INSTALL_JETPACK); return true; } } catch (UnsupportedEncodingException e) { AppLog.e(AppLog.T.API, "Unexpected URL encoding in Jetpack connection flow.", e); <START> e.printStackTrace(); <END> } return false; }</code><technical_language>AppLog.e logs stack trace, e.printStackTrace() necessary here</technical_language>

Target:
public boolean shouldOverrideUrlLoading(WebView view, String stringUrl) { try { final Uri url = Uri.parse(stringUrl); final String loadedHost = url.getHost(); if (loadedHost == null) { return false; } final String loadedPath = url.getPath(); final String currentSiteHost = Uri.parse(mSiteModel.getUrl()).getHost(); if (loadedHost.equals(currentSiteHost) && loadedPath != null && loadedPath.contains(LOGIN_PATH) && stringUrl.contains(REDIRECT_PARAMETER)) { redirectPage = extractRedirect(stringUrl); loginToWPCom(view, mSiteModel); return true; } else if (loadedHost.equals(currentSiteHost) && loadedPath != null && loadedPath.contains(ADMIN_PATH) && redirectPage != null) { view.loadUrl(redirectPage); redirectPage = null; return true; } else if (loadedHost.equals(WORDPRESS_COM_HOST) && loadedPath != null && loadedPath.contains(LOG_IN_PATH) && stringUrl.contains(REDIRECT_PARAMETER)) { redirectPage = extractRedirect(stringUrl); Intent loginIntent = new Intent(activity, LoginActivity.class); LoginMode.JETPACK_STATS.putInto(loginIntent); activity.startActivityForResult(loginIntent, JETPACK_LOGIN); return true; } else if (loadedHost.equals(JETPACK_DEEPLINK_URI.getHost()) && url.getScheme().equals(JETPACK_DEEPLINK_URI.getScheme())) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(url); intent.putExtra(SITE, mSiteModel); activity.startActivity(intent); activity.finish(); flowFinished = true; AnalyticsTracker.track(AnalyticsTracker.Stat.STATS_COMPLETED_INSTALL_JETPACK); return true; } } catch (UnsupportedEncodingException e) { AppLog.e(AppLog.T.API, "Unexpected URL encoding in Jetpack connection flow.", e); } return false; }