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

Add exist method on BlobStoreRepository #312

Merged
merged 1 commit into from
Dec 3, 2024
Merged

Conversation

vpaturet
Copy link
Contributor

@vpaturet vpaturet commented Dec 3, 2024

Add a method to check if a blob exists in the repository.
A default implementation is provided that retrieves the object and test for nullity.
This requires clarifying the behavior of the method BlobStoreRepository.getBlob() when the requested blob does not exist.
The S3 implementation is adapted to return null when the object does not exist, instead of throwing an exception.

@vpaturet vpaturet force-pushed the add_exist_blob_method branch from e9e8cf4 to 61a2d08 Compare December 3, 2024 14:26
@vpaturet vpaturet force-pushed the add_exist_blob_method branch from 61a2d08 to 045a451 Compare December 3, 2024 14:43
Copy link

sonarqubecloud bot commented Dec 3, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Comment on lines +59 to +61
} catch (NoSuchKeyException e) {
return null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me 👍 This is a bit of a wart in AWS S3 client - using exceptions for flow control, that is - so handling it like this is fine.

Of course returning an Optional<InputStream> could express the semantics of the return value better, but the current implementation and the other changes in the PR are less intrusive and won't cause issues downstream, so I'm fine with this.

@vpaturet vpaturet merged commit eafe2f5 into master Dec 3, 2024
3 of 4 checks passed
@vpaturet vpaturet deleted the add_exist_blob_method branch December 3, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants