Program: 153366
Project: 153366
Buggy source:
public SimpleHttpResponse post(String url,Map<String,String> headerValues,Map<String,Object> postParameters,HttpRequest request){
  HttpURLConnection connection=null;
  connectionPool.put(request,connection);
  try {
    URL u=new URL(url);
    if (u.getProtocol().toLowerCase().equals("String_Node_Str")) {
      trustAllHosts();
      HttpsURLConnection https=(HttpsURLConnection)u.openConnection();
      https.setHostnameVerifier(DO_NOT_VERIFY);
      connection=https;
    }
 else {
      connection=(HttpURLConnection)u.openConnection();
    }
    connection.setRequestMethod("String_Node_Str");
    connection.setDoOutput(true);
    connection.setDoInput(true);
    connection.setUseCaches(getUseCaches());
    connection.setConnectTimeout(getConnectionTimeout());
    connection.setReadTimeout(getReadTimeout());
    connectionPool.put(request,connection);
  }
 catch (  Exception e) {
    Log.e("String_Node_Str",e.toString());
    if (connection != null)     disconnectConnection(request);
    return null;
  }
  if (headerValues != null)   for (  String key : headerValues.keySet())   connection.setRequestProperty(key,headerValues.get(key));
  if (postParameters != null) {
    boolean fileExists=false;
    for (    String key : postParameters.keySet()) {
      if (postParameters.get(key).getClass() == (Object)File.class) {
        fileExists=true;
        break;
      }
    }
    try {
      DataOutputStream dos=null;
      if (fileExists) {
        String boundary="String_Node_Str";
        String startBoundary="String_Node_Str" + boundary + "String_Node_Str";
        String endBoundary="String_Node_Str";
        String finalEndBoundary="String_Node_Str" + boundary + "String_Node_Str";
        connection.setRequestProperty("String_Node_Str","String_Node_Str" + boundary);
        dos=new DataOutputStream(connection.getOutputStream());
        for (        String key : postParameters.keySet()) {
          dos.writeBytes(startBoundary);
          Object value=postParameters.get(key);
          if (value.getClass() == File.class) {
            File file=(File)value;
            File compressedFile=ImageUtil.decodeFileToFile(file,80,false);
            if (compressedFile != null) {
              file=compressedFile;
            }
            dos.writeBytes("String_Node_Str" + key + "String_Node_Str"+ file.getName()+ "String_Node_Str");
            dos.writeBytes("String_Node_Str" + getMimeType((File)value) + "String_Node_Str");
            dos.writeBytes("String_Node_Str");
            FileInputStream fis=new FileInputStream(file);
            int totalSize=fis.available();
            byte[] buffer=new byte[FILE_BUFFER_SIZE];
            int bytesRead=0;
            while ((bytesRead=fis.read(buffer,0,FILE_BUFFER_SIZE)) > 0) {
              dos.write(buffer,0,bytesRead);
              if (progressListener != null) {
                progressListener.onWritten(progressTag,totalSize,bytesRead);
              }
            }
            fis.close();
          }
 else {
            dos.writeBytes("String_Node_Str" + key + "String_Node_Str");
            dos.writeBytes(value.toString());
          }
          dos.writeBytes(endBoundary);
        }
        dos.writeBytes(finalEndBoundary);
      }
 else {
        connection.setRequestProperty("String_Node_Str","String_Node_Str");
        dos=new DataOutputStream(connection.getOutputStream());
        StringBuffer buffer=new StringBuffer();
        for (        String key : postParameters.keySet()) {
          if (buffer.length() > 0)           buffer.append("String_Node_Str");
          buffer.append(urlencode(key));
          buffer.append("String_Node_Str");
          buffer.append(urlencode(postParameters.get(key).toString()));
        }
        dos.writeBytes(buffer.toString());
      }
      dos.flush();
      dos.close();
    }
 catch (    Exception e) {
      Log.d("String_Node_Str","String_Node_Str" + e.toString());
      Log.e("String_Node_Str",e.toString());
      disconnectConnection(request);
      return null;
    }
  }
 else {
    DataOutputStream dos=null;
    try {
      dos=new DataOutputStream(connection.getOutputStream());
      dos.flush();
      dos.close();
    }
 catch (    Exception e) {
      Log.e("String_Node_Str",e.toString());
      disconnectConnection(request);
      return null;
    }
  }
  try {
    InputStream is=connection.getInputStream();
    byte[] responseBody=readBytesFromInputStream(is);
    is.close();
    SimpleHttpResponse result=new SimpleHttpResponse(connection.getResponseCode(),responseBody,connection.getHeaderFields());
    disconnectConnection(request);
    return result;
  }
 catch (  Exception e) {
    Log.e("String_Node_Str",e.toString());
    try {
      int responseCode=connection.getResponseCode();
      if (responseCode != -1) {
        SimpleHttpResponse result=new SimpleHttpResponse(responseCode,connection.getResponseMessage());
        disconnectConnection(request);
        return result;
      }
    }
 catch (    IOException ioe) {
      Log.e("String_Node_Str",ioe.toString());
    }
  }
 finally {
    disconnectConnection(request);
  }
  return null;
}

Fixed version (ground truth):
public SimpleHttpResponse post(String url,Map<String,String> headerValues,Map<String,Object> postParameters,HttpRequest request){
  HttpURLConnection connection=null;
  connectionPool.put(request,connection);
  try {
    URL u=new URL(url);
    if (u.getProtocol().toLowerCase().equals("String_Node_Str")) {
      trustAllHosts();
      HttpsURLConnection https=(HttpsURLConnection)u.openConnection();
      https.setHostnameVerifier(DO_NOT_VERIFY);
      connection=https;
    }
 else {
      connection=(HttpURLConnection)u.openConnection();
    }
    connection.setRequestMethod("String_Node_Str");
    connection.setDoOutput(true);
    connection.setDoInput(true);
    connection.setUseCaches(getUseCaches());
    connection.setConnectTimeout(getConnectionTimeout());
    connection.setReadTimeout(getReadTimeout());
    connectionPool.put(request,connection);
  }
 catch (  Exception e) {
    Log.e("String_Node_Str",e.toString());
    if (connection != null)     disconnectConnection(request);
    return null;
  }
  if (headerValues != null)   for (  String key : headerValues.keySet())   connection.setRequestProperty(key,headerValues.get(key));
  if (postParameters != null) {
    boolean fileExists=false;
    for (    String key : postParameters.keySet()) {
      if (postParameters.get(key).getClass() == (Object)File.class) {
        fileExists=true;
        break;
      }
    }
    try {
      DataOutputStream dos=null;
      if (fileExists) {
        String boundary="String_Node_Str";
        String startBoundary="String_Node_Str" + boundary + "String_Node_Str";
        String endBoundary="String_Node_Str";
        String finalEndBoundary="String_Node_Str" + boundary + "String_Node_Str";
        connection.setRequestProperty("String_Node_Str","String_Node_Str" + boundary);
        dos=new DataOutputStream(connection.getOutputStream());
        for (        String key : postParameters.keySet()) {
          dos.writeBytes(startBoundary);
          Object value=postParameters.get(key);
          if (value.getClass() == File.class) {
            File file=(File)value;
            File compressedFile=ImageUtil.compressFile(file,80);
            if (compressedFile != null) {
              file=compressedFile;
            }
            dos.writeBytes("String_Node_Str" + key + "String_Node_Str"+ file.getName()+ "String_Node_Str");
            dos.writeBytes("String_Node_Str" + getMimeType((File)value) + "String_Node_Str");
            dos.writeBytes("String_Node_Str");
            FileInputStream fis=new FileInputStream(file);
            int totalSize=fis.available();
            byte[] buffer=new byte[FILE_BUFFER_SIZE];
            int bytesRead=0;
            while ((bytesRead=fis.read(buffer,0,FILE_BUFFER_SIZE)) > 0) {
              dos.write(buffer,0,bytesRead);
              if (progressListener != null) {
                progressListener.onWritten(progressTag,totalSize,bytesRead);
              }
            }
            fis.close();
          }
 else {
            dos.writeBytes("String_Node_Str" + key + "String_Node_Str");
            dos.writeBytes(value.toString());
          }
          dos.writeBytes(endBoundary);
        }
        dos.writeBytes(finalEndBoundary);
      }
 else {
        connection.setRequestProperty("String_Node_Str","String_Node_Str");
        dos=new DataOutputStream(connection.getOutputStream());
        StringBuffer buffer=new StringBuffer();
        for (        String key : postParameters.keySet()) {
          if (buffer.length() > 0)           buffer.append("String_Node_Str");
          buffer.append(urlencode(key));
          buffer.append("String_Node_Str");
          buffer.append(urlencode(postParameters.get(key).toString()));
        }
        dos.writeBytes(buffer.toString());
      }
      dos.flush();
      dos.close();
    }
 catch (    Exception e) {
      Log.d("String_Node_Str","String_Node_Str" + e.toString());
      Log.e("String_Node_Str",e.toString());
      disconnectConnection(request);
      return null;
    }
  }
 else {
    DataOutputStream dos=null;
    try {
      dos=new DataOutputStream(connection.getOutputStream());
      dos.flush();
      dos.close();
    }
 catch (    Exception e) {
      Log.e("String_Node_Str",e.toString());
      disconnectConnection(request);
      return null;
    }
  }
  try {
    InputStream is=connection.getInputStream();
    byte[] responseBody=readBytesFromInputStream(is);
    is.close();
    SimpleHttpResponse result=new SimpleHttpResponse(connection.getResponseCode(),responseBody,connection.getHeaderFields());
    disconnectConnection(request);
    return result;
  }
 catch (  Exception e) {
    Log.e("String_Node_Str",e.toString());
    try {
      int responseCode=connection.getResponseCode();
      if (responseCode != -1) {
        SimpleHttpResponse result=new SimpleHttpResponse(responseCode,connection.getResponseMessage());
        disconnectConnection(request);
        return result;
      }
    }
 catch (    IOException ioe) {
      Log.e("String_Node_Str",ioe.toString());
    }
  }
 finally {
    disconnectConnection(request);
  }
  return null;
}