Program: 32552
Project: 32552
Buggy source:
private static String openURL(String resource,Map<String,String> params,String requestMethod) throws APIException, IOException {
  String encodedParams=urlEncodeParams(params);
  URL url=null;
  APIException apiException=null;
  IOException ioException=null;
  String responseStr=null;
  if (requestMethod.equals("String_Node_Str")) {
    url=new URL(BASE_URL + resource + '?'+ encodedParams);
  }
 else   if (requestMethod.equals("String_Node_Str")) {
    url=new URL(BASE_URL + resource);
  }
  HttpURLConnection conn=null;
  try {
    conn=(HttpURLConnection)url.openConnection();
    conn.setRequestMethod(requestMethod);
    conn.setConnectTimeout(TIMEOUT_MS);
    if (requestMethod.equals("String_Node_Str")) {
      byte[] postBytes=encodedParams.getBytes("String_Node_Str");
      conn.setDoOutput(true);
      conn.setRequestProperty("String_Node_Str","String_Node_Str");
      conn.setRequestProperty("String_Node_Str",String.valueOf(postBytes.length));
      conn.getOutputStream().write(postBytes);
      conn.getOutputStream().close();
    }
    if (conn.getResponseCode() != 200) {
      apiException=new APIException(inputStreamToString(conn.getErrorStream()));
    }
 else {
      responseStr=inputStreamToString(conn.getInputStream());
    }
  }
 catch (  IOException e) {
    ioException=e;
  }
 finally {
    try {
      if (apiException != null) {
        conn.getErrorStream().close();
      }
      conn.getInputStream().close();
    }
 catch (    Exception ex) {
    }
    if (ioException != null) {
      throw ioException;
    }
    if (apiException != null) {
      throw apiException;
    }
  }
  return responseStr;
}

Fixed version (ground truth):
private static String openURL(String resource,Map<String,String> params,String requestMethod) throws APIException, IOException {
  String encodedParams=urlEncodeParams(params);
  URL url=null;
  APIException apiException=null;
  IOException ioException=null;
  String responseStr=null;
  if (requestMethod.equals("String_Node_Str")) {
    if (encodedParams.isEmpty()) {
      url=new URL(BASE_URL + resource);
    }
 else {
      url=new URL(BASE_URL + resource + '?'+ encodedParams);
    }
  }
 else   if (requestMethod.equals("String_Node_Str")) {
    url=new URL(BASE_URL + resource);
  }
  HttpURLConnection conn=null;
  try {
    conn=(HttpURLConnection)url.openConnection();
    conn.setRequestMethod(requestMethod);
    conn.setConnectTimeout(TIMEOUT_MS);
    if (requestMethod.equals("String_Node_Str")) {
      byte[] postBytes=encodedParams.getBytes("String_Node_Str");
      conn.setDoOutput(true);
      conn.setRequestProperty("String_Node_Str","String_Node_Str");
      conn.setRequestProperty("String_Node_Str",String.valueOf(postBytes.length));
      conn.getOutputStream().write(postBytes);
      conn.getOutputStream().close();
    }
    if (conn.getResponseCode() != 200) {
      apiException=new APIException(inputStreamToString(conn.getErrorStream()));
    }
 else {
      responseStr=inputStreamToString(conn.getInputStream());
    }
  }
 catch (  IOException e) {
    ioException=e;
  }
 finally {
    try {
      if (apiException != null) {
        conn.getErrorStream().close();
      }
      conn.getInputStream().close();
    }
 catch (    Exception ex) {
    }
    if (ioException != null) {
      throw ioException;
    }
    if (apiException != null) {
      throw apiException;
    }
  }
  return responseStr;
}