Program: 15745
Project: 15745
Buggy source:
private void testSimple(final String fsBase) throws Exception {
  long time=System.currentTimeMillis();
  for (  String s : FileUtils.newDirectoryStream(fsBase)) {
    FileUtils.delete(s);
  }
  FileUtils.createDirectories(fsBase + "String_Node_Str");
  FileUtils.delete(fsBase + "String_Node_Str");
  FileUtils.delete(fsBase + "String_Node_Str");
  assertTrue(FileUtils.createFile(fsBase + "String_Node_Str"));
  List<FilePath> p=FilePath.get(fsBase).newDirectoryStream();
  assertEquals(1,p.size());
  String can=FilePath.get(fsBase + "String_Node_Str").toRealPath().toString();
  assertEquals(can,p.get(0).toString());
  assertTrue(FileUtils.canWrite(fsBase + "String_Node_Str"));
  FileChannel channel=FileUtils.open(fsBase + "String_Node_Str","String_Node_Str");
  byte[] buffer=new byte[10000];
  Random random=new Random(1);
  random.nextBytes(buffer);
  channel.write(ByteBuffer.wrap(buffer));
  assertEquals(10000,channel.size());
  channel.position(20000);
  assertEquals(20000,channel.position());
  assertEquals(-1,channel.read(ByteBuffer.wrap(buffer,0,1)));
  String path=fsBase + "String_Node_Str";
  assertEquals("String_Node_Str",FileUtils.getName(path));
  can=FilePath.get(fsBase).toRealPath().toString();
  String can2=FileUtils.toRealPath(FileUtils.getParent(path));
  assertEquals(can,can2);
  FileLock lock=channel.tryLock();
  if (lock != null) {
    lock.release();
  }
  assertEquals(10000,channel.size());
  channel.close();
  assertEquals(10000,FileUtils.size(fsBase + "String_Node_Str"));
  channel=FileUtils.open(fsBase + "String_Node_Str","String_Node_Str");
  final byte[] test=new byte[10000];
  FileUtils.readFully(channel,ByteBuffer.wrap(test,0,10000));
  assertEquals(buffer,test);
  final FileChannel fc=channel;
  new AssertThrows(IOException.class){
    @Override public void test() throws Exception {
      fc.write(ByteBuffer.wrap(test,0,10));
    }
  }
;
  new AssertThrows(NonWritableChannelException.class){
    @Override public void test() throws Exception {
      fc.truncate(10);
    }
  }
;
  channel.close();
  long lastMod=FileUtils.lastModified(fsBase + "String_Node_Str");
  if (lastMod < time - 1999) {
    assertEquals(time,lastMod);
  }
  assertEquals(10000,FileUtils.size(fsBase + "String_Node_Str"));
  List<String> list=FileUtils.newDirectoryStream(fsBase);
  assertEquals(1,list.size());
  assertTrue(list.get(0).endsWith("String_Node_Str"));
  IOUtils.copyFiles(fsBase + "String_Node_Str",fsBase + "String_Node_Str");
  FileUtils.move(fsBase + "String_Node_Str",fsBase + "String_Node_Str");
  FileUtils.move(fsBase + "String_Node_Str",fsBase + "String_Node_Str");
  assertTrue(!FileUtils.exists(fsBase + "String_Node_Str"));
  assertTrue(FileUtils.exists(fsBase + "String_Node_Str"));
  assertEquals(10000,FileUtils.size(fsBase + "String_Node_Str"));
  byte[] buffer2=new byte[10000];
  InputStream in=FileUtils.newInputStream(fsBase + "String_Node_Str");
  int pos=0;
  while (true) {
    int l=in.read(buffer2,pos,Math.min(10000 - pos,1000));
    if (l <= 0) {
      break;
    }
    pos+=l;
  }
  in.close();
  assertEquals(10000,pos);
  assertEquals(buffer,buffer2);
  assertTrue(FileUtils.tryDelete(fsBase + "String_Node_Str"));
  FileUtils.delete(fsBase + "String_Node_Str");
  if (fsBase.indexOf("String_Node_Str") < 0 && fsBase.indexOf("String_Node_Str") < 0 && fsBase.indexOf("String_Node_Str") < 0 && fsBase.indexOf("String_Node_Str") < 0) {
    FileUtils.createDirectories(fsBase + "String_Node_Str");
    assertTrue(FileUtils.isDirectory(fsBase + "String_Node_Str"));
    if (!fsBase.startsWith("String_Node_Str")) {
      FileUtils.deleteRecursive(fsBase + "String_Node_Str",false);
      assertTrue(!FileUtils.exists(fsBase + "String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
private void testSimple(final String fsBase) throws Exception {
  long time=System.currentTimeMillis();
  for (  String s : FileUtils.newDirectoryStream(fsBase)) {
    FileUtils.delete(s);
  }
  FileUtils.createDirectories(fsBase + "String_Node_Str");
  assertTrue(FileUtils.exists(fsBase));
  FileUtils.delete(fsBase + "String_Node_Str");
  FileUtils.delete(fsBase + "String_Node_Str");
  assertTrue(FileUtils.createFile(fsBase + "String_Node_Str"));
  List<FilePath> p=FilePath.get(fsBase).newDirectoryStream();
  assertEquals(1,p.size());
  String can=FilePath.get(fsBase + "String_Node_Str").toRealPath().toString();
  assertEquals(can,p.get(0).toString());
  assertTrue(FileUtils.canWrite(fsBase + "String_Node_Str"));
  FileChannel channel=FileUtils.open(fsBase + "String_Node_Str","String_Node_Str");
  byte[] buffer=new byte[10000];
  Random random=new Random(1);
  random.nextBytes(buffer);
  channel.write(ByteBuffer.wrap(buffer));
  assertEquals(10000,channel.size());
  channel.position(20000);
  assertEquals(20000,channel.position());
  assertEquals(-1,channel.read(ByteBuffer.wrap(buffer,0,1)));
  String path=fsBase + "String_Node_Str";
  assertEquals("String_Node_Str",FileUtils.getName(path));
  can=FilePath.get(fsBase).toRealPath().toString();
  String can2=FileUtils.toRealPath(FileUtils.getParent(path));
  assertEquals(can,can2);
  FileLock lock=channel.tryLock();
  if (lock != null) {
    lock.release();
  }
  assertEquals(10000,channel.size());
  channel.close();
  assertEquals(10000,FileUtils.size(fsBase + "String_Node_Str"));
  channel=FileUtils.open(fsBase + "String_Node_Str","String_Node_Str");
  final byte[] test=new byte[10000];
  FileUtils.readFully(channel,ByteBuffer.wrap(test,0,10000));
  assertEquals(buffer,test);
  final FileChannel fc=channel;
  new AssertThrows(IOException.class){
    @Override public void test() throws Exception {
      fc.write(ByteBuffer.wrap(test,0,10));
    }
  }
;
  new AssertThrows(NonWritableChannelException.class){
    @Override public void test() throws Exception {
      fc.truncate(10);
    }
  }
;
  channel.close();
  long lastMod=FileUtils.lastModified(fsBase + "String_Node_Str");
  if (lastMod < time - 1999) {
    assertEquals(time,lastMod);
  }
  assertEquals(10000,FileUtils.size(fsBase + "String_Node_Str"));
  List<String> list=FileUtils.newDirectoryStream(fsBase);
  assertEquals(1,list.size());
  assertTrue(list.get(0).endsWith("String_Node_Str"));
  IOUtils.copyFiles(fsBase + "String_Node_Str",fsBase + "String_Node_Str");
  FileUtils.move(fsBase + "String_Node_Str",fsBase + "String_Node_Str");
  FileUtils.move(fsBase + "String_Node_Str",fsBase + "String_Node_Str");
  assertTrue(!FileUtils.exists(fsBase + "String_Node_Str"));
  assertTrue(FileUtils.exists(fsBase + "String_Node_Str"));
  assertEquals(10000,FileUtils.size(fsBase + "String_Node_Str"));
  byte[] buffer2=new byte[10000];
  InputStream in=FileUtils.newInputStream(fsBase + "String_Node_Str");
  int pos=0;
  while (true) {
    int l=in.read(buffer2,pos,Math.min(10000 - pos,1000));
    if (l <= 0) {
      break;
    }
    pos+=l;
  }
  in.close();
  assertEquals(10000,pos);
  assertEquals(buffer,buffer2);
  assertTrue(FileUtils.tryDelete(fsBase + "String_Node_Str"));
  FileUtils.delete(fsBase + "String_Node_Str");
  if (fsBase.indexOf("String_Node_Str") < 0 && fsBase.indexOf("String_Node_Str") < 0 && fsBase.indexOf("String_Node_Str") < 0 && fsBase.indexOf("String_Node_Str") < 0) {
    FileUtils.createDirectories(fsBase + "String_Node_Str");
    assertTrue(FileUtils.isDirectory(fsBase + "String_Node_Str"));
    if (!fsBase.startsWith("String_Node_Str")) {
      FileUtils.deleteRecursive(fsBase + "String_Node_Str",false);
      assertTrue(!FileUtils.exists(fsBase + "String_Node_Str"));
    }
  }
}