Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Fix #1791: Added NullCheck in FileDataSecretEnricher #1792

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Usage:
### 4.5-SNAPSHOT
* Fix #1789: script to extract changelog information for notifications
* Fix #1770: Fixed my mistake, remove constructors from OpenshiftBuildConfig which were causing PluginConfigurationException
* Fix #1791: Fix NullPointerException in FileDataSecretEnricher (due to recent change in Kubernetes Client Builder null to LinkedHashMap conversion)

### 4.4.0 (2020-02-13)
* Fix #1572: Support maven --batch-mode option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ private void addAnnotations(KubernetesListBuilder builder) {
public void visit(SecretBuilder element) {
final Map<String, String> annotations = element.buildMetadata().getAnnotations();
try {
final Map<String, String> secretAnnotations = createSecretFromAnnotations(annotations);
element.addToData(secretAnnotations);
if (annotations != null && !annotations.isEmpty()) {
final Map<String, String> secretAnnotations = createSecretFromAnnotations(annotations);
element.addToData(secretAnnotations);
}
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ public void create(PlatformMode platformMode, KubernetesListBuilder builder) {
@Override
public void visit(SecretBuilder secretBuilder) {
Map<String, String> annotation = secretBuilder.buildMetadata().getAnnotations();
if (!annotation.containsKey(getAnnotationKey())) {
return;
if (annotation != null) {
if (!annotation.containsKey(getAnnotationKey())) {
return;
}
String dockerId = annotation.get(getAnnotationKey());
Map<String, String> data = generateData(dockerId);
if (data == null) {
return;
}
// remove the annotation key
annotation.remove(getAnnotationKey());
secretBuilder.addToData(data);
}
String dockerId = annotation.get(getAnnotationKey());
Map<String, String> data = generateData(dockerId);
if (data == null) {
return;
}
// remove the annotation key
annotation.remove(getAnnotationKey());
secretBuilder.addToData(data);
}
});

Expand Down