Program: 188401
Project: 188401
Buggy source:
/** 
 * Copies a directory/file from one path to another
 * @param sourcePath source path
 * @param targetPath target path
 * @param replaceExisting true if the target directory/file should be replaced if it already exists; false otherwise
 * @throws AlreadyExistsException
 * @throws GenericException
 */
public static void copy(final Path sourcePath,final Path targetPath,boolean replaceExisting) throws AlreadyExistsException, GenericException {
  if (!replaceExisting && FSUtils.exists(targetPath)) {
    throw new AlreadyExistsException("String_Node_Str" + targetPath);
  }
  try {
    Files.createDirectories(targetPath.getParent());
  }
 catch (  IOException e) {
    throw new GenericException("String_Node_Str",e);
  }
  if (FSUtils.isDirectory(sourcePath)) {
    try {
      Files.walkFileTree(sourcePath,new SimpleFileVisitor<Path>(){
        @Override public FileVisitResult preVisitDirectory(        final Path dir,        final BasicFileAttributes attrs) throws IOException {
          Files.createDirectories(targetPath.resolve(sourcePath.relativize(dir)));
          return FileVisitResult.CONTINUE;
        }
        @Override public FileVisitResult visitFile(        final Path file,        final BasicFileAttributes attrs) throws IOException {
          Files.copy(file,targetPath.resolve(sourcePath.relativize(file)));
          return FileVisitResult.CONTINUE;
        }
      }
);
    }
 catch (    IOException e) {
      throw new GenericException("String_Node_Str",e);
    }
  }
 else {
    try {
      CopyOption[] copyOptions=replaceExisting ? new CopyOption[]{StandardCopyOption.REPLACE_EXISTING} : new CopyOption[]{};
      Files.copy(sourcePath,targetPath,copyOptions);
    }
 catch (    IOException e) {
      throw new GenericException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Copies a directory/file from one path to another
 * @param sourcePath source path
 * @param targetPath target path
 * @param replaceExisting true if the target directory/file should be replaced if it already exists; false otherwise
 * @throws AlreadyExistsException
 * @throws GenericException
 */
public static void copy(final Path sourcePath,final Path targetPath,boolean replaceExisting) throws AlreadyExistsException, GenericException {
  if (!replaceExisting && FSUtils.exists(targetPath)) {
    throw new AlreadyExistsException("String_Node_Str" + targetPath);
  }
  try {
    if (targetPath != null) {
      Files.createDirectories(targetPath.getParent());
    }
  }
 catch (  IOException e) {
    throw new GenericException("String_Node_Str",e);
  }
  if (FSUtils.isDirectory(sourcePath)) {
    try {
      Files.walkFileTree(sourcePath,new SimpleFileVisitor<Path>(){
        @Override public FileVisitResult preVisitDirectory(        final Path dir,        final BasicFileAttributes attrs) throws IOException {
          Files.createDirectories(targetPath.resolve(sourcePath.relativize(dir)));
          return FileVisitResult.CONTINUE;
        }
        @Override public FileVisitResult visitFile(        final Path file,        final BasicFileAttributes attrs) throws IOException {
          Files.copy(file,targetPath.resolve(sourcePath.relativize(file)));
          return FileVisitResult.CONTINUE;
        }
      }
);
    }
 catch (    IOException e) {
      throw new GenericException("String_Node_Str",e);
    }
  }
 else {
    try {
      CopyOption[] copyOptions=replaceExisting ? new CopyOption[]{StandardCopyOption.REPLACE_EXISTING} : new CopyOption[]{};
      Files.copy(sourcePath,targetPath,copyOptions);
    }
 catch (    IOException e) {
      throw new GenericException("String_Node_Str",e);
    }
  }
}