[
https://issues.apache.org/jira/browse/HADOOP-19681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18020317#comment-18020317
]
ASF GitHub Bot commented on HADOOP-19681:
-----------------------------------------
steveloughran commented on code in PR #7942:
URL: https://github.com/apache/hadoop/pull/7942#discussion_r2348701684
##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AConfiguration.java:
##########
@@ -594,13 +595,28 @@ private static <T> T getField(Object target, Class<T>
fieldType,
public void testConfOptionPropagationToFS() throws Exception {
Configuration config = new Configuration();
String testFSName = config.getTrimmed(TEST_FS_S3A_NAME, "");
- String bucket = new URI(testFSName).getHost();
+ URI uri = new URI(testFSName);
+ String bucket = uri.getHost();
+ if (bucket == null) {
+ bucket = uri.getAuthority();
+ }
setBucketOption(config, bucket, "propagation", "propagated");
fs = S3ATestUtils.createTestFileSystem(config);
Configuration updated = fs.getConf();
assertOptionEquals(updated, "fs.s3a.propagation", "propagated");
}
+ @Test
+ public void testBucketNameWithDotAndNumber() throws Exception {
+ Configuration config = new Configuration();
+ Path path = new Path("s3a://test-bucket-v1.1");
+ try (FileSystem fs = path.getFileSystem(config)) {
+ assertThat(fs instanceof S3AFileSystem)
Review Comment:
use whatever assertj assertion is about instanceof, so you get a better
error.
> Fix S3A failing to initialize S3 buckets having namespace with dot followed
> by number
> -------------------------------------------------------------------------------------
>
> Key: HADOOP-19681
> URL: https://issues.apache.org/jira/browse/HADOOP-19681
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs/s3
> Reporter: Syed Shameerur Rahman
> Assignee: Syed Shameerur Rahman
> Priority: Major
> Labels: pull-request-available
>
> S3A fails to initialize when S3 bucket namespace is having dot followed by a
> number.
> {*}Specific Problem{*}: URI parsing fails when S3 bucket names contain a dot
> followed by a number (like {{{}bucket-v1.1-us-east-1{}}}). Java's
> URI.getHost() method incorrectly interprets the dot-number pattern as a port
> specification, causing it to return null.
>
> {{}}
> {code:java}
> hadoop dfs -ls s3a://bucket-v1.1-us-east-1/
> WARNING: Use of this script to execute dfs is deprecated.
> WARNING: Attempting to execute replacement "hdfs dfs" instead.
> 2025-09-08 06:13:06,670 WARN fs.FileSystem: Failed to initialize filesystem
> s3://bucket-v1.1-us-east-1/: java.lang.IllegalArgumentException: bucket is
> null/empty
> -ls: bucket is null/empty{code}
>
> {*}Please Note{*}: Although there has been discussion on not allowing S3
> buckets with such a namespace
> ([https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/])
> , Amazon S3 still allows you to create a bucket with such a namespace.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]