Program: 177873
Project: 177873
Buggy source:
/** 
 * Connect to an HTTP URL and return the response as a string. Note that the HTTP method override is used on non-GET requests. (i.e. requests are made as "POST" with method specified in the body).
 * @param url - the resource to open: must be a welformed URL
 * @param method - the HTTP method to use ("GET", "POST", etc.)
 * @param params - the query parameter for the URL (e.g. access_token=foo)
 * @return the URL contents as a String
 * @throws MalformedURLException - if the URL format is invalid
 * @throws IOException - if a network problem occurs
 */
public static String openUrl(String url,String method,Bundle params) throws MalformedURLException, IOException {
  String strBoundary="String_Node_Str";
  String endLine="String_Node_Str";
  OutputStream os;
  if (method.equals("String_Node_Str")) {
    url=url + "String_Node_Str" + encodeUrl(params);
  }
  Log.d("String_Node_Str",method + "String_Node_Str" + url);
  HttpURLConnection conn=(HttpURLConnection)new URL(url).openConnection();
  conn.setRequestProperty("String_Node_Str",System.getProperties().getProperty("String_Node_Str") + "String_Node_Str");
  if (!method.equals("String_Node_Str")) {
    Bundle dataparams=new Bundle();
    for (    String key : params.keySet()) {
      Object object=params.get(key);
      if (object instanceof byte[]) {
        dataparams.putByteArray(key,(byte[])object);
      }
 else       if (object instanceof String) {
        dataparams.putByteArray(key,((String)object).getBytes());
      }
    }
    if (!params.containsKey("String_Node_Str")) {
      params.putString("String_Node_Str",method);
    }
    if (params.containsKey("String_Node_Str")) {
      String decoded_token=URLDecoder.decode(params.getString("String_Node_Str"));
      params.putString("String_Node_Str",decoded_token);
    }
    conn.setRequestMethod("String_Node_Str");
    conn.setRequestProperty("String_Node_Str","String_Node_Str" + strBoundary);
    conn.setDoOutput(true);
    conn.setDoInput(true);
    conn.setRequestProperty("String_Node_Str","String_Node_Str");
    conn.connect();
    os=new BufferedOutputStream(conn.getOutputStream());
    os.write(("String_Node_Str" + strBoundary + endLine).getBytes());
    os.write((encodePostBody(params,strBoundary)).getBytes());
    os.write((endLine + "String_Node_Str" + strBoundary+ endLine).getBytes());
    if (!dataparams.isEmpty()) {
      for (      String key : dataparams.keySet()) {
        os.write(("String_Node_Str" + key + "String_Node_Str"+ endLine).getBytes());
        os.write(("String_Node_Str" + endLine + endLine).getBytes());
        os.write(dataparams.getByteArray(key));
        os.write((endLine + "String_Node_Str" + strBoundary+ endLine).getBytes());
      }
    }
    os.flush();
  }
  String response="String_Node_Str";
  try {
    response=read(conn.getInputStream());
  }
 catch (  FileNotFoundException e) {
    response=read(conn.getErrorStream());
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Connect to an HTTP URL and return the response as a string. Note that the HTTP method override is used on non-GET requests. (i.e. requests are made as "POST" with method specified in the body).
 * @param url - the resource to open: must be a welformed URL
 * @param method - the HTTP method to use ("GET", "POST", etc.)
 * @param params - the query parameter for the URL (e.g. access_token=foo)
 * @return the URL contents as a String
 * @throws MalformedURLException - if the URL format is invalid
 * @throws IOException - if a network problem occurs
 */
public static String openUrl(String url,String method,Bundle params) throws MalformedURLException, IOException {
  String strBoundary="String_Node_Str";
  String endLine="String_Node_Str";
  OutputStream os=null;
  try {
    if (method.equals("String_Node_Str")) {
      url=url + "String_Node_Str" + encodeUrl(params);
    }
    Log.d("String_Node_Str",method + "String_Node_Str" + url);
    HttpURLConnection conn=(HttpURLConnection)new URL(url).openConnection();
    conn.setRequestProperty("String_Node_Str",System.getProperties().getProperty("String_Node_Str") + "String_Node_Str");
    if (!method.equals("String_Node_Str")) {
      Bundle dataparams=new Bundle();
      for (      String key : params.keySet()) {
        Object object=params.get(key);
        if (object instanceof byte[]) {
          dataparams.putByteArray(key,(byte[])object);
        }
 else         if (object instanceof String) {
          dataparams.putByteArray(key,((String)object).getBytes());
        }
      }
      if (!params.containsKey("String_Node_Str")) {
        params.putString("String_Node_Str",method);
      }
      if (params.containsKey("String_Node_Str")) {
        String decoded_token=URLDecoder.decode(params.getString("String_Node_Str"));
        params.putString("String_Node_Str",decoded_token);
      }
      conn.setRequestMethod("String_Node_Str");
      conn.setRequestProperty("String_Node_Str","String_Node_Str" + strBoundary);
      conn.setDoOutput(true);
      conn.setDoInput(true);
      conn.setRequestProperty("String_Node_Str","String_Node_Str");
      conn.connect();
      os=new BufferedOutputStream(conn.getOutputStream());
      os.write(("String_Node_Str" + strBoundary + endLine).getBytes());
      os.write((encodePostBody(params,strBoundary)).getBytes());
      os.write((endLine + "String_Node_Str" + strBoundary+ endLine).getBytes());
      if (!dataparams.isEmpty()) {
        for (        String key : dataparams.keySet()) {
          os.write(("String_Node_Str" + key + "String_Node_Str"+ endLine).getBytes());
          os.write(("String_Node_Str" + endLine + endLine).getBytes());
          os.write(dataparams.getByteArray(key));
          os.write((endLine + "String_Node_Str" + strBoundary+ endLine).getBytes());
        }
      }
      os.flush();
    }
    String response="String_Node_Str";
    try {
      response=read(conn.getInputStream());
    }
 catch (    FileNotFoundException e) {
      response=read(conn.getErrorStream());
    }
    return response;
  }
  finally {
    if (os != null) {
      os.close();
    }
  }
}