Program: 5849
Project: 5849
Buggy source:
public static void getFileFromServer(String path,Bundle params,String filePath){
  byte[] bf=new byte[FILE_BUFFER_SIZE];
  int current=0;
  InputStream is=null;
  HttpURLConnection connect=null;
  BufferedInputStream bis=null;
  OutputStream fos=null;
  try {
    fos=new FileOutputStream(filePath);
    String completePath=null;
    if (params != null) {
      StringBuilder sb=new StringBuilder();
      sb.append(path).append('?');
      boolean first=true;
      for (      String key : params.keySet()) {
        if (!first) {
          sb.append('&');
        }
 else {
          first=false;
        }
        sb.append(URLEncoder.encode(key)).append('=').append(URLEncoder.encode(params.getString(key)));
      }
      completePath=sb.toString();
    }
    URL url=new URL(completePath);
    connect=(HttpURLConnection)url.openConnection();
    connect.setDoInput(true);
    connect.setConnectTimeout(CONNECTION_TIME_OUT);
    connect.setReadTimeout(SOCKET_TIME_OUT);
    int code=connect.getResponseCode();
    if (code == HttpURLConnection.HTTP_OK) {
      is=connect.getInputStream();
      bis=new BufferedInputStream(is);
      while ((current=bis.read(bf)) != FILE_END) {
        fos.write(bf,0,current);
      }
    }
  }
 catch (  MalformedURLException e) {
    LogUtils.logD(e.getMessage());
  }
catch (  IOException e) {
    LogUtils.logD(e.getMessage());
  }
catch (  Exception e) {
    LogUtils.logD(e.getMessage());
  }
 finally {
    try {
      if (bis != null) {
        bis.close();
      }
      if (is != null) {
        is.close();
      }
      if (fos != null) {
        fos.close();
      }
      if (connect != null) {
        connect.disconnect();
      }
    }
 catch (    IOException e) {
      LogUtils.logD(e.getMessage());
    }
  }
}

Fixed version (ground truth):
public static void getFileFromServer(String path,Bundle params,String filePath){
  byte[] bf=new byte[FILE_BUFFER_SIZE];
  int current=0;
  InputStream is=null;
  HttpURLConnection connect=null;
  BufferedInputStream bis=null;
  OutputStream fos=null;
  try {
    fos=new FileOutputStream(filePath);
    String completePath=path;
    if (params != null && !params.isEmpty()) {
      StringBuilder sb=new StringBuilder();
      sb.append(path).append('?');
      boolean first=true;
      for (      String key : params.keySet()) {
        if (!first) {
          sb.append('&');
        }
 else {
          first=false;
        }
        sb.append(URLEncoder.encode(key)).append('=').append(URLEncoder.encode(params.getString(key)));
      }
      completePath=sb.toString();
    }
    URL url=new URL(completePath);
    connect=(HttpURLConnection)url.openConnection();
    connect.setDoInput(true);
    connect.setConnectTimeout(CONNECTION_TIME_OUT);
    connect.setReadTimeout(SOCKET_TIME_OUT);
    int code=connect.getResponseCode();
    if (code == HttpURLConnection.HTTP_OK) {
      is=connect.getInputStream();
      bis=new BufferedInputStream(is);
      while ((current=bis.read(bf)) != FILE_END) {
        fos.write(bf,0,current);
      }
    }
  }
 catch (  MalformedURLException e) {
    LogUtils.logE(e.getMessage());
  }
catch (  IOException e) {
    LogUtils.logE(e.getMessage());
  }
catch (  Exception e) {
    LogUtils.logE(e.getMessage());
  }
 finally {
    try {
      if (bis != null) {
        bis.close();
      }
      if (is != null) {
        is.close();
      }
      if (fos != null) {
        fos.close();
      }
      if (connect != null) {
        connect.disconnect();
      }
    }
 catch (    IOException e) {
      LogUtils.logE(e.getMessage());
    }
  }
}