Program: 93781
Project: 93781
Buggy source:
private boolean downloadCertificateRemotelyViaHttps(String packageName){
  NetworkInfo activeNetworkInfo=mConnectivityManager.getActiveNetworkInfo();
  if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
    String urlString=packageNameToCertificateMap.get(packageName);
    HttpsURLConnection urlConnection=null;
    InputStream inputStream=null;
    OutputStream outputStream=null;
    try {
      URL certificateURL=new URL(urlString);
      urlConnection=(HttpsURLConnection)certificateURL.openConnection();
      urlConnection.connect();
      Log.i(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str");
      inputStream=urlConnection.getInputStream();
      String downloadPath=certificateFolder.getAbsolutePath() + "String_Node_Str" + packageName+ "String_Node_Str";
      outputStream=new FileOutputStream(downloadPath);
      int read=0;
      byte[] bytes=new byte[1024];
      while ((read=inputStream.read(bytes)) != -1) {
        outputStream.write(bytes,0,read);
      }
      Log.i(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str" + downloadPath);
    }
 catch (    MalformedURLException e) {
      return false;
    }
catch (    IOException e) {
      return false;
    }
 finally {
      if (inputStream != null) {
        try {
          inputStream.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
      if (outputStream != null) {
        try {
          outputStream.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
      if (urlConnection != null)       urlConnection.disconnect();
      Log.i(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str");
    }
    return true;
  }
  Log.w(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
private boolean downloadCertificateRemotelyViaHttps(String packageName){
  NetworkInfo activeNetworkInfo=mConnectivityManager.getActiveNetworkInfo();
  if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
    String urlString=packageNameToCertificateMap.get(packageName);
    HttpsURLConnection urlConnection=null;
    InputStream inputStream=null;
    OutputStream outputStream=null;
    try {
      URL certificateURL=new URL(urlString);
      urlConnection=(HttpsURLConnection)certificateURL.openConnection();
      if (urlConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
        Log.i(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str");
        inputStream=urlConnection.getInputStream();
        String downloadPath=certificateFolder.getAbsolutePath() + "String_Node_Str" + packageName+ "String_Node_Str";
        outputStream=new FileOutputStream(downloadPath);
        int read=0;
        byte[] bytes=new byte[1024];
        while ((read=inputStream.read(bytes)) > 0) {
          outputStream.write(bytes,0,read);
        }
        Log.i(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str" + downloadPath);
      }
    }
 catch (    MalformedURLException e) {
      return false;
    }
catch (    IOException e) {
      return false;
    }
 finally {
      Log.i(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str");
      if (urlConnection != null)       urlConnection.disconnect();
      if (inputStream != null) {
        try {
          inputStream.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
      if (outputStream != null) {
        try {
          outputStream.close();
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
 else       return false;
    }
    return true;
  }
  Log.w(TAG_SECURE_DEX_CLASS_LOADER,"String_Node_Str");
  return false;
}