You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/12/10 02:30:16 UTC
[james-project] 13/27: [Refactoring] Avoid variable allocation in
FetchResponseBuilder::bodyContent
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 cb30feb2a4f0f045b057caad37383f6366d1720c
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Dec 9 14:11:56 2019 +0700
[Refactoring] Avoid variable allocation in FetchResponseBuilder::bodyContent
---
.../imap/processor/fetch/FetchResponseBuilder.java | 43 +++++++---------------
1 file changed, 14 insertions(+), 29 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 4e9906c..f83c2cc 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
@@ -228,37 +228,22 @@ public final class FetchResponseBuilder {
}
private FetchResponse.BodyElement bodyContent(MessageResult messageResult, String name, int specifier, int[] path, Collection<String> names, boolean isBase) throws MailboxException {
- final FetchResponse.BodyElement fullResult;
-
switch (specifier) {
- case BodyFetchElement.CONTENT:
- fullResult = content(messageResult, name, path, isBase);
- break;
-
- case BodyFetchElement.HEADER_FIELDS:
- fullResult = fields(messageResult, name, path, names, isBase);
- break;
-
- case BodyFetchElement.HEADER_NOT_FIELDS:
- fullResult = fieldsNot(messageResult, name, path, names, isBase);
- break;
-
- case BodyFetchElement.MIME:
- fullResult = mimeHeaders(messageResult, name, path, isBase);
- break;
- case BodyFetchElement.HEADER:
- fullResult = headers(messageResult, name, path, isBase);
- break;
-
- case BodyFetchElement.TEXT:
- fullResult = text(messageResult, name, path, isBase);
- break;
-
- default:
- fullResult = null;
- break;
+ case BodyFetchElement.CONTENT:
+ return content(messageResult, name, path, isBase);
+ case BodyFetchElement.HEADER_FIELDS:
+ return fields(messageResult, name, path, names, isBase);
+ case BodyFetchElement.HEADER_NOT_FIELDS:
+ return fieldsNot(messageResult, name, path, names, isBase);
+ case BodyFetchElement.MIME:
+ return mimeHeaders(messageResult, name, path, isBase);
+ case BodyFetchElement.HEADER:
+ return headers(messageResult, name, path, isBase);
+ case BodyFetchElement.TEXT:
+ return text(messageResult, name, path, isBase);
+ default:
+ return null;
}
- return fullResult;
}
private FetchResponse.BodyElement wrapIfPartialFetch(Long firstOctet, Long numberOfOctets, FetchResponse.BodyElement fullResult) {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org