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

fix for #293 #394

Merged
merged 1 commit into from
Mar 4, 2024
Merged

fix for #293 #394

merged 1 commit into from
Mar 4, 2024

Conversation

stefanofornari
Copy link
Contributor

Issue #, if available:
#293

Description of changes:
The current implementation violates the intended behaviour or relativize when relativizing a path to the root. The correct behaviour should be like:

Path root = FileSystems.getDefault().getRootDirectories().iterator().next();
Path path = FileSystems.getDefault().getPath("/a/b");
Path relative = root.relativize(path); // -> a/b, isAbsolute() == false

Side note: the use of var is particularly disappointing in S3Path where it should be clear if an object is a Path or a S3Path

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

@stefanofornari stefanofornari deleted the main-upstream branch March 3, 2024 14:35
@stefanofornari stefanofornari restored the main-upstream branch March 4, 2024 05:54
@stefanofornari stefanofornari reopened this Mar 4, 2024
@@ -257,10 +257,6 @@ public S3Path subpath(int beginIndex, int endIndex) {
}

var path = String.join(PATH_SEPARATOR, pathRepresentation.elements().subList(beginIndex, endIndex));
Copy link
Contributor

Choose a reason for hiding this comment

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

path can probably be final

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 fix! I think path can probably be made final now but not critical.

@markjschreiber markjschreiber merged commit c6e43f9 into awslabs:main Mar 4, 2024
1 check passed
stefanofornari added a commit to stefanofornari/aws-java-nio-spi-for-s3 that referenced this pull request May 20, 2024
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