Skip to content

Commit

Permalink
fix(core): possible NPE on namespace files usage
Browse files Browse the repository at this point in the history
Fixes #4078
  • Loading branch information
loicmathieu committed Jun 20, 2024
1 parent 7f8bcdf commit ca39844
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import java.util.List;
import java.util.Optional;

/**
* @deprecated should not be used anymore
*/
@Deprecated
@Singleton
public class NamespaceFilesService {
Expand All @@ -36,7 +39,7 @@ public NamespaceFilesService(final StorageInterface storageInterface) {

@Deprecated
public List<URI> inject(RunContext runContext, String tenantId, String namespace, Path basePath, NamespaceFiles namespaceFiles) throws Exception {
if (!namespaceFiles.getEnabled()) {
if (!Boolean.TRUE.equals(namespaceFiles.getEnabled())) {
return Collections.emptyList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public void preExecuteTasks(RunContext runContext, TaskRun taskRun) throws Excep
}
}

if (this.namespaceFiles != null && this.namespaceFiles.getEnabled()) {
if (this.namespaceFiles != null && Boolean.TRUE.equals(this.namespaceFiles.getEnabled())) {
runContext.storage()
.namespace()
.findAllFilesMatching(this.namespaceFiles.getInclude(), this.namespaceFiles.getExclude())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public CommandsWrapper addEnv(Map<String, String> envs) {

public ScriptOutput run() throws Exception {
List<String> filesToUpload = new ArrayList<>();
if (this.namespaceFiles != null && this.namespaceFiles.getEnabled()) {
if (this.namespaceFiles != null && Boolean.TRUE.equals(this.namespaceFiles.getEnabled())) {

List<NamespaceFile> matchedNamespaceFiles = runContext.storage()
.namespace()
Expand Down

0 comments on commit ca39844

Please sign in to comment.