parent
c27237be9f
commit
0620a3d6c2
|
@ -30,6 +30,7 @@ import java.io.BufferedInputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.DirectoryNotEmptyException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
@ -85,7 +86,13 @@ public class FsBlobContainer extends AbstractBlobContainer {
|
|||
@Override
|
||||
public void deleteBlob(String blobName) throws IOException {
|
||||
Path blobPath = path.resolve(blobName);
|
||||
Files.deleteIfExists(blobPath);
|
||||
try {
|
||||
if (!Files.deleteIfExists(blobPath)) {
|
||||
throw new IOException("File " + blobPath.toString() + " does not exist");
|
||||
}
|
||||
} catch (DirectoryNotEmptyException | SecurityException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,8 +75,8 @@ final class HdfsBlobContainer extends AbstractBlobContainer {
|
|||
return fileContext.delete(new Path(path, blobName), true);
|
||||
}
|
||||
});
|
||||
} catch (FileNotFoundException ok) {
|
||||
// behaves like Files.deleteIfExists
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue