Program: 116987
Project: 116987
Buggy source:
public WebResourceResponse interceptHtml(GoNativeWebviewInterface view,String url){
  AppConfig appConfig=AppConfig.getInstance(context);
  if (!appConfig.interceptHtml)   return null;
  if (!hasIntercepted) {
    interceptUrl=url;
    hasIntercepted=true;
  }
  if (!urlMatches(interceptUrl,url))   return null;
  InputStream is=null;
  ByteArrayOutputStream baos=null;
  try {
    URL parsedUrl=new URL(url);
    String protocol=parsedUrl.getProtocol();
    if (!protocol.equalsIgnoreCase("String_Node_Str") && !protocol.equalsIgnoreCase("String_Node_Str"))     return null;
    HttpURLConnection connection;
    boolean wasRedirected=false;
    int numRedirects=0;
    do {
      connection=(HttpURLConnection)parsedUrl.openConnection();
      connection.setInstanceFollowRedirects(false);
      String customUserAgent=appConfig.userAgentForUrl(parsedUrl.toString());
      if (customUserAgent != null) {
        connection.setRequestProperty("String_Node_Str",customUserAgent);
      }
 else {
        connection.setRequestProperty("String_Node_Str",appConfig.userAgent);
      }
      connection.setRequestProperty("String_Node_Str","String_Node_Str");
      connection.connect();
      int responseCode=connection.getResponseCode();
      if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP) {
        wasRedirected=true;
        numRedirects++;
        parsedUrl=new URL(parsedUrl,connection.getHeaderField("String_Node_Str"));
        if (urlNavigation != null && urlNavigation.shouldOverrideUrlLoadingNoIntercept(view,parsedUrl.toString(),true)) {
          urlNavigation.showWebViewImmediately();
          connection.disconnect();
          return null;
        }
      }
 else {
        wasRedirected=false;
      }
    }
 while (wasRedirected && numRedirects < 10);
    String mimetype=connection.getContentType();
    if (mimetype == null) {
      try {
        is=new BufferedInputStream(connection.getInputStream());
      }
 catch (      IOException e) {
        is=new BufferedInputStream(connection.getErrorStream());
      }
      mimetype=HttpURLConnection.guessContentTypeFromStream(is);
    }
    if (mimetype == null || !mimetype.startsWith("String_Node_Str"))     return null;
    String encoding=connection.getContentEncoding();
    if (encoding == null)     encoding="String_Node_Str";
    if (is == null) {
      try {
        is=new BufferedInputStream(connection.getInputStream());
      }
 catch (      IOException e) {
        is=new BufferedInputStream(connection.getErrorStream());
      }
      if (is == null)       return null;
    }
    int initialLength=connection.getContentLength();
    if (initialLength < 0)     initialLength=UrlNavigation.DEFAULT_HTML_SIZE;
    baos=new ByteArrayOutputStream(initialLength);
    IOUtils.copy(is,baos);
    String origString;
    try {
      origString=baos.toString(encoding);
    }
 catch (    UnsupportedEncodingException e) {
      origString=baos.toString("String_Node_Str");
    }
    String newString=null;
    int insertPoint=origString.indexOf("String_Node_Str");
    if (insertPoint >= 0) {
      StringBuilder builder=new StringBuilder(initialLength);
      builder.append(origString.substring(0,insertPoint));
      if (appConfig.customCSS != null) {
        builder.append("String_Node_Str");
        builder.append(appConfig.customCSS);
        builder.append("String_Node_Str");
      }
      if (appConfig.stringViewport != null) {
        builder.append("String_Node_Str");
        builder.append(TextUtils.htmlEncode(appConfig.stringViewport));
        builder.append("String_Node_Str");
      }
      if (!Double.isNaN(appConfig.forceViewportWidth)) {
        if (appConfig.zoomableForceViewport) {
          builder.append(String.format("String_Node_Str",appConfig.forceViewportWidth));
        }
 else {
          double webViewWidth=view.getWidth() / context.getResources().getDisplayMetrics().density;
          double viewportWidth=appConfig.forceViewportWidth;
          double scale=webViewWidth / viewportWidth;
          builder.append(String.format("String_Node_Str",viewportWidth,scale,scale,scale));
        }
      }
      builder.append(origString.substring(insertPoint));
      newString=builder.toString();
    }
 else {
      Log.d(TAG,"String_Node_Str");
      newString=origString;
    }
    return new WebResourceResponse("String_Node_Str","String_Node_Str",new ByteArrayInputStream(newString.getBytes("String_Node_Str")));
  }
 catch (  Exception e) {
    Log.e(TAG,e.toString(),e);
    return null;
  }
 finally {
    IOUtils.close(is);
    IOUtils.close(baos);
  }
}

Fixed version (ground truth):
public WebResourceResponse interceptHtml(GoNativeWebviewInterface view,String url){
  AppConfig appConfig=AppConfig.getInstance(context);
  if (!appConfig.interceptHtml)   return null;
  if (!hasIntercepted) {
    interceptUrl=url;
    hasIntercepted=true;
  }
  if (!urlMatches(interceptUrl,url))   return null;
  InputStream is=null;
  ByteArrayOutputStream baos=null;
  try {
    URL parsedUrl=new URL(url);
    String protocol=parsedUrl.getProtocol();
    if (!protocol.equalsIgnoreCase("String_Node_Str") && !protocol.equalsIgnoreCase("String_Node_Str"))     return null;
    HttpURLConnection connection=(HttpURLConnection)parsedUrl.openConnection();
    connection.setInstanceFollowRedirects(false);
    String customUserAgent=appConfig.userAgentForUrl(parsedUrl.toString());
    if (customUserAgent != null) {
      connection.setRequestProperty("String_Node_Str",customUserAgent);
    }
 else {
      connection.setRequestProperty("String_Node_Str",appConfig.userAgent);
    }
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    connection.connect();
    int responseCode=connection.getResponseCode();
    if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP || responseCode == HttpURLConnection.HTTP_SEE_OTHER || responseCode == 307) {
      String location=connection.getHeaderField("String_Node_Str");
      if (location != null) {
        String webpage="String_Node_Str" + LeanUtils.jsWrapString(location) + "String_Node_Str";
        return new WebResourceResponse("String_Node_Str","String_Node_Str",new ByteArrayInputStream(webpage.getBytes("String_Node_Str")));
      }
    }
    String mimetype=connection.getContentType();
    if (mimetype == null) {
      try {
        is=new BufferedInputStream(connection.getInputStream());
      }
 catch (      IOException e) {
        is=new BufferedInputStream(connection.getErrorStream());
      }
      mimetype=HttpURLConnection.guessContentTypeFromStream(is);
    }
    if (mimetype == null || !mimetype.startsWith("String_Node_Str"))     return null;
    String encoding=connection.getContentEncoding();
    if (encoding == null)     encoding="String_Node_Str";
    if (is == null) {
      try {
        is=new BufferedInputStream(connection.getInputStream());
      }
 catch (      IOException e) {
        is=new BufferedInputStream(connection.getErrorStream());
      }
      if (is == null)       return null;
    }
    int initialLength=connection.getContentLength();
    if (initialLength < 0)     initialLength=UrlNavigation.DEFAULT_HTML_SIZE;
    baos=new ByteArrayOutputStream(initialLength);
    IOUtils.copy(is,baos);
    String origString;
    try {
      origString=baos.toString(encoding);
    }
 catch (    UnsupportedEncodingException e) {
      origString=baos.toString("String_Node_Str");
    }
    String newString=null;
    int insertPoint=origString.indexOf("String_Node_Str");
    if (insertPoint >= 0) {
      StringBuilder builder=new StringBuilder(initialLength);
      builder.append(origString.substring(0,insertPoint));
      if (appConfig.customCSS != null) {
        builder.append("String_Node_Str");
        builder.append(appConfig.customCSS);
        builder.append("String_Node_Str");
      }
      if (appConfig.stringViewport != null) {
        builder.append("String_Node_Str");
        builder.append(TextUtils.htmlEncode(appConfig.stringViewport));
        builder.append("String_Node_Str");
      }
      if (!Double.isNaN(appConfig.forceViewportWidth)) {
        if (appConfig.zoomableForceViewport) {
          builder.append(String.format("String_Node_Str",appConfig.forceViewportWidth));
        }
 else {
          double webViewWidth=view.getWidth() / context.getResources().getDisplayMetrics().density;
          double viewportWidth=appConfig.forceViewportWidth;
          double scale=webViewWidth / viewportWidth;
          builder.append(String.format("String_Node_Str",viewportWidth,scale,scale,scale));
        }
      }
      builder.append(origString.substring(insertPoint));
      newString=builder.toString();
    }
 else {
      Log.d(TAG,"String_Node_Str");
      newString=origString;
    }
    return new WebResourceResponse("String_Node_Str","String_Node_Str",new ByteArrayInputStream(newString.getBytes("String_Node_Str")));
  }
 catch (  Exception e) {
    Log.e(TAG,e.toString(),e);
    return null;
  }
 finally {
    IOUtils.close(is);
    IOUtils.close(baos);
  }
}