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

chore: extract method to check Path is S3Path #225

Merged

Conversation

guicamest
Copy link
Contributor

Description of changes:

Considering that in many places a check is done to verify the path (from the nio public API signature) is an S3Path, the changes introduce a method checkPath to avoid repetition of the code, better reusability and consistency (checks were done differently depending on the method).

The implementation is quite similar to the one used in UnixFileSystemProvider which is quite straight forward, replacing the path implementation with S3Path:

    UnixPath checkPath(Path obj) {
        if (obj == null)
            throw new NullPointerException();
        if (!(obj instanceof UnixPath))
            throw new ProviderMismatchException();
        return (UnixPath)obj;
    }

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@markjschreiber markjschreiber left a comment

Choose a reason for hiding this comment

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

Thanks for this PR. A few minor changes requested.

@markjschreiber markjschreiber merged commit c418bd5 into awslabs:main Oct 25, 2023
1 check passed
@markjschreiber
Copy link
Contributor

Thanks again. Approved and merged!

@guicamest guicamest deleted the verifyPathLikeDefaultImplementation branch October 25, 2023 16:24
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