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

Commit

Permalink
Fix #1971: Added NullCheck in FileDataSecretEnricher
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanKanojia committed Feb 21, 2020
1 parent 291fbdc commit 2c58aa0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
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

0 comments on commit 2c58aa0

Please sign in to comment.