chibenwa commented on code in PR #1758:
URL: https://github.com/apache/james-project/pull/1758#discussion_r1372338278


##########
server/data/data-jmap/src/main/java/org/apache/james/jmap/api/filtering/Rule.java:
##########
@@ -390,14 +390,20 @@ public Builder setForward(Optional<Forward> forward) {
             }
 
             public Builder setForward(Forward forward) {
-                this.forward = Optional.of(forward);
+                this.forward = Optional.ofNullable(forward);
                 return this;
             }
 
             public Action build() {
-                Preconditions.checkNotNull(appendInMailboxes, 
"appendInMailboxes should not be null");
-                Preconditions.checkNotNull(withKeywords, "withKeywords should 
not be null");
-                Preconditions.checkNotNull(forward, "forward should not be 
null");
+                if (Objects.isNull(appendInMailboxes)) {
+                    appendInMailboxes = 
Rule.Action.AppendInMailboxes.withMailboxIds(ImmutableList.of());
+                }
+                if (Objects.isNull(withKeywords)) {
+                    withKeywords = ImmutableList.of();
+                }
+                if (Objects.isNull(forward)) {
+                    forward = Optional.empty();
+                }

Review Comment:
   Then use Optionals



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to