Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BT-724 Fix BlobPathBuilder failing on retrieving existing filesystem #6816

Merged
merged 6 commits into from
Aug 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Take 2 on for comprehension
kraefrei committed Aug 1, 2022
commit 7a594ae1d2417dee2f15744b4599c509df5e5827
Original file line number Diff line number Diff line change
@@ -67,16 +67,13 @@ class BlobPathBuilder(credential: AzureSasCredential, container: String, endpoin

def build(string: String): Try[BlobPath] = {
validateBlobPath(string, container, endpoint) match {
case ValidBlobPath(path) =>
for {
fileSystem <- Try {
FileSystems.getFileSystem(new URI("azb://?endpoint=" + endpoint))
} recover {
case ValidBlobPath(path) => for {
fileSystem <- Try(FileSystems.getFileSystem(new URI("azb://?endpoint=" + endpoint))) recover {
// If no filesystem already exists, this will create a new connection, with the provided configs
case _: FileSystemNotFoundException => FileSystems.newFileSystem(new URI("azb://?endpoint=" + endpoint), fileSystemConfig.asJava)
}
nioPath <- Try {fileSystem.getPath(path)}
blobPath <- Try {BlobPath(nioPath, endpoint, container)}
nioPath <- Try(fileSystem.getPath(path))
blobPath = BlobPath(nioPath, endpoint, container)
} yield blobPath
case UnparsableBlobPath(errorMessage: Throwable) => Failure(errorMessage)
}