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 b54e63e2ab248f57d83aaec9a49b4cba2513a69d Author: Benoit Tellier <[email protected]> AuthorDate: Fri Nov 8 16:31:54 2019 +0700 [Refactoring] Remove unused methods from protocols-imap --- .../james/imap/api/message/MessageFlags.java | 32 ------------- .../james/imap/encode/ImapResponseComposer.java | 31 ------------ .../imap/encode/base/ImapResponseComposerImpl.java | 30 ------------ .../message/response/ContinuationResponse.java | 6 --- .../james/imap/processor/CapabilityProcessor.java | 7 --- .../imap/utils/FastByteArrayOutputStream.java | 14 ------ ...AbstractTestOutputStreamImapResponseWriter.java | 56 ---------------------- 7 files changed, 176 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/MessageFlags.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/MessageFlags.java index 70cbe2a..826978d 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/MessageFlags.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/MessageFlags.java @@ -109,36 +109,4 @@ public class MessageFlags { } return results; } - - /** - * Returns IMAP formatted String of MessageFlags for named user - */ - public static String format(Flags flags) { - StringBuilder builder = new StringBuilder(); - builder.append("("); - if (flags.contains(Flags.Flag.ANSWERED)) { - builder.append("\\Answered "); - } - if (flags.contains(Flags.Flag.DELETED)) { - builder.append("\\Deleted "); - } - if (flags.contains(Flags.Flag.DRAFT)) { - builder.append("\\Draft "); - } - if (flags.contains(Flags.Flag.FLAGGED)) { - builder.append("\\Flagged "); - } - if (flags.contains(Flags.Flag.RECENT)) { - builder.append("\\Recent "); - } - if (flags.contains(Flags.Flag.SEEN)) { - builder.append("\\Seen "); - } - // Remove the trailing space, if necessary. - if (builder.length() > 1) { - builder.setLength(builder.length() - 1); - } - builder.append(")"); - return builder.toString(); - } } diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java index 3018d2b..d76e5f7 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java @@ -23,7 +23,6 @@ import java.io.IOException; import javax.mail.Flags; -import org.apache.james.imap.api.ImapCommand; import org.apache.james.imap.api.display.ModifiedUtf7; import org.apache.james.imap.api.message.IdRange; import org.apache.james.imap.api.message.UidRange; @@ -56,24 +55,6 @@ public interface ImapResponseComposer { ImapResponseComposer nil() throws IOException; /** - * Compose a response which contains the {@link ImapCommand} to which the - * response belongs - * - * @param message - * @return self - */ - ImapResponseComposer commandResponse(ImapCommand command, String message) throws IOException; - - /** - * Writes the message provided to the client, prepended with the request - * tag. - * - * @param message - * The message to write to the client. - */ - ImapResponseComposer taggedResponse(String message, String tag) throws IOException; - - /** * Writes the message provided to the client, prepended with the untagged * marker "*". * @@ -194,18 +175,6 @@ public interface ImapResponseComposer { * @return self, not null * @throws IOException */ - ImapResponseComposer upperCaseAscii(String message) throws IOException; - - /** - * Appends the given message after conversion to upper case. The message may - * be assumed to be ASCII encoded. Conversion of characters MUST NOT be - * performed according to the current locale but as per ASCII. - * - * @param message - * ASCII encoded, not null - * @return self, not null - * @throws IOException - */ ImapResponseComposer quoteUpperCaseAscii(String message) throws IOException; /** diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java index b3a1e5d..33d2be9 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java @@ -24,7 +24,6 @@ import java.nio.charset.Charset; import javax.mail.Flags; -import org.apache.james.imap.api.ImapCommand; import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.display.ModifiedUtf7; import org.apache.james.imap.api.message.IdRange; @@ -83,25 +82,6 @@ public class ImapResponseComposerImpl implements ImapConstants, ImapResponseComp return this; } - - - @Override - public ImapResponseComposer commandResponse(ImapCommand command, String message) throws IOException { - untagged(); - commandName(command.getName()); - message(message); - end(); - return this; - } - - @Override - public ImapResponseComposer taggedResponse(String message, String tag) throws IOException { - tag(tag); - message(message); - end(); - return this; - } - @Override public ImapResponseComposer untaggedResponse(String message) throws IOException { untagged(); @@ -204,16 +184,6 @@ public class ImapResponseComposerImpl implements ImapConstants, ImapResponseComp } @Override - public ImapResponseComposer upperCaseAscii(String message) throws IOException { - if (message == null) { - nil(); - } else { - upperCaseAscii(message, false); - } - return this; - } - - @Override public ImapResponseComposer quoteUpperCaseAscii(String message) throws IOException { if (message == null) { nil(); diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/response/ContinuationResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ContinuationResponse.java index 029c768..da8b5f0 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/message/response/ContinuationResponse.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ContinuationResponse.java @@ -28,12 +28,6 @@ public class ContinuationResponse implements ImapResponseMessage { private final HumanReadableText textKey; - public ContinuationResponse(String data) { - super(); - this.data = data; - this.textKey = null; - } - public ContinuationResponse(HumanReadableText textKey) { super(); this.data = null; diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java index 33b08e9..1133ed3 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java @@ -55,13 +55,6 @@ public class CapabilityProcessor extends AbstractMailboxProcessor<CapabilityRequ private final List<CapabilityImplementingProcessor> capabilities = new ArrayList<>(); private final Set<String> disabledCaps = new HashSet<>(); - - public CapabilityProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory, List<CapabilityImplementingProcessor> capabilities, - MetricFactory metricFactory) { - this(next, mailboxManager, factory, metricFactory); - capabilities.addAll(capabilities); - - } public CapabilityProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory, MetricFactory metricFactory) { diff --git a/protocols/imap/src/main/java/org/apache/james/imap/utils/FastByteArrayOutputStream.java b/protocols/imap/src/main/java/org/apache/james/imap/utils/FastByteArrayOutputStream.java index 9df9496..394b1f0 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/utils/FastByteArrayOutputStream.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/utils/FastByteArrayOutputStream.java @@ -18,7 +18,6 @@ package org.apache.james.imap.utils; */ import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; @@ -216,18 +215,5 @@ public class FastByteArrayOutputStream extends OutputStream { } buf[count++] = (byte) oneByte; } - - /** - * Takes the contents of this stream and writes it to the output stream - * {@code out}. - * - * @param out - * an OutputStream on which to write the contents of this stream. - * @throws IOException - * if an error occurs while writing to {@code out}. - */ - public void writeTo(OutputStream out) throws IOException { - out.write(buf, 0, count); - } } diff --git a/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java b/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java deleted file mode 100644 index 750ed69..0000000 --- a/protocols/imap/src/test/java/org/apache/james/imap/main/AbstractTestOutputStreamImapResponseWriter.java +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.imap.main; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.ByteArrayOutputStream; - -import org.apache.james.imap.decode.main.OutputStreamImapResponseWriter; -import org.junit.Before; - -public abstract class AbstractTestOutputStreamImapResponseWriter { - - OutputStreamImapResponseWriter writer; - - ByteArrayOutputStream out; - - public AbstractTestOutputStreamImapResponseWriter() { - super(); - } - - @Before - public void setUp() throws Exception { - out = new ByteArrayOutputStream(); - writer = new OutputStreamImapResponseWriter(out); - } - - protected void checkExpected(String expected) throws Exception { - StringBuilder builder = new StringBuilder(); - writer.flush(); - out.flush(); - byte[] output = out.toByteArray(); - for (byte aChar : output) { - builder.append((char) aChar); - } - assertThat(builder.toString()).isEqualTo(expected); - } - -} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
