Skip to content

Commit

Permalink
Use simpler write-once semantics for FS repository (#30435)
Browse files Browse the repository at this point in the history
The writeBlob method for FsBlobContainer already opens the file with StandardOpenOption.CREATE_NEW, so there's no need for an extra blobExists(blobName) check.
  • Loading branch information
ywelsch committed May 11, 2018
1 parent 1219798 commit af44e2a
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ public InputStream readBlob(String name) throws IOException {

@Override
public void writeBlob(String blobName, InputStream inputStream, long blobSize) throws IOException {
if (blobExists(blobName)) {
throw new FileAlreadyExistsException("blob [" + blobName + "] already exists, cannot overwrite");
}
final Path file = path.resolve(blobName);
try (OutputStream outputStream = Files.newOutputStream(file, StandardOpenOption.CREATE_NEW)) {
Streams.copy(inputStream, outputStream);
Expand Down

0 comments on commit af44e2a

Please sign in to comment.