Source:
private static AmazonS3 newS3Client(String accessKey, String secretKey, Region region, URL endpoint, String signer) { BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); AmazonS3 s3Client = null; String awsRegion = null; try { if (endpoint == null) { if (region != null) { awsRegion = region.getName(); } else { awsRegion = System.getProperty(OPTS.AWS_REGION.name()); } log.debug("Creating AWS S3 Client."); s3Client = AmazonS3ClientBuilder .standard() .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) .withRegion(awsRegion) .build(); } else { log.debug("Creating Swift S3 client."); String protocol = endpoint.getProtocol(); String host = endpoint.getAuthority(); String ref = endpoint.getRef(); String endpointString = protocol + "://" + host; ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setProtocol(Protocol.valueOf(protocol.toUpperCase())); if (signer != null) { clientConfiguration.setSignerOverride(signer); } if (ref == null) { awsRegion = "us-east-1"; } else { awsRegion = ref; } s3Client = AmazonS3ClientBuilder .standard() .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration( endpointString, awsRegion ) ) .withPathStyleAccessEnabled(true) .withClientConfiguration(clientConfiguration) .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) .build(); } return s3Client; } catch (AmazonServiceException e) { String err = "Could not create connection to Amazon S3 due " + "to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } }

Target:
private static AmazonS3 newS3Client(String accessKey, String secretKey, Region region, URL endpoint, String signer) { BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); AmazonS3 s3Client = null; String awsRegion = null; try { if (endpoint == null) { if (region != null) { awsRegion = region.getName(); } else { awsRegion = System.getProperty(OPTS.AWS_REGION.name()); } log.debug("Creating AWS S3 Client."); s3Client = AmazonS3ClientBuilder .standard() .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) .withRegion(awsRegion) .build(); } else { log.debug("Creating Swift S3 client."); String protocol = endpoint.getProtocol(); String host = endpoint.getAuthority(); String ref = endpoint.getRef(); String endpointString = protocol + "://" + host; ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setProtocol(Protocol.valueOf(protocol.toUpperCase())); if (signer != null) { clientConfiguration.setSignerOverride(signer); } if (ref == null) { awsRegion = "us-east-1"; } else { awsRegion = ref; } s3Client = AmazonS3ClientBuilder .standard() .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration( endpointString, awsRegion ) ) .withPathStyleAccessEnabled(true) .withClientConfiguration(clientConfiguration) .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) .build(); } return s3Client; } catch (AmazonServiceException e) { String connType = endpoint == null ? "Amazon" : "Swift"; String err = "Could not create connection to " + connType + " S3 due " + "to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } }