HoussemNasri commented on code in PR #2421: URL: https://github.com/apache/james-project/pull/2421#discussion_r1777853152
########## protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SetACLCommandParser.java: ########## @@ -43,10 +48,29 @@ public SetACLCommandParser(StatusResponseFactory statusResponseFactory) { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { - final String mailboxName = request.mailbox(); - final String identifier = request.astring(); - final String rights = request.astring(); - request.eol(); - return new SetACLRequest(tag, mailboxName, identifier, rights); + try { + final SetACLRequest.MailboxName mailboxName = new SetACLRequest.MailboxName(request.mailbox()); + final Username identifier = Username.of(request.astring()); + final String editModeAndRights = request.astring(); + request.eol(); + + MailboxACL.EditMode editMode = MailboxACL.EditMode.REPLACE; + if (StringUtils.isNotEmpty(editModeAndRights)) { + switch (editModeAndRights.charAt(0)) { + case MailboxACL.ADD_RIGHTS_MARKER: + editMode = MailboxACL.EditMode.ADD; + break; + case MailboxACL.REMOVE_RIGHTS_MARKER: + editMode = MailboxACL.EditMode.REMOVE; + break; + } + } Review Comment: Can we leverage switch expressions/yield keyword to avoid reallocation here? -- 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