This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit ba3a096ab097e86c30f4db21aa961a5501e5bd25 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Thu Jul 16 11:11:08 2020 +0700 [REFACTORING] FetchResponseBuilder should use Optional::isEmpty --- .../james/imap/processor/fetch/FetchResponseBuilder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java index 4d83116..af19cb5 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java @@ -306,7 +306,7 @@ public final class FetchResponseBuilder { } private Content getTextContent(MessageResult messageResult, Optional<MimePath> path) throws MailboxException { - if (!path.isPresent()) { + if (path.isEmpty()) { try { return messageResult.getBody(); } catch (IOException e) { @@ -332,7 +332,7 @@ public final class FetchResponseBuilder { // Check if its base as this can give use a more correctly working check // to see if we need to write the newline out to the client. // This is related to IMAP-298 - if (!path.isPresent()) { + if (path.isEmpty()) { if (messageResult.getSize() - result.size() <= 0) { // Seems like this mail has no body result.noBody(); @@ -352,7 +352,7 @@ public final class FetchResponseBuilder { } private FetchResponse.BodyElement headers(MessageResult messageResult, String name, Optional<MimePath> path) throws MailboxException { - if (!path.isPresent()) { + if (path.isEmpty()) { // if its base we can just return the raw headers without parsing // them. See MAILBOX-311 and IMAP-? HeadersBodyElement element = new HeadersBodyElement(name, messageResult.getHeaders()); @@ -388,7 +388,7 @@ public final class FetchResponseBuilder { } private Iterator<Header> getHeaders(MessageResult messageResult, Optional<MimePath> path) throws MailboxException { - if (!path.isPresent()) { + if (path.isEmpty()) { return messageResult.getHeaders().headers(); } else { return messageResult.iterateHeaders(path.get()); @@ -406,7 +406,7 @@ public final class FetchResponseBuilder { } private Content getContent(MessageResult messageResult, Optional<MimePath> path) throws MailboxException { - if (!path.isPresent()) { + if (path.isEmpty()) { try { return messageResult.getFullContent(); --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org