Skip to content

Commit

Permalink
Fix Npe when no custom response body is supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanjan90 committed Feb 27, 2024
1 parent cbde8b2 commit 55cce54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/gyro/aws/wafv2/RuleGroupResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ protected void doCreate(GyroUI ui, State state) {
.capacity(capacity)
.visibilityConfig(getVisibilityConfig().toVisibilityConfig())
.rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList()))
.customResponseBodies(getCustomResponseBody().stream()
.customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream()
.collect(Collectors.toMap(CustomResponseBodyResource::getName,
CustomResponseBodyResource::toCustomResponseBody)))
.build());
Expand Down Expand Up @@ -504,7 +504,7 @@ protected void doUpdate(
.lockToken(lockToken(client))
.rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList()))
.visibilityConfig(getVisibilityConfig().toVisibilityConfig())
.customResponseBodies(getCustomResponseBody().stream()
.customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream()
.collect(Collectors.toMap(CustomResponseBodyResource::getName,
CustomResponseBodyResource::toCustomResponseBody))));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gyro/aws/wafv2/WebAclResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public void doCreate(GyroUI ui, State state) {
.defaultAction(toDefaultAction())
.rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList()))
.visibilityConfig(getVisibilityConfig().toVisibilityConfig())
.customResponseBodies(getCustomResponseBody().stream()
.customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream()
.collect(Collectors.toMap(CustomResponseBodyResource::getName,
CustomResponseBodyResource::toCustomResponseBody)))
);
Expand Down Expand Up @@ -440,7 +440,7 @@ public void doUpdate(
.defaultAction(toDefaultAction())
.rules(getRule().stream().map(RuleResource::toRule).collect(Collectors.toList()))
.visibilityConfig(getVisibilityConfig().toVisibilityConfig())
.customResponseBodies(getCustomResponseBody().stream()
.customResponseBodies(getCustomResponseBody().isEmpty() ? null : getCustomResponseBody().stream()
.collect(Collectors.toMap(CustomResponseBodyResource::getName,
CustomResponseBodyResource::toCustomResponseBody))));
}
Expand Down

0 comments on commit 55cce54

Please sign in to comment.