desruisseaux commented on code in PR #40:
URL: https://github.com/apache/sis/pull/40#discussion_r2832256946


##########
endorsed/src/org.apache.sis.cloud.aws/main/org/apache/sis/cloud/aws/s3/ClientFileSystem.java:
##########
@@ -110,11 +135,22 @@ final class ClientFileSystem extends FileSystem {
         ArgumentChecks.ensureNonEmpty("separator", separator);
         this.provider  = provider;
         this.accessKey = accessKey;
-        S3ClientBuilder builder = S3Client.builder().credentialsProvider(
-                
StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, 
secret)));
+        S3ClientBuilder builder = S3Client.builder();
+        if (secret != null) {
+            builder = 
builder.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey,
 secret)));
+        }
         if (region != null) {
             builder = builder.region(region);
         }
+        this.host = host;
+        this.port = port;
+        this.isHttps = isHttps;
+        if (host != null) {
+            String hostname = (port < 0 ? host + ':' + port : host);
+            String protocol = (this.isHttps ? "https" : "http");
+            builder = builder.endpointOverride(URI.create(protocol + "://" + 
hostname))

Review Comment:
   Consider using `new URI` instead of `URI.create`. It will forces us to 
declare `throws URISyntaxException` in the constructor signature, which will 
force to review the places where this constructor is invoked. But I think that 
as we go up in the caller chain, we will reach a point where 
`URISyntaxException` can be wrapped in a `DataStoreException`. The intend is to 
get a the "standard" (from SIS point of view) exception if the hostname uses an 
invalid syntax.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to