Program: 117031
Project: 117031
Buggy source:
protected String doInBackground(WebviewInterceptParams... inputs){
  AppConfig appConfig=AppConfig.getInstance(this.context);
  InputStream is=null;
  ByteArrayOutputStream baos=null;
  try {
    parsedUrl=inputs[0].url;
    webview=inputs[0].webview;
    boolean isReload=inputs[0].isReload;
    HttpURLConnection.setFollowRedirects(true);
    HttpURLConnection connection=null;
    boolean wasRedirected=false;
    int numRedirects=0;
    do {
      if (isCancelled())       return null;
      connection=(HttpURLConnection)parsedUrl.openConnection();
      connection.setInstanceFollowRedirects(false);
      connection.setRequestProperty("String_Node_Str",appConfig.userAgent);
      if (isReload)       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;
        parsedUrl=new URL(connection.getHeaderField("String_Node_Str"));
        if (this.leanWebviewClient != null && this.leanWebviewClient.shouldOverrideUrlLoadingNoIntercept(this.webview,parsedUrl.toString())) {
          leanWebviewClient.showWebViewImmediately();
          connection.disconnect();
          this.cancel(true);
          return null;
        }
        numRedirects++;
      }
 else {
        wasRedirected=false;
      }
    }
 while (wasRedirected && numRedirects < 10);
    finalUrl=connection.getURL();
    String mimetype=connection.getContentType();
    if (mimetype == null) {
      is=new BufferedInputStream(connection.getInputStream());
      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)     is=new BufferedInputStream(connection.getInputStream());
    int initialLength=connection.getContentLength();
    if (initialLength < 0)     initialLength=LeanWebviewClient.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)) {
        double webViewWidth=webview.getWidth() / this.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 newString;
  }
 catch (  Exception e) {
    Log.e(TAG,e.toString(),e);
    return null;
  }
 finally {
    IOUtils.close(is);
    IOUtils.close(baos);
  }
}

Fixed version (ground truth):
protected String doInBackground(WebviewInterceptParams... inputs){
  AppConfig appConfig=AppConfig.getInstance(this.context);
  InputStream is=null;
  ByteArrayOutputStream baos=null;
  try {
    parsedUrl=inputs[0].url;
    webview=inputs[0].webview;
    boolean isReload=inputs[0].isReload;
    HttpURLConnection.setFollowRedirects(true);
    HttpURLConnection connection=null;
    boolean wasRedirected=false;
    int numRedirects=0;
    do {
      if (isCancelled())       return null;
      connection=(HttpURLConnection)parsedUrl.openConnection();
      connection.setInstanceFollowRedirects(false);
      connection.setRequestProperty("String_Node_Str",appConfig.userAgent);
      if (isReload)       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;
        parsedUrl=new URL(parsedUrl,connection.getHeaderField("String_Node_Str"));
        if (this.leanWebviewClient != null && this.leanWebviewClient.shouldOverrideUrlLoadingNoIntercept(this.webview,parsedUrl.toString())) {
          leanWebviewClient.showWebViewImmediately();
          connection.disconnect();
          this.cancel(true);
          return null;
        }
        numRedirects++;
      }
 else {
        wasRedirected=false;
      }
    }
 while (wasRedirected && numRedirects < 10);
    finalUrl=connection.getURL();
    String mimetype=connection.getContentType();
    if (mimetype == null) {
      is=new BufferedInputStream(connection.getInputStream());
      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)     is=new BufferedInputStream(connection.getInputStream());
    int initialLength=connection.getContentLength();
    if (initialLength < 0)     initialLength=LeanWebviewClient.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)) {
        double webViewWidth=webview.getWidth() / this.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 newString;
  }
 catch (  Exception e) {
    Log.e(TAG,e.toString(),e);
    return null;
  }
 finally {
    IOUtils.close(is);
    IOUtils.close(baos);
  }
}