Prefer Files.delete(Path) over File.delete

The former throws an exception including the cause if the operation
fails while the latter merely returns a boolean.
This commit is contained in:
Andrew Gaul 2014-07-21 13:24:32 -07:00
parent fc4b072a26
commit 000a505360

View File

@ -18,6 +18,7 @@ package org.jclouds.filesystem.util;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
/**
* Utilities for the filesystem blobstore.
@ -38,8 +39,6 @@ public class Utils {
}
}
}
if (!file.delete()) {
throw new IOException("Could not delete: " + file);
}
Files.delete(file.toPath());
}
}