diff --git a/connectors/riot-file/src/main/java/com/redis/riot/file/GcsOptions.java b/connectors/riot-file/src/main/java/com/redis/riot/file/GcsOptions.java index 0bb466507..543007828 100644 --- a/connectors/riot-file/src/main/java/com/redis/riot/file/GcsOptions.java +++ b/connectors/riot-file/src/main/java/com/redis/riot/file/GcsOptions.java @@ -21,14 +21,14 @@ public class GcsOptions { @Option(names = "--gcs-key-file", description = "GCS private key (e.g. /usr/local/key.json).", paramLabel = "") - private Optional credentials = Optional.empty(); + private Optional keyFile = Optional.empty(); @Option(names = "--gcs-project", description = "GCP project id.", paramLabel = "") private Optional projectId = Optional.empty(); @Option(names = "--gcs-key", arity = "0..1", interactive = true, description = "GCS Base64 encoded key.", paramLabel = "") private Optional encodedKey = Optional.empty(); - public void setCredentials(File credentials) { - this.credentials = Optional.of(credentials); + public void setKeyFile(File credentials) { + this.keyFile = Optional.of(credentials); } public void setProjectId(String projectId) { @@ -42,8 +42,8 @@ public void setEncodedKey(String encodedKey) { public GoogleStorageResource resource(String locationUri, boolean readOnly) throws IOException { StorageOptions.Builder builder = StorageOptions.newBuilder().setProjectId(ServiceOptions.getDefaultProjectId()) .setHeaderProvider(new UserAgentHeaderProvider(GcpStorageAutoConfiguration.class)); - if (credentials.isPresent()) { - builder.setCredentials(GoogleCredentials.fromStream(Files.newInputStream(credentials.get().toPath())) + if (keyFile.isPresent()) { + builder.setCredentials(GoogleCredentials.fromStream(Files.newInputStream(keyFile.get().toPath())) .createScoped((readOnly ? GcpScope.STORAGE_READ_ONLY : GcpScope.STORAGE_READ_WRITE).getUrl())); } if (encodedKey.isPresent()) { @@ -56,8 +56,7 @@ public GoogleStorageResource resource(String locationUri, boolean readOnly) thro @Override public String toString() { - return "GcsOptions [credentials=" + credentials + ", projectId=" + projectId + ", encodedKey=" + encodedKey - + "]"; + return "GcsOptions [credentials=" + keyFile + ", projectId=" + projectId + ", encodedKey=" + encodedKey + "]"; } } diff --git a/core/riot-core/src/main/java/com/redis/riot/AbstractTransferCommand.java b/core/riot-core/src/main/java/com/redis/riot/AbstractTransferCommand.java index 34c7a1930..9821d5d10 100644 --- a/core/riot-core/src/main/java/com/redis/riot/AbstractTransferCommand.java +++ b/core/riot-core/src/main/java/com/redis/riot/AbstractTransferCommand.java @@ -3,6 +3,7 @@ import java.time.Duration; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeoutException; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -84,7 +85,7 @@ protected FaultTolerantStepBuilder step(SimpleStepBuilder ste LimitCheckingItemSkipPolicy limitSkipPolicy = (LimitCheckingItemSkipPolicy) skipPolicy; limitSkipPolicy.setSkippableExceptionMap( Stream.of(RedisCommandExecutionException.class, RedisCommandTimeoutException.class, - TimeoutException.class).collect(Collectors.toMap(t -> t, t -> true))); + TimeoutException.class).collect(Collectors.toMap(Function.identity(), t -> true))); } return step.faultTolerant().skipPolicy(options.getSkipPolicy().getSkipPolicy()); }