Program: 110159
Project: 110159
Buggy source:
@Override protected void onHandleIntent(Intent intent){
  mNotifyManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  mBuilder=new Builder(this);
  String appName=getString(getApplicationInfo().labelRes);
  int icon=getApplicationInfo().icon;
  mBuilder.setContentTitle(appName).setSmallIcon(icon);
  String urlStr=intent.getStringExtra(Constants.APK_DOWNLOAD_URL);
  InputStream in=null;
  FileOutputStream out=null;
  try {
    URL url=new URL(urlStr);
    HttpURLConnection urlConnection=(HttpURLConnection)url.openConnection();
    urlConnection.setRequestMethod("String_Node_Str");
    urlConnection.setDoOutput(false);
    urlConnection.setConnectTimeout(10 * 1000);
    urlConnection.setReadTimeout(10 * 1000);
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    urlConnection.connect();
    long bytetotal=urlConnection.getContentLength();
    long bytesum=0;
    int byteread=0;
    in=urlConnection.getInputStream();
    File dir=StorageUtils.getCacheDirectory(this);
    String apkName=urlStr.substring(urlStr.lastIndexOf("String_Node_Str") + 1,urlStr.length());
    File apkFile=new File(dir,apkName);
    out=new FileOutputStream(apkFile);
    byte[] buffer=new byte[BUFFER_SIZE];
    int oldProgress=0;
    while ((byteread=in.read(buffer)) != -1) {
      bytesum+=byteread;
      out.write(buffer,0,byteread);
      int progress=(int)(bytesum * 100L / bytetotal);
      if (progress != oldProgress) {
        updateProgress(progress);
      }
      oldProgress=progress;
    }
    mBuilder.setContentText(getString(R.string.arad_download_success)).setProgress(0,0,false);
    Intent installAPKIntent=new Intent(Intent.ACTION_VIEW);
    String[] command={"String_Node_Str","String_Node_Str",apkFile.toString()};
    ProcessBuilder builder=new ProcessBuilder(command);
    builder.start();
    installAPKIntent.setDataAndType(Uri.fromFile(apkFile),"String_Node_Str");
    PendingIntent pendingIntent=PendingIntent.getActivity(this,0,installAPKIntent,PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(pendingIntent);
    Notification noti=mBuilder.build();
    noti.flags=Notification.FLAG_AUTO_CANCEL;
    mNotifyManager.notify(0,noti);
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str",e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent intent){
  mNotifyManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  mBuilder=new Builder(this);
  String appName=getString(getApplicationInfo().labelRes);
  int icon=getApplicationInfo().icon;
  mBuilder.setContentTitle(appName).setSmallIcon(icon);
  String urlStr=intent.getStringExtra(UpdateChecker.APP_UPDATE_URL);
  InputStream in=null;
  FileOutputStream out=null;
  try {
    URL url=new URL(urlStr);
    HttpURLConnection urlConnection=(HttpURLConnection)url.openConnection();
    urlConnection.setRequestMethod("String_Node_Str");
    urlConnection.setDoOutput(false);
    urlConnection.setConnectTimeout(10 * 1000);
    urlConnection.setReadTimeout(10 * 1000);
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    urlConnection.connect();
    long bytetotal=urlConnection.getContentLength();
    long bytesum=0;
    int byteread=0;
    in=urlConnection.getInputStream();
    File dir=StorageUtils.getCacheDirectory(this);
    String apkName=urlStr.substring(urlStr.lastIndexOf("String_Node_Str") + 1,urlStr.length());
    File apkFile=new File(dir,apkName);
    out=new FileOutputStream(apkFile);
    byte[] buffer=new byte[BUFFER_SIZE];
    int oldProgress=0;
    while ((byteread=in.read(buffer)) != -1) {
      bytesum+=byteread;
      out.write(buffer,0,byteread);
      int progress=(int)(bytesum * 100L / bytetotal);
      if (progress != oldProgress) {
        updateProgress(progress);
      }
      oldProgress=progress;
    }
    mBuilder.setContentText(getString(R.string.arad_download_success)).setProgress(0,0,false);
    Intent installAPKIntent=new Intent(Intent.ACTION_VIEW);
    String[] command={"String_Node_Str","String_Node_Str",apkFile.toString()};
    ProcessBuilder builder=new ProcessBuilder(command);
    builder.start();
    installAPKIntent.setDataAndType(Uri.fromFile(apkFile),"String_Node_Str");
    PendingIntent pendingIntent=PendingIntent.getActivity(this,0,installAPKIntent,PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(pendingIntent);
    Notification noti=mBuilder.build();
    noti.flags=Notification.FLAG_AUTO_CANCEL;
    mNotifyManager.notify(0,noti);
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str",e);
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}