Program: 15327
Project: 15327
Buggy source:
@SuppressLint("String_Node_Str") @Override public View onCreateView(final LayoutInflater inflater,final ViewGroup container,final Bundle savedInstanceState){
  mActivity=(AppCompatActivity)getActivity();
  CookieSyncManager.createInstance(mActivity);
  outer=(FrameLayout)inflater.inflate(R.layout.web_view_fragment,null);
  final RedditPost src_post=getArguments().getParcelable("String_Node_Str");
  final RedditPreparedPost post;
  if (src_post != null) {
    final RedditParsedPost parsedPost=new RedditParsedPost(src_post,false);
    post=new RedditPreparedPost(mActivity,CacheManager.getInstance(mActivity),0,parsedPost,-1,false,false);
  }
 else {
    post=null;
  }
  webView=(WebViewFixed)outer.findViewById(R.id.web_view_fragment_webviewfixed);
  final FrameLayout loadingViewFrame=(FrameLayout)outer.findViewById(R.id.web_view_fragment_loadingview_frame);
  progressView=new ProgressBar(mActivity,null,android.R.attr.progressBarStyleHorizontal);
  loadingViewFrame.addView(progressView);
  loadingViewFrame.setPadding(General.dpToPixels(mActivity,10),0,General.dpToPixels(mActivity,10),0);
  final WebSettings settings=webView.getSettings();
  settings.setBuiltInZoomControls(true);
  settings.setJavaScriptEnabled(true);
  settings.setJavaScriptCanOpenWindowsAutomatically(false);
  settings.setUseWideViewPort(true);
  settings.setLoadWithOverviewMode(true);
  settings.setDomStorageEnabled(true);
  if (AndroidApi.isHoneyCombOrLater()) {
    settings.setDisplayZoomControls(false);
  }
  webView.setWebChromeClient(new WebChromeClient(){
    @Override public void onProgressChanged(    WebView view,    final int newProgress){
      super.onProgressChanged(view,newProgress);
      AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
        @Override public void run(){
          progressView.setProgress(newProgress);
          progressView.setVisibility(newProgress == 100 ? View.GONE : View.VISIBLE);
        }
      }
);
    }
  }
);
  if (mUrl != null) {
    webView.loadUrl(mUrl);
  }
 else {
    webView.loadDataWithBaseURL("String_Node_Str",html,"String_Node_Str",null,null);
  }
  webView.setWebViewClient(new WebViewClient(){
    @Override public boolean shouldOverrideUrlLoading(    final WebView view,    final String url){
      if (url == null)       return false;
      if (url.startsWith("String_Node_Str")) {
        return true;
      }
      if (goingBack && currentUrl != null && url.equals(currentUrl)) {
        General.quickToast(mActivity,String.format(Locale.US,"String_Node_Str",-lastBackDepthAttempt),Toast.LENGTH_SHORT);
        lastBackDepthAttempt--;
        if (webView.canGoBackOrForward(lastBackDepthAttempt)) {
          webView.goBackOrForward(lastBackDepthAttempt);
        }
 else {
          mActivity.finish();
        }
      }
 else {
        if (RedditURLParser.parse(Uri.parse(url)) != null) {
          LinkHandler.onLinkClicked(mActivity,url,false);
        }
 else {
          webView.loadUrl(url);
          currentUrl=url;
        }
      }
      return true;
    }
    @Override public void onPageStarted(    WebView view,    String url,    Bitmap favicon){
      super.onPageStarted(view,url,favicon);
      if (mUrl != null && url != null) {
        final AppCompatActivity activity=mActivity;
        if (activity != null) {
          activity.setTitle(url);
        }
      }
    }
    @Override public void onPageFinished(    final WebView view,    final String url){
      super.onPageFinished(view,url);
      new Timer().schedule(new TimerTask(){
        @Override public void run(){
          AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
            @Override public void run(){
              if (currentUrl == null || url == null)               return;
              if (!url.equals(view.getUrl()))               return;
              if (goingBack && url.equals(currentUrl)) {
                General.quickToast(mActivity,String.format(Locale.US,"String_Node_Str",-lastBackDepthAttempt));
                lastBackDepthAttempt--;
                if (webView.canGoBackOrForward(lastBackDepthAttempt)) {
                  webView.goBackOrForward(lastBackDepthAttempt);
                }
 else {
                  mActivity.finish();
                }
              }
 else {
                goingBack=false;
              }
            }
          }
);
        }
      }
,1000);
    }
    @Override public void doUpdateVisitedHistory(    WebView view,    String url,    boolean isReload){
      super.doUpdateVisitedHistory(view,url,isReload);
    }
  }
);
  final FrameLayout outerFrame=new FrameLayout(mActivity);
  outerFrame.addView(outer);
  if (post != null) {
    final SideToolbarOverlay toolbarOverlay=new SideToolbarOverlay(mActivity);
    final BezelSwipeOverlay bezelOverlay=new BezelSwipeOverlay(mActivity,new BezelSwipeOverlay.BezelSwipeListener(){
      @Override public boolean onSwipe(      @BezelSwipeOverlay.SwipeEdge int edge){
        toolbarOverlay.setContents(post.generateToolbar(mActivity,false,toolbarOverlay));
        toolbarOverlay.show(edge == BezelSwipeOverlay.LEFT ? SideToolbarOverlay.SideToolbarPosition.LEFT : SideToolbarOverlay.SideToolbarPosition.RIGHT);
        return true;
      }
      @Override public boolean onTap(){
        if (toolbarOverlay.isShown()) {
          toolbarOverlay.hide();
          return true;
        }
        return false;
      }
    }
);
    outerFrame.addView(bezelOverlay);
    outerFrame.addView(toolbarOverlay);
    bezelOverlay.getLayoutParams().width=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
    bezelOverlay.getLayoutParams().height=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
    toolbarOverlay.getLayoutParams().width=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
    toolbarOverlay.getLayoutParams().height=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
  }
  return outerFrame;
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public View onCreateView(final LayoutInflater inflater,final ViewGroup container,final Bundle savedInstanceState){
  mActivity=(AppCompatActivity)getActivity();
  CookieSyncManager.createInstance(mActivity);
  outer=(FrameLayout)inflater.inflate(R.layout.web_view_fragment,null);
  final RedditPost src_post=getArguments().getParcelable("String_Node_Str");
  final RedditPreparedPost post;
  if (src_post != null) {
    final RedditParsedPost parsedPost=new RedditParsedPost(src_post,false);
    post=new RedditPreparedPost(mActivity,CacheManager.getInstance(mActivity),0,parsedPost,-1,false,false);
  }
 else {
    post=null;
  }
  webView=(WebViewFixed)outer.findViewById(R.id.web_view_fragment_webviewfixed);
  final FrameLayout loadingViewFrame=(FrameLayout)outer.findViewById(R.id.web_view_fragment_loadingview_frame);
  webView.setDownloadListener(new DownloadListener(){
    @Override public void onDownloadStart(    final String url,    String userAgent,    String contentDisposition,    String mimetype,    long contentLength){
{
        new AlertDialog.Builder(mActivity).setTitle(R.string.download_link_title).setMessage(R.string.download_link_message).setPositiveButton(android.R.string.yes,new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int which){
            Intent i=new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            getContext().startActivity(i);
            mActivity.onBackPressed();
          }
        }
).setNegativeButton(android.R.string.no,new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int which){
            mActivity.onBackPressed();
          }
        }
).setIcon(android.R.drawable.ic_dialog_alert).show();
      }
    }
  }
);
  progressView=new ProgressBar(mActivity,null,android.R.attr.progressBarStyleHorizontal);
  loadingViewFrame.addView(progressView);
  loadingViewFrame.setPadding(General.dpToPixels(mActivity,10),0,General.dpToPixels(mActivity,10),0);
  final WebSettings settings=webView.getSettings();
  settings.setBuiltInZoomControls(true);
  settings.setJavaScriptEnabled(true);
  settings.setJavaScriptCanOpenWindowsAutomatically(false);
  settings.setUseWideViewPort(true);
  settings.setLoadWithOverviewMode(true);
  settings.setDomStorageEnabled(true);
  if (AndroidApi.isHoneyCombOrLater()) {
    settings.setDisplayZoomControls(false);
  }
  webView.setWebChromeClient(new WebChromeClient(){
    @Override public void onProgressChanged(    WebView view,    final int newProgress){
      super.onProgressChanged(view,newProgress);
      AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
        @Override public void run(){
          progressView.setProgress(newProgress);
          progressView.setVisibility(newProgress == 100 ? View.GONE : View.VISIBLE);
        }
      }
);
    }
  }
);
  if (mUrl != null) {
    webView.loadUrl(mUrl);
  }
 else {
    webView.loadDataWithBaseURL("String_Node_Str",html,"String_Node_Str",null,null);
  }
  webView.setWebViewClient(new WebViewClient(){
    @Override public boolean shouldOverrideUrlLoading(    final WebView view,    final String url){
      if (url == null)       return false;
      if (url.startsWith("String_Node_Str")) {
        return true;
      }
      if (goingBack && currentUrl != null && url.equals(currentUrl)) {
        General.quickToast(mActivity,String.format(Locale.US,"String_Node_Str",-lastBackDepthAttempt),Toast.LENGTH_SHORT);
        lastBackDepthAttempt--;
        if (webView.canGoBackOrForward(lastBackDepthAttempt)) {
          webView.goBackOrForward(lastBackDepthAttempt);
        }
 else {
          mActivity.finish();
        }
      }
 else {
        if (RedditURLParser.parse(Uri.parse(url)) != null) {
          LinkHandler.onLinkClicked(mActivity,url,false);
        }
 else {
          webView.loadUrl(url);
          currentUrl=url;
        }
      }
      return true;
    }
    @Override public void onPageStarted(    WebView view,    String url,    Bitmap favicon){
      super.onPageStarted(view,url,favicon);
      if (mUrl != null && url != null) {
        final AppCompatActivity activity=mActivity;
        if (activity != null) {
          activity.setTitle(url);
        }
      }
    }
    @Override public void onPageFinished(    final WebView view,    final String url){
      super.onPageFinished(view,url);
      new Timer().schedule(new TimerTask(){
        @Override public void run(){
          AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
            @Override public void run(){
              if (currentUrl == null || url == null)               return;
              if (!url.equals(view.getUrl()))               return;
              if (goingBack && url.equals(currentUrl)) {
                General.quickToast(mActivity,String.format(Locale.US,"String_Node_Str",-lastBackDepthAttempt));
                lastBackDepthAttempt--;
                if (webView.canGoBackOrForward(lastBackDepthAttempt)) {
                  webView.goBackOrForward(lastBackDepthAttempt);
                }
 else {
                  mActivity.finish();
                }
              }
 else {
                goingBack=false;
              }
            }
          }
);
        }
      }
,1000);
    }
    @Override public void doUpdateVisitedHistory(    WebView view,    String url,    boolean isReload){
      super.doUpdateVisitedHistory(view,url,isReload);
    }
  }
);
  final FrameLayout outerFrame=new FrameLayout(mActivity);
  outerFrame.addView(outer);
  if (post != null) {
    final SideToolbarOverlay toolbarOverlay=new SideToolbarOverlay(mActivity);
    final BezelSwipeOverlay bezelOverlay=new BezelSwipeOverlay(mActivity,new BezelSwipeOverlay.BezelSwipeListener(){
      @Override public boolean onSwipe(      @BezelSwipeOverlay.SwipeEdge int edge){
        toolbarOverlay.setContents(post.generateToolbar(mActivity,false,toolbarOverlay));
        toolbarOverlay.show(edge == BezelSwipeOverlay.LEFT ? SideToolbarOverlay.SideToolbarPosition.LEFT : SideToolbarOverlay.SideToolbarPosition.RIGHT);
        return true;
      }
      @Override public boolean onTap(){
        if (toolbarOverlay.isShown()) {
          toolbarOverlay.hide();
          return true;
        }
        return false;
      }
    }
);
    outerFrame.addView(bezelOverlay);
    outerFrame.addView(toolbarOverlay);
    bezelOverlay.getLayoutParams().width=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
    bezelOverlay.getLayoutParams().height=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
    toolbarOverlay.getLayoutParams().width=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
    toolbarOverlay.getLayoutParams().height=android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
  }
  return outerFrame;
}