@Test public void decodeShouldThrowWhenCommandHasEmptyMailbox() { InputStream inputStream = new ByteArrayInputStream(" \n".getBytes(StandardCharsets.US_ASCII)); ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, outputStream); assertThatThrownBy(() -> parser.decode(lineReader, TAG, imapSession)) .isInstanceOf(DecodingException.class); }
@Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); MailboxSession mailboxSession = session.getMailboxSession(); if (mailboxSession != null) { if (mailboxName.endsWith(Character.toString(mailboxSession.getPathDelimiter()))) { mailboxName = mailboxName.substring(0, mailboxName.length() - 1); } } request.eol(); assertMailboxNameJustContainDelimiter(mailboxName, mailboxSession.getPathDelimiter()); return new CreateRequest(mailboxName, tag); }
CreateCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); MailboxSession mailboxSession = session.getMailboxSession(); if (mailboxSession != null) { if (mailboxName.endsWith(Character.toString(mailboxSession.getPathDelimiter()))) { mailboxName = mailboxName.substring(0, mailboxName.length() - 1); } } request.eol(); assertMailboxNameJustContainDelimiter(mailboxName, mailboxSession.getPathDelimiter()); return new CreateRequest(mailboxName, tag); } }
CreateCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); MailboxSession mailboxSession = session.getMailboxSession(); if (mailboxSession != null) { if (mailboxName.endsWith(Character.toString(mailboxSession.getPathDelimiter()))) { mailboxName = mailboxName.substring(0, mailboxName.length() - 1); } } request.eol(); assertMailboxNameJustContainDelimiter(mailboxName, mailboxSession.getPathDelimiter()); return new CreateRequest(mailboxName, tag); } CreateCommandParser(StatusResponseFactory statusResponseFactory); }
CreateCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); MailboxSession mailboxSession = session.getMailboxSession(); if (mailboxSession != null) { if (mailboxName.endsWith(Character.toString(mailboxSession.getPathDelimiter()))) { mailboxName = mailboxName.substring(0, mailboxName.length() - 1); } } request.eol(); assertMailboxNameJustContainDelimiter(mailboxName, mailboxSession.getPathDelimiter()); return new CreateRequest(mailboxName, tag); } CreateCommandParser(StatusResponseFactory statusResponseFactory);  }
CreateCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); MailboxSession mailboxSession = session.getMailboxSession(); if (mailboxSession != null) { if (mailboxName.endsWith(Character.toString(mailboxSession.getPathDelimiter()))) { mailboxName = mailboxName.substring(0, mailboxName.length() - 1); } } request.eol(); assertMailboxNameJustContainDelimiter(mailboxName, mailboxSession.getPathDelimiter()); return new CreateRequest(mailboxName, tag); } CreateCommandParser(StatusResponseFactory statusResponseFactory);   }