Program: 162548
Project: 162548
Buggy source:
/** 
 * Helper method for   {@link #saveFile(Uri,File,String)}Works on a background thread to save data to output stream associated with this reader
 * @see #saveFile(Uri,File,String)
 * @param uri
 * @param file
 * @param inputText
 * @throws StreamNotFoundException
 * @throws IOException
 * @throws RootNotPermittedException
 */
private void writeTextFile(final Uri uri,final File file,String inputText) throws StreamNotFoundException, IOException, RootNotPermittedException {
  mOriginal=inputText;
  OutputStream outputStream=null;
  if (uri.toString().contains("String_Node_Str")) {
    if (file.canWrite()) {
      try {
        outputStream=new FileOutputStream(file);
      }
 catch (      FileNotFoundException e) {
        outputStream=null;
      }
    }
    if (BaseActivity.rootMode && outputStream == null) {
      try {
        if (cacheFile != null && cacheFile.exists())         outputStream=new FileOutputStream(cacheFile);
      }
 catch (      FileNotFoundException e) {
        e.printStackTrace();
        outputStream=null;
      }
    }
  }
 else   if (uri.toString().contains("String_Node_Str")) {
    if (parcelFileDescriptor != null) {
      File descriptorFile=new File(GenericCopyUtil.PATH_FILE_DESCRIPTOR + parcelFileDescriptor.getFd());
      try {
        outputStream=new FileOutputStream(descriptorFile);
      }
 catch (      FileNotFoundException e) {
        e.printStackTrace();
        outputStream=null;
      }
    }
    if (outputStream == null) {
      try {
        outputStream=getContentResolver().openOutputStream(uri);
      }
 catch (      FileNotFoundException e) {
        e.printStackTrace();
        outputStream=null;
      }
    }
  }
  if (outputStream == null)   throw new StreamNotFoundException();
  outputStream.write(inputText.getBytes());
  outputStream.close();
  if (cacheFile != null && cacheFile.exists()) {
    RootUtils.cat(cacheFile.getPath(),mFile.getPath());
    cacheFile.delete();
  }
  runOnUiThread(new Runnable(){
    @Override public void run(){
      Toast.makeText(c,getString(R.string.done),Toast.LENGTH_SHORT).show();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Helper method for   {@link #saveFile(Uri,File,String)}Works on a background thread to save data to output stream associated with this reader
 * @see #saveFile(Uri,File,String)
 * @param uri
 * @param file
 * @param inputText
 * @throws StreamNotFoundException
 * @throws IOException
 * @throws RootNotPermittedException
 */
private void writeTextFile(final Uri uri,final File file,String inputText) throws StreamNotFoundException, IOException, RootNotPermittedException {
  OutputStream outputStream=null;
  if (uri.toString().contains("String_Node_Str")) {
    try {
      outputStream=FileUtil.getOutputStream(file,this);
    }
 catch (    Exception e) {
      outputStream=null;
    }
    if (BaseActivity.rootMode && outputStream == null) {
      try {
        if (cacheFile != null && cacheFile.exists())         outputStream=new FileOutputStream(cacheFile);
      }
 catch (      FileNotFoundException e) {
        e.printStackTrace();
        outputStream=null;
      }
    }
  }
 else   if (uri.toString().contains("String_Node_Str")) {
    if (parcelFileDescriptor != null) {
      File descriptorFile=new File(GenericCopyUtil.PATH_FILE_DESCRIPTOR + parcelFileDescriptor.getFd());
      try {
        outputStream=new FileOutputStream(descriptorFile);
      }
 catch (      FileNotFoundException e) {
        e.printStackTrace();
        outputStream=null;
      }
    }
    if (outputStream == null) {
      try {
        outputStream=getContentResolver().openOutputStream(uri);
      }
 catch (      FileNotFoundException e) {
        e.printStackTrace();
        outputStream=null;
      }
    }
  }
  if (outputStream == null)   throw new StreamNotFoundException();
  outputStream.write(inputText.getBytes());
  outputStream.close();
  mOriginal=inputText;
  mModified=false;
  invalidateOptionsMenu();
  if (cacheFile != null && cacheFile.exists()) {
    RootUtils.cat(cacheFile.getPath(),mFile.getPath());
    cacheFile.delete();
  }
  runOnUiThread(new Runnable(){
    @Override public void run(){
      Toast.makeText(c,getString(R.string.done),Toast.LENGTH_SHORT).show();
    }
  }
);
}