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