Skip to content

Commit

Permalink
fix(cli): remove immutable map to avoid throwing exception
Browse files Browse the repository at this point in the history
exception threw because wrapper add env to Collections.emptyMAp()

no issues for DbtCli because this class uses the v1 plugin property
close #148
  • Loading branch information
mgabelle committed Oct 8, 2024
1 parent efbeb56 commit 7d1b987
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/main/java/io/kestra/plugin/dbt/cli/AbstractDbt.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -90,7 +90,7 @@ public abstract class AbstractDbt extends Task implements RunnableTask<ScriptOut
@Valid
protected TaskRunner taskRunner = Docker.builder()
.type(Docker.class.getName())
.entryPoint(Collections.emptyList())
.entryPoint(new ArrayList<>())
.build();

@Schema(title = "The task runner container image, only used if the task runner is container-based.")
Expand Down Expand Up @@ -143,7 +143,7 @@ public void setDockerOptions(Property<DockerOptions> dockerOptions) {
@Override
public ScriptOutput run(RunContext runContext) throws Exception {
CommandsWrapper commandsWrapper = new CommandsWrapper(runContext)
.withEnv(this.getEnv() != null ? this.getEnv().asMap(runContext, String.class, String.class) : Collections.emptyMap())
.withEnv(this.getEnv() != null ? this.getEnv().asMap(runContext, String.class, String.class) : new HashMap<>())
.withNamespaceFiles(namespaceFiles)
.withInputFiles(inputFiles)
.withOutputFiles(outputFiles)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/kestra/plugin/dbt/cli/DbtCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import jakarta.validation.constraints.NotEmpty;
Expand Down Expand Up @@ -214,7 +214,7 @@ public class DbtCLI extends AbstractExecScript {
@Valid
protected TaskRunner taskRunner = Docker.builder()
.type(Docker.class.getName())
.entryPoint(Collections.emptyList())
.entryPoint(new ArrayList<>())
.build();

@Builder.Default
Expand All @@ -231,7 +231,7 @@ protected DockerOptions injectDefaults(DockerOptions original) {
builder.image(this.getContainerImage());
}
if (original.getEntryPoint() == null) {
builder.entryPoint(Collections.emptyList());
builder.entryPoint(new ArrayList<>());
}

return builder.build();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/kestra/plugin/dbt/cli/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -193,7 +192,7 @@ public ScriptOutput run(RunContext runContext) throws Exception {
runContext,
workingDirectory,
this.finalInputFiles(runContext),
Collections.emptyMap()
new HashMap<>()
);

List<String> commandsArgs = ScriptService.scriptCommands(
Expand Down

0 comments on commit 7d1b987

Please sign in to comment.