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


##########
server/data/data-api/src/main/java/org/apache/james/droplists/api/DropListEntry.java:
##########
@@ -71,6 +76,11 @@ public DropListEntry build() {
             Preconditions.checkArgument(deniedEntity != null && 
!deniedEntity.isBlank(), "`deniedEntity` must not be null, empty, or blank");
             Preconditions.checkArgument(deniedEntity.length() <= 
MAXIMUM_DOMAIN_LENGTH,
                 "deniedEntity length should not be longer than %s characters", 
MAXIMUM_DOMAIN_LENGTH);
+            if (deniedEntityType.equals(DeniedEntityType.DOMAIN)) {
+                deniedEntity = Domain.of(deniedEntity).asString();
+            } else {
+                deniedEntity = new MailAddress(deniedEntity).toString();
+            }

Review Comment:
   Generally speaking we can avoid variable reallocation by method extraction.
   This is more elegant and less complex.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to