Program: 164503
Project: 164503
Buggy source:
/** 
 * Configures the webview to handle a user logging in
 */
private void configWebView(){
  getSupportActionBar().hide();
  mMultiView.setViewState(MultiStateView.ViewState.EMPTY);
  WebView webView=(WebView)mMultiView.getView(MultiStateView.ViewState.EMPTY).findViewById(R.id.loginWebView);
  webView.loadUrl(Endpoints.LOGIN.getUrl());
  webView.getSettings().setJavaScriptEnabled(true);
  webView.setWebViewClient(new WebViewClient(){
    @Override public boolean shouldOverrideUrlLoading(    WebView view,    String url){
      if (url.startsWith(REDIRECT_URL)) {
        mMultiView.setViewState(MultiStateView.ViewState.LOADING);
        String[] outerSplit=url.split("String_Node_Str")[1].split("String_Node_Str");
        String username=null;
        String accessToken=null;
        String refreshToken=null;
        long accessTokenExpiration=0;
        int index=0;
        for (        String s : outerSplit) {
          String[] innerSplit=s.split("String_Node_Str");
switch (index) {
case 0:
            accessToken=innerSplit[1];
          break;
case 1:
        long expiresIn=Long.parseLong(innerSplit[1]);
      accessTokenExpiration=System.currentTimeMillis() + (expiresIn * DateUtils.SECOND_IN_MILLIS);
    break;
case 2:
  break;
case 3:
refreshToken=innerSplit[1];
break;
case 4:
username=innerSplit[1];
break;
}
index++;
}
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(accessToken) && !TextUtils.isEmpty(refreshToken)&& accessTokenExpiration > 0) {
ImgurUser newUser=new ImgurUser(username,accessToken,refreshToken,accessTokenExpiration);
app.setUser(newUser);
user=newUser;
mSelectedUser=newUser;
LogUtil.v(TAG,"String_Node_Str" + newUser.getUsername() + "String_Node_Str");
String detailsUrls=String.format(Endpoints.PROFILE.getUrl(),newUser.getUsername());
new ApiClient(detailsUrls,ApiClient.HttpRequest.GET).doWork(ImgurBusEvent.EventType.PROFILE_DETAILS,newUser.getUsername(),null);
CookieManager.getInstance().removeAllCookie();
view.clearHistory();
view.clearCache(true);
view.clearFormData();
getSupportActionBar().show();
getSupportActionBar().setTitle(user.getUsername());
setResult(Activity.RESULT_OK,new Intent().putExtra(KEY_LOGGED_IN,true));
}
 else {
mHandler.sendMessage(ImgurHandler.MESSAGE_ACTION_FAILED,R.string.error_generic);
}
}
 else {
view.loadUrl(url);
}
return true;
}
}
);
}

Fixed version (ground truth):
/** 
 * Configures the webview to handle a user logging in
 */
private void configWebView(){
  getSupportActionBar().hide();
  mMultiView.setViewState(MultiStateView.ViewState.EMPTY);
  WebView webView=(WebView)mMultiView.getView(MultiStateView.ViewState.EMPTY).findViewById(R.id.loginWebView);
  webView.loadUrl(Endpoints.LOGIN.getUrl());
  webView.getSettings().setJavaScriptEnabled(true);
  webView.setWebViewClient(new WebViewClient(){
    @Override public boolean shouldOverrideUrlLoading(    WebView view,    String url){
      if (url.startsWith(REDIRECT_URL)) {
        if (url.contains("String_Node_Str")) {
          LogUtil.v(TAG,"String_Node_Str" + url);
          view.loadUrl(Endpoints.LOGIN.getUrl());
          return true;
        }
        mMultiView.setViewState(MultiStateView.ViewState.LOADING);
        String[] outerSplit=url.split("String_Node_Str")[1].split("String_Node_Str");
        String username=null;
        String accessToken=null;
        String refreshToken=null;
        long accessTokenExpiration=0;
        int index=0;
        for (        String s : outerSplit) {
          String[] innerSplit=s.split("String_Node_Str");
switch (index) {
case 0:
            accessToken=innerSplit[1];
          break;
case 1:
        long expiresIn=Long.parseLong(innerSplit[1]);
      accessTokenExpiration=System.currentTimeMillis() + (expiresIn * DateUtils.SECOND_IN_MILLIS);
    break;
case 2:
  break;
case 3:
refreshToken=innerSplit[1];
break;
case 4:
username=innerSplit[1];
break;
}
index++;
}
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(accessToken) && !TextUtils.isEmpty(refreshToken)&& accessTokenExpiration > 0) {
ImgurUser newUser=new ImgurUser(username,accessToken,refreshToken,accessTokenExpiration);
app.setUser(newUser);
user=newUser;
mSelectedUser=newUser;
LogUtil.v(TAG,"String_Node_Str" + newUser.getUsername() + "String_Node_Str");
String detailsUrls=String.format(Endpoints.PROFILE.getUrl(),newUser.getUsername());
new ApiClient(detailsUrls,ApiClient.HttpRequest.GET).doWork(ImgurBusEvent.EventType.PROFILE_DETAILS,newUser.getUsername(),null);
CookieManager.getInstance().removeAllCookie();
view.clearHistory();
view.clearCache(true);
view.clearFormData();
getSupportActionBar().show();
getSupportActionBar().setTitle(user.getUsername());
setResult(Activity.RESULT_OK,new Intent().putExtra(KEY_LOGGED_IN,true));
}
 else {
mHandler.sendMessage(ImgurHandler.MESSAGE_ACTION_FAILED,R.string.error_generic);
}
}
 else {
view.loadUrl(url);
}
return true;
}
}
);
}