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 83b4d2bd4e9479cf45d4e57d0cc242c6ad716c8f
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Thu Jul 16 11:45:21 2020 +0700

    [REFACTORING] Rearrange IMAP FETCH fields
    
     - Avoid skipping lines between fields
     - Use `this` prefix everywhere in constructors
     - Remove constructor Object super call that could be implicit
---
 .../james/imap/processor/fetch/AddressImpl.java    |  4 ----
 .../imap/processor/fetch/ContentBodyElement.java   |  2 --
 .../james/imap/processor/fetch/EnvelopeImpl.java   | 11 ----------
 .../imap/processor/fetch/FetchResponseBuilder.java | 11 ----------
 .../imap/processor/fetch/HeaderBodyElement.java    |  1 -
 .../imap/processor/fetch/HeadersBodyElement.java   |  1 -
 .../imap/processor/fetch/MimeBodyElement.java      |  4 ----
 .../processor/fetch/MimeDescriptorStructure.java   | 25 ++++++----------------
 .../processor/fetch/PartialFetchBodyElement.java   |  7 +-----
 9 files changed, 8 insertions(+), 58 deletions(-)

diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/AddressImpl.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/AddressImpl.java
index 018d519..ffb63fe 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/AddressImpl.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/AddressImpl.java
@@ -26,15 +26,11 @@ import org.apache.james.imap.message.response.FetchResponse;
 
 final class AddressImpl implements FetchResponse.Envelope.Address {
     private final String atDomainList;
-
     private final String hostName;
-
     private final String mailboxName;
-
     private final String personalName;
 
     public AddressImpl(String atDomainList, String hostName, String 
mailboxName, String personalName) {
-        super();
         this.atDomainList = atDomainList;
         this.hostName = hostName;
         this.mailboxName = mailboxName;
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/ContentBodyElement.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/ContentBodyElement.java
index 93dda65..5cbf722 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/ContentBodyElement.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/ContentBodyElement.java
@@ -31,11 +31,9 @@ import org.apache.james.mailbox.model.Content;
 
 class ContentBodyElement implements BodyElement {
     private final String name;
-
     protected final Content content;
 
     public ContentBodyElement(String name, Content content) {
-        super();
         this.name = name;
         this.content = content;
     }
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeImpl.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeImpl.java
index 615558f..cfa2f20 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeImpl.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeImpl.java
@@ -25,29 +25,18 @@ package org.apache.james.imap.processor.fetch;
 import org.apache.james.imap.message.response.FetchResponse;
 
 final class EnvelopeImpl implements FetchResponse.Envelope {
-
     private final Address[] bcc;
-
     private final Address[] cc;
-
     private final String date;
-
     private final Address[] from;
-
     private final String inReplyTo;
-
     private final String messageId;
-
     private final Address[] replyTo;
-
     private final Address[] sender;
-
     private final String subject;
-
     private final Address[] to;
 
     public EnvelopeImpl(String date, String subject, Address[] from, Address[] 
sender, Address[] replyTo, Address[] to, Address[] cc, Address[] bcc, String 
inReplyTo, String messageId) {
-        super();
         this.bcc = bcc;
         this.cc = cc;
         this.date = date;
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 af19cb5..0156e7f 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
@@ -55,31 +55,20 @@ import org.apache.james.mailbox.model.MessageResult;
 import org.apache.james.mailbox.model.MimePath;
 
 public final class FetchResponseBuilder {
-
     private final EnvelopeBuilder envelopeBuilder;
 
     private MessageSequenceNumber msn;
-
     private MessageUid uid;
-
     private Flags flags;
-
     private Date internalDate;
-
     private Long size;
-    
     private ModSeq modSeq;
-
     private List<FetchResponse.BodyElement> elements;
-
     private FetchResponse.Envelope envelope;
-
     private FetchResponse.Structure body;
-
     private FetchResponse.Structure bodystructure;
 
     public FetchResponseBuilder(EnvelopeBuilder envelopeBuilder) {
-        super();
         this.envelopeBuilder = envelopeBuilder;
     }
 
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeaderBodyElement.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeaderBodyElement.java
index e2b3abd..d7656ce 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeaderBodyElement.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeaderBodyElement.java
@@ -37,7 +37,6 @@ public class HeaderBodyElement extends MimeBodyElement {
     public HeaderBodyElement(String name, List<Header> headers) throws 
MailboxException {
         super(name, headers);
     }
-
     
     /**
      * Indicate that there is no text body in the message. In this case we 
don't need to write a single CRLF in anycase if
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeadersBodyElement.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeadersBodyElement.java
index 9b81c2e..fcdcb58 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeadersBodyElement.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/HeadersBodyElement.java
@@ -31,7 +31,6 @@ public class HeadersBodyElement extends ContentBodyElement {
         super(name, content);
     }
 
-
     /**
      * Indicate that there is no text body in the message. In this case we 
don't need to write a single CRLF in anycase if
      * this Element does not contain a header.
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java
index 715674c..7a46285 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeBodyElement.java
@@ -37,17 +37,13 @@ import org.apache.james.mailbox.model.Header;
  */
 public class MimeBodyElement implements BodyElement {
     private final String name;
-
     protected final List<Header> headers;
-
     protected long size;
 
     public MimeBodyElement(String name, List<Header> headers) throws 
MailboxException {
-        super();
         this.name = name;
         this.headers = headers;
         this.size = calculateSize(headers);
-        
     }
 
     @Override
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeDescriptorStructure.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeDescriptorStructure.java
index 59c01ae..0b44c99 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeDescriptorStructure.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/MimeDescriptorStructure.java
@@ -34,34 +34,23 @@ import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MimeDescriptor;
 
 final class MimeDescriptorStructure implements FetchResponse.Structure {
-
     private final MimeDescriptor descriptor;
-
     private final List<String> parameters;
-
     private final List<Structure> parts;
-
     private final String disposition;
-
     private final Map<String, String> dispositionParams;
-
     private final String location;
-
     private final String md5;
-
     private final List<String> languages;
-
     private final Structure embeddedMessageStructure;
-
     private final Envelope envelope;
 
     public MimeDescriptorStructure(boolean allowExtensions, MimeDescriptor 
descriptor, EnvelopeBuilder builder) throws MailboxException {
-        super();
         this.descriptor = descriptor;
-        parameters = createParameters(descriptor);
-        parts = createParts(allowExtensions, descriptor, builder);
+        this.parameters = createParameters(descriptor);
+        this.parts = createParts(allowExtensions, descriptor, builder);
 
-        languages = descriptor.getLanguages();
+        this.languages = descriptor.getLanguages();
         this.dispositionParams = descriptor.getDispositionParams();
         this.disposition = descriptor.getDisposition();
 
@@ -70,11 +59,11 @@ final class MimeDescriptorStructure implements 
FetchResponse.Structure {
 
         final MimeDescriptor embeddedMessage = descriptor.embeddedMessage();
         if (embeddedMessage == null) {
-            embeddedMessageStructure = null;
-            envelope = null;
+            this.embeddedMessageStructure = null;
+            this.envelope = null;
         } else {
-            embeddedMessageStructure = new 
MimeDescriptorStructure(allowExtensions, embeddedMessage, builder);
-            envelope = builder.buildEnvelope(embeddedMessage);
+            this.embeddedMessageStructure = new 
MimeDescriptorStructure(allowExtensions, embeddedMessage, builder);
+            this.envelope = builder.buildEnvelope(embeddedMessage);
         }
     }
 
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElement.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElement.java
index 78b3f8d..f2546cc 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElement.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/PartialFetchBodyElement.java
@@ -29,21 +29,16 @@ import 
org.apache.james.imap.message.response.FetchResponse.BodyElement;
  * Wraps full content to implement a partial fetch.
  */
 final class PartialFetchBodyElement implements BodyElement {
-
     private final BodyElement delegate;
-
     private final long firstOctet;
-
     private final long numberOfOctets;
-
     private final String name;
 
     public PartialFetchBodyElement(BodyElement delegate, long firstOctet, long 
numberOfOctets) {
-        super();
         this.delegate = delegate;
         this.firstOctet = firstOctet;
         this.numberOfOctets = numberOfOctets;
-        name = delegate.getName() + "<" + firstOctet + ">";
+        this.name = delegate.getName() + "<" + firstOctet + ">";
     }
 
     @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to