Skip to content

Commit

Permalink
Eagerly check baseDir in FilesystemNio2BlobStore
Browse files Browse the repository at this point in the history
  • Loading branch information
gaul committed Dec 15, 2024
1 parent fc92ef0 commit fef17b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ protected AbstractNio2BlobStore(BlobStoreContext context, BlobUtils blobUtils,
this.root = root;
}

protected Path getRoot() {
return root;
}

@Override
public final Set<? extends Location> listAssignableLocations() {
return locations.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package org.gaul.s3proxy.nio2blob;

import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.util.Set;

import com.google.common.base.Supplier;
Expand Down Expand Up @@ -45,5 +47,8 @@ public final class FilesystemNio2BlobStore extends AbstractNio2BlobStore {
super(context, blobUtils, defaultLocation, locations, slicer, creds,
// cannot be closed
FileSystems.getDefault().getPath(baseDir));
if (!Files.exists(getRoot())) {
throw new RuntimeException(new NoSuchFileException(getRoot().toString()));
}
}
}

0 comments on commit fef17b0

Please sign in to comment.