Skip to content

Commit

Permalink
SecretEnricher getSecretsFromXmlConfig should return Collections.empt…
Browse files Browse the repository at this point in the history
…yList() instead of null eclipse-jkube#2530
  • Loading branch information
sankritimishra committed Feb 1, 2024
1 parent 302b2b7 commit 151f6a7
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
import org.eclipse.jkube.kit.enricher.api.JKubeEnricherContext;
import org.eclipse.jkube.kit.enricher.api.util.SecretConstants;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jkube.kit.enricher.api.model.Configuration;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

public abstract class SecretEnricher extends BaseEnricher {

Expand Down Expand Up @@ -128,11 +127,10 @@ private void addSecretsFromXmlConfiguration(KubernetesListBuilder builder) {
}

private List<SecretConfig> getSecretsFromXmlConfig() {
ResourceConfig resourceConfig = getConfiguration().getResource();
if(resourceConfig != null && resourceConfig.getSecrets() != null) {
return resourceConfig.getSecrets();
}
return null;
return Optional.ofNullable(getConfiguration())
.map(Configuration::getResource)
.map(ResourceConfig::getSecrets)
.orElse(Collections.emptyList());
}

private String getDockerIdFromAnnotation(Map<String, String> annotation) {
Expand Down

0 comments on commit 151f6a7

Please sign in to comment.