http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryId.java ---------------------------------------------------------------------- diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryId.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryId.java index 389a76a..91fed3c 100644 --- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryId.java +++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryId.java @@ -66,15 +66,19 @@ public class InMemoryId implements MailboxId, Serializable { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } InMemoryId other = (InMemoryId) obj; - if (value != other.value) + if (value != other.value) { return false; + } return true; }
http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java index 827071e..8a69f43 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java @@ -145,16 +145,21 @@ public abstract class MailboxSessionMapperFactory implements RequestAware, Mailb * @param session */ public void endProcessingRequest(MailboxSession session) { - if (session == null) return; + if (session == null) { + return; + } MessageMapper messageMapper = (MessageMapper) session.getAttributes().get(MESSAGEMAPPER); MailboxMapper mailboxMapper = (MailboxMapper) session.getAttributes().get(MAILBOXMAPPER); SubscriptionMapper subscriptionMapper = (SubscriptionMapper) session.getAttributes().get(SUBSCRIPTIONMAPPER); - if (messageMapper != null) + if (messageMapper != null) { messageMapper.endRequest(); - if (mailboxMapper != null) + } + if (mailboxMapper != null) { mailboxMapper.endRequest(); - if (subscriptionMapper != null) - subscriptionMapper.endRequest(); + } + if (subscriptionMapper != null) { + subscriptionMapper.endRequest(); + } } /** http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java index 04cc41d..43ae025 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/ResultUtils.java @@ -70,7 +70,9 @@ public class ResultUtils { ByteSequence raw = field.getRaw(); int len = raw.length(); int off = ((RawField) field).getDelimiterIdx() + 1; - if (len > off + 1 && (raw.byteAt(off) & 0xff) == 0x20) off++; + if (len > off + 1 && (raw.byteAt(off) & 0xff) == 0x20) { + off++; + } fieldValue = ContentUtil.decode(raw, off, len - off); } else { http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMailboxMetaData.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMailboxMetaData.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMailboxMetaData.java index 051c69e..d513b77 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMailboxMetaData.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMailboxMetaData.java @@ -109,18 +109,23 @@ public class SimpleMailboxMetaData implements MailboxMetaData, Comparable<Mailbo * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final SimpleMailboxMetaData other = (SimpleMailboxMetaData) obj; if (path == null) { - if (other.path != null) + if (other.path != null) { return false; - } else if (!path.equals(other.path)) + } + } else if (!path.equals(other.path)) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java index ba9ae93..b321e13 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java @@ -491,14 +491,16 @@ public class StoreMailboxManager implements MailboxManager { LOGGER.warn("Ignoring mailbox with empty name"); } else { MailboxPath sanitizedMailboxPath = mailboxPath.sanitize(mailboxSession.getPathDelimiter()); - if (mailboxExists(sanitizedMailboxPath, mailboxSession)) + if (mailboxExists(sanitizedMailboxPath, mailboxSession)) { throw new MailboxExistsException(sanitizedMailboxPath.asString()); + } // Create parents first // If any creation fails then the mailbox will not be created // TODO: transaction List<MailboxId> mailboxIds = new ArrayList<>(); for (MailboxPath mailbox : sanitizedMailboxPath.getHierarchyLevels(getDelimiter())) + { locker.executeWithLock(mailboxSession, mailbox, (LockAwareExecution<Void>) () -> { if (!mailboxExists(mailbox, mailboxSession)) { Mailbox m = doCreateMailbox(mailbox, mailboxSession); @@ -511,6 +513,7 @@ public class StoreMailboxManager implements MailboxManager { return null; }, true); + } if (!mailboxIds.isEmpty()) { return Optional.ofNullable(Iterables.getLast(mailboxIds)); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageResultIterator.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageResultIterator.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageResultIterator.java index c497016..4af4960 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageResultIterator.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageResultIterator.java @@ -126,8 +126,9 @@ public class StoreMessageResultIterator implements MessageResultIterator { @Override public boolean hasNext() { - if (cursor.compareTo(to) > 0) - return false; + if (cursor.compareTo(to) > 0) { + return false; + } if (next == null || !next.hasNext()) { try { http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java index 2bb58cf..a137951 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleProperty.java @@ -102,11 +102,19 @@ public final class SimpleProperty implements Property { @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof SimpleProperty)) return false; + if (this == o) { + return true; + } + if (!(o instanceof SimpleProperty)) { + return false; + } SimpleProperty that = (SimpleProperty) o; - if (namespace != null ? !namespace.equals(that.namespace) : that.namespace != null) return false; - if (localName != null ? !localName.equals(that.localName) : that.localName != null) return false; + if (namespace != null ? !namespace.equals(that.namespace) : that.namespace != null) { + return false; + } + if (localName != null ? !localName.equals(that.localName) : that.localName != null) { + return false; + } return !(value != null ? !value.equals(that.value) : that.value != null); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java index 4b8b13b..9f48eb2 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Topic.java @@ -35,7 +35,9 @@ public class Topic { @Override public boolean equals(Object o) { - if (o == null || getClass() != o.getClass()) return false; + if (o == null || getClass() != o.getClass()) { + return false; + } Topic topic = (Topic) o; return Objects.equal(this.value, topic.value); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/CountingInputStream.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/CountingInputStream.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/CountingInputStream.java index 82a1e26..f26ea90 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/CountingInputStream.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/CountingInputStream.java @@ -80,6 +80,8 @@ public final class CountingInputStream extends InputStream { * @throws IOException */ public void readAll() throws IOException { - while (read()>0); + while (read()>0) { + ; + } } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java index 70858e7..640c932 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java @@ -60,11 +60,23 @@ public class MessageBuilder { public void setFlags(boolean seen, boolean flagged, boolean answered, boolean draft, boolean deleted, boolean recent) { - if (seen) flags.add(Flags.Flag.SEEN); - if (flagged) flags.add(Flags.Flag.FLAGGED); - if (answered) flags.add(Flags.Flag.ANSWERED); - if (draft) flags.add(Flags.Flag.DRAFT); - if (deleted) flags.add(Flags.Flag.DELETED); - if (recent) flags.add(Flags.Flag.RECENT); + if (seen) { + flags.add(Flags.Flag.SEEN); + } + if (flagged) { + flags.add(Flags.Flag.FLAGGED); + } + if (answered) { + flags.add(Flags.Flag.ANSWERED); + } + if (draft) { + flags.add(Flags.Flag.DRAFT); + } + if (deleted) { + flags.add(Flags.Flag.DELETED); + } + if (recent) { + flags.add(Flags.Flag.RECENT); + } } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/FlagsMessageEvent.java ---------------------------------------------------------------------- diff --git a/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/FlagsMessageEvent.java b/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/FlagsMessageEvent.java index ba8dd30..f45f225 100644 --- a/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/FlagsMessageEvent.java +++ b/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/FlagsMessageEvent.java @@ -59,7 +59,9 @@ public class FlagsMessageEvent implements ImpactingMessageEvent { @Override public boolean equals(Object o) { - if (o == null || getClass() != o.getClass()) return false; + if (o == null || getClass() != o.getClass()) { + return false; + } FlagsMessageEvent that = (FlagsMessageEvent) o; return Objects.equal(uid, that.uid) && Objects.equal(mailboxPath, that.mailboxPath) && http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/MessageDeletedEvent.java ---------------------------------------------------------------------- diff --git a/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/MessageDeletedEvent.java b/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/MessageDeletedEvent.java index 7fac6f6..690586a 100644 --- a/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/MessageDeletedEvent.java +++ b/mailbox/tool/src/main/java/org/apache/james/mailbox/indexer/events/MessageDeletedEvent.java @@ -51,7 +51,9 @@ public class MessageDeletedEvent implements ImpactingMessageEvent { @Override public boolean equals(Object o) { - if (o == null || getClass() != o.getClass()) return false; + if (o == null || getClass() != o.getClass()) { + return false; + } MessageDeletedEvent that = (MessageDeletedEvent) o; return Objects.equal(uid, that.uid) && Objects.equal(mailboxPath, that.mailboxPath); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java ---------------------------------------------------------------------- diff --git a/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java b/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java index 2c1c888..121cd26 100644 --- a/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java +++ b/mailbox/zoo-seq-provider/src/test/java/org/apache/james/mailbox/store/mail/ZooUidProviderTest.java @@ -66,18 +66,23 @@ public class ZooUidProviderTest { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } LongId other = (LongId) obj; if (id == null) { - if (other.id != null) + if (other.id != null) { return false; - } else if (!id.equals(other.id)) + } + } else if (!id.equals(other.id)) { return false; + } return true; } @@ -110,18 +115,23 @@ public class ZooUidProviderTest { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } UUIDId other = (UUIDId) obj; if (id == null) { - if (other.id != null) + if (other.id != null) { return false; - } else if (!id.equals(other.id)) + } + } else if (!id.equals(other.id)) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/base/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java ---------------------------------------------------------------------- diff --git a/mailet/base/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java b/mailet/base/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java index d172948..d8e8141 100644 --- a/mailet/base/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java +++ b/mailet/base/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java @@ -81,36 +81,53 @@ public final class FlowedMessageUtils { if (line != null && line.length() > 0) { if (line.equals(RFC2646_SIGNATURE)) // signature handling (the previous line is not flowed) + { resultLineFlowed = false; - - else if (line.charAt(0) == RFC2646_QUOTE) { + } else if (line.charAt(0) == RFC2646_QUOTE) { // Quote actualQuoteDepth = 1; - while (actualQuoteDepth < line.length() && line.charAt(actualQuoteDepth) == RFC2646_QUOTE) actualQuoteDepth++; + while (actualQuoteDepth < line.length() && line.charAt(actualQuoteDepth) == RFC2646_QUOTE) { + actualQuoteDepth++; + } // if quote-depth changes wrt the previous line then this is not flowed - if (resultLineQuoteDepth != actualQuoteDepth) resultLineFlowed = false; + if (resultLineQuoteDepth != actualQuoteDepth) { + resultLineFlowed = false; + } line = line.substring(actualQuoteDepth); } else { // id quote-depth changes wrt the first line then this is not flowed - if (resultLineQuoteDepth > 0) resultLineFlowed = false; + if (resultLineQuoteDepth > 0) { + resultLineFlowed = false; + } } if (line.length() > 0 && line.charAt(0) == RFC2646_SPACE) // Line space-stuffed + { line = line.substring(1); + } // if the previous was the last then it was not flowed - } else if (line == null) resultLineFlowed = false; + } else if (line == null) { + resultLineFlowed = false; + } // Add the PREVIOUS line. // This often will find the flow looking for a space as the last char of the line. // With quote changes or signatures it could be the followinf line to void the flow. if (!resultLineFlowed && i > 0) { - if (resultLineQuoteDepth > 0) resultLine.insert(0, RFC2646_SPACE); - for (int j = 0; j < resultLineQuoteDepth; j++) resultLine.insert(0, RFC2646_QUOTE); - if (result == null) result = new StringBuffer(); - else result.append(RFC2646_CRLF); + if (resultLineQuoteDepth > 0) { + resultLine.insert(0, RFC2646_SPACE); + } + for (int j = 0; j < resultLineQuoteDepth; j++) { + resultLine.insert(0, RFC2646_QUOTE); + } + if (result == null) { + result = new StringBuffer(); + } else { + result.append(RFC2646_CRLF); + } result.append(resultLine.toString()); resultLine = new StringBuffer(); resultLineFlowed = false; @@ -120,11 +137,15 @@ public final class FlowedMessageUtils { if (line != null) { if (!line.equals(RFC2646_SIGNATURE) && line.endsWith("" + RFC2646_SPACE) && i < lines.length - 1) { // Line flowed (NOTE: for the split operation the line having i == lines.length is the last that does not end with RFC2646_CRLF) - if (delSp) line = line.substring(0, line.length() - 1); + if (delSp) { + line = line.substring(0, line.length() - 1); + } resultLineFlowed = true; } - else resultLineFlowed = false; + else { + resultLineFlowed = false; + } resultLine.append(line); } @@ -143,9 +164,11 @@ public final class FlowedMessageUtils { String delSp = ct.getParameter("delsp"); return deflow((String) m.getContent(), delSp != null && delSp.equalsIgnoreCase("yes")); - } else if (ct.getPrimaryType().equals("text")) return (String) m.getContent(); - - else return null; + } else if (ct.getPrimaryType().equals("text")) { + return (String) m.getContent(); + } else { + return null; + } } /** @@ -190,10 +213,15 @@ public final class FlowedMessageUtils { boolean notempty = line.length() > 0; int quoteDepth = 0; - while (quoteDepth < line.length() && line.charAt(quoteDepth) == RFC2646_QUOTE) quoteDepth++; + while (quoteDepth < line.length() && line.charAt(quoteDepth) == RFC2646_QUOTE) { + quoteDepth++; + } if (quoteDepth > 0) { - if (quoteDepth + 1 < line.length() && line.charAt(quoteDepth) == RFC2646_SPACE) line = line.substring(quoteDepth + 1); - else line = line.substring(quoteDepth); + if (quoteDepth + 1 < line.length() && line.charAt(quoteDepth) == RFC2646_SPACE) { + line = line.substring(quoteDepth + 1); + } else { + line = line.substring(quoteDepth); + } } while (notempty) { @@ -205,24 +233,33 @@ public final class FlowedMessageUtils { } } else { line = RFC2646_SPACE + line; - for (int j = 0; j < quoteDepth; j++) line = "" + RFC2646_QUOTE + line; + for (int j = 0; j < quoteDepth; j++) { + line = "" + RFC2646_QUOTE + line; + } extra = quoteDepth + 1; } int j = width - 1; - if (j >= line.length()) j = line.length() - 1; - else { - while (j >= extra && ((delSp && isAlphaChar(text, j)) || (!delSp && line.charAt(j) != RFC2646_SPACE))) j--; + if (j >= line.length()) { + j = line.length() - 1; + } else { + while (j >= extra && ((delSp && isAlphaChar(text, j)) || (!delSp && line.charAt(j) != RFC2646_SPACE))) { + j--; + } if (j < extra) { // Not able to cut a word: skip to word end even if greater than the max width j = width - 1; - while (j < line.length() - 1 && ((delSp && isAlphaChar(text, j)) || (!delSp && line.charAt(j) != RFC2646_SPACE))) j++; + while (j < line.length() - 1 && ((delSp && isAlphaChar(text, j)) || (!delSp && line.charAt(j) != RFC2646_SPACE))) { + j++; + } } } result.append(line.substring(0, j + 1)); if (j < line.length() - 1) { - if (delSp) result.append(RFC2646_SPACE); + if (delSp) { + result.append(RFC2646_SPACE); + } result.append(RFC2646_CRLF); } @@ -233,7 +270,9 @@ public final class FlowedMessageUtils { if (i < lines.length - 1) { // NOTE: Have to trim the spaces before, otherwise it won't recognize soft-break from hard break. // Deflow of flowed message will not be identical to the original. - while (result.length() > 0 && result.charAt(result.length() - 1) == RFC2646_SPACE) result.deleteCharAt(result.length() - 1); + while (result.length() > 0 && result.charAt(result.length() - 1) == RFC2646_SPACE) { + result.deleteCharAt(result.length() - 1); + } result.append(RFC2646_CRLF); } } @@ -260,9 +299,13 @@ public final class FlowedMessageUtils { ContentType ct = new ContentType(); ct.setPrimaryType("text"); ct.setSubType("plain"); - if (charset != null) ct.setParameter("charset", charset); + if (charset != null) { + ct.setParameter("charset", charset); + } ct.setParameter("format", "flowed"); - if (delSp) ct.setParameter("delsp", "yes"); + if (delSp) { + ct.setParameter("delsp", "yes"); + } m.setContent(coded, ct.toString()); m.saveChanges(); } @@ -279,12 +322,16 @@ public final class FlowedMessageUtils { */ public static void flowMessage(Message m, boolean delSp, int width) throws MessagingException, IOException { ContentType ct = new ContentType(m.getContentType()); - if (!ct.getBaseType().equals("text/plain")) return; + if (!ct.getBaseType().equals("text/plain")) { + return; + } String format = ct.getParameter("format"); String text = format != null && format.equals("flowed") ? deflow(m) : (String) m.getContent(); String coded = flow(text, delSp, width); ct.setParameter("format", "flowed"); - if (delSp) ct.setParameter("delsp", "yes"); + if (delSp) { + ct.setParameter("delsp", "yes"); + } m.setContent(coded, ct.toString()); m.saveChanges(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java ---------------------------------------------------------------------- diff --git a/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java b/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java index d67927c..db619e5 100644 --- a/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java +++ b/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java @@ -53,11 +53,14 @@ public final class StringUtils { // When the number of trailing "\" is odd then there was no separator and this pattern is part of // the previous match. int depth = 1; - while (depth < array[i-1].length() && array[i-1].charAt(array[i-1].length() - 1 - depth) == '\\') depth++; + while (depth < array[i-1].length() && array[i-1].charAt(array[i-1].length() - 1 - depth) == '\\') { + depth++; + } escaped = depth % 2 == 1; } - if (!escaped) list.add(array[i]); - else { + if (!escaped) { + list.add(array[i]); + } else { String prev = list.remove(list.size() - 1); list.add(prev.substring(0, prev.length() - 1) + pattern + array[i]); } @@ -97,16 +100,23 @@ public final class StringUtils { * or null when the text is null */ public static String capitalizeWords(String data) { - if (data==null) return null; + if (data==null) { + return null; + } StringBuilder res = new StringBuilder(); char ch; char prevCh = '.'; for (int i = 0; i < data.length(); i++) { ch = data.charAt(i); if (Character.isLetter(ch)) { - if (!Character.isLetter(prevCh)) res.append(Character.toUpperCase(ch)); - else res.append(Character.toLowerCase(ch)); - } else res.append(ch); + if (!Character.isLetter(prevCh)) { + res.append(Character.toUpperCase(ch)); + } else { + res.append(Character.toLowerCase(ch)); + } + } else { + res.append(ch); + } prevCh = ch; } return res.toString(); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/base/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java ---------------------------------------------------------------------- diff --git a/mailet/base/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java b/mailet/base/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java index 5d27c99..c9a645b 100644 --- a/mailet/base/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java +++ b/mailet/base/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java @@ -102,8 +102,9 @@ public abstract class AbstractDataContentHandler implements DataContentHandler throws UnsupportedFlavorException, IOException { Object content = null; - if (getDataFlavor().equals(aDataFlavor)) + if (getDataFlavor().equals(aDataFlavor)) { content = getContent(aDataSource); + } return content; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/base/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java ---------------------------------------------------------------------- diff --git a/mailet/base/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java b/mailet/base/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java index 8489593..42a2715 100644 --- a/mailet/base/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java +++ b/mailet/base/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java @@ -80,8 +80,9 @@ public class message_disposition_notification { reader = new BufferedReader(new InputStreamReader(aDataSource .getInputStream(), encoding), 2048); - while (reader.ready()) + while (reader.ready()) { writer.write(reader.read()); + } writer.flush(); content = writer.toString(); } @@ -125,9 +126,10 @@ public class message_disposition_notification public void writeTo(Object aPart, String aMimeType, OutputStream aStream) throws IOException { - if (!(aPart instanceof String)) + if (!(aPart instanceof String)) { throw new IOException("Type \"" + aPart.getClass().getName() - + "\" is not supported."); + + "\" is not supported."); + } String encoding = getCharacterSet(getDataFlavor().getMimeType()); Writer writer; @@ -157,8 +159,9 @@ public class message_disposition_notification } finally { - if (null == characterSet) + if (null == characterSet) { characterSet = "us-ascii"; + } } return MimeUtility.javaCharset(characterSet); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/base/src/main/java/org/apache/mailet/base/mail/multipart_report.java ---------------------------------------------------------------------- diff --git a/mailet/base/src/main/java/org/apache/mailet/base/mail/multipart_report.java b/mailet/base/src/main/java/org/apache/mailet/base/mail/multipart_report.java index 79e14b0..2daed88 100644 --- a/mailet/base/src/main/java/org/apache/mailet/base/mail/multipart_report.java +++ b/mailet/base/src/main/java/org/apache/mailet/base/mail/multipart_report.java @@ -60,9 +60,10 @@ public class multipart_report extends AbstractDataContentHandler public void writeTo(Object aPart, String aMimeType, OutputStream aStream) throws IOException { - if (!(aPart instanceof MimeMultipartReport)) + if (!(aPart instanceof MimeMultipartReport)) { throw new IOException("Type \"" + aPart.getClass().getName() - + "\" is not supported."); + + "\" is not supported."); + } try { ((MimeMultipartReport) aPart).writeTo(aStream); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/crypto/src/main/java/org/apache/james/transport/KeyStoreHolder.java ---------------------------------------------------------------------- diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/KeyStoreHolder.java b/mailet/crypto/src/main/java/org/apache/james/transport/KeyStoreHolder.java index 236dbc3..57481f6 100644 --- a/mailet/crypto/src/main/java/org/apache/james/transport/KeyStoreHolder.java +++ b/mailet/crypto/src/main/java/org/apache/james/transport/KeyStoreHolder.java @@ -83,7 +83,9 @@ public class KeyStoreHolder { public KeyStoreHolder(String keyStoreFileName, String keyStorePassword, String keyStoreType) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, NoSuchProviderException, IOException { - if (keyStorePassword == null) keyStorePassword = ""; + if (keyStorePassword == null) { + keyStorePassword = ""; + } try { InitJCE.init(); @@ -99,7 +101,9 @@ public class KeyStoreHolder { keyStore = KeyStore.getInstance(keyStoreType); keyStore.load(new BufferedInputStream(new FileInputStream(keyStoreFileName)), keyStorePassword.toCharArray()); - if (keyStore.size() == 0) throw new KeyStoreException("The keystore must be not empty"); + if (keyStore.size() == 0) { + throw new KeyStoreException("The keystore must be not empty"); + } } /** http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java ---------------------------------------------------------------------- diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java index 6ce9a51..226004d 100644 --- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java +++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java @@ -120,13 +120,19 @@ public class SMIMECheckSignature extends GenericMailet { MailetConfig config = getMailetConfig(); String stripSignatureConf = config.getInitParameter("strip"); - if (stripSignatureConf != null) stripSignature = Boolean.valueOf(stripSignatureConf); + if (stripSignatureConf != null) { + stripSignature = Boolean.valueOf(stripSignatureConf); + } String onlyTrustedConf = config.getInitParameter("onlyTrusted"); - if (onlyTrustedConf != null) onlyTrusted = Boolean.valueOf(onlyTrustedConf); + if (onlyTrustedConf != null) { + onlyTrusted = Boolean.valueOf(onlyTrustedConf); + } String mailAttributeConf = config.getInitParameter("mailAttribute"); - if (mailAttributeConf != null) mailAttribute = mailAttributeConf; + if (mailAttributeConf != null) { + mailAttribute = mailAttributeConf; + } String type = config.getInitParameter("keyStoreType"); @@ -134,8 +140,9 @@ public class SMIMECheckSignature extends GenericMailet { String password = config.getInitParameter("keyStorePassword"); try { - if (file != null) trustedCertificateStore = new KeyStoreHolder(file, password, type); - else { + if (file != null) { + trustedCertificateStore = new KeyStoreHolder(file, password, type); + } else { LOGGER.info("No trusted store path specified, using default store."); trustedCertificateStore = new KeyStoreHolder(password); } @@ -161,15 +168,22 @@ public class SMIMECheckSignature extends GenericMailet { try { Object obj = message.getContent(); SMIMESigned signed; - if (obj instanceof MimeMultipart) signed = new SMIMESigned((MimeMultipart)message.getContent()); - else if (obj instanceof SMIMESigned) signed = (SMIMESigned) obj; - else if (obj instanceof byte[]) signed = new SMIMESigned(message); - else signed = null; + if (obj instanceof MimeMultipart) { + signed = new SMIMESigned((MimeMultipart) message.getContent()); + } else if (obj instanceof SMIMESigned) { + signed = (SMIMESigned) obj; + } else if (obj instanceof byte[]) { + signed = new SMIMESigned(message); + } else { + signed = null; + } if (signed != null) { signers = trustedCertificateStore.verifySignatures(signed); strippedMessage = signed.getContent(); - } else LOGGER.info("Content not identified as signed"); + } else { + LOGGER.info("Content not identified as signed"); + } // These errors are logged but they don't cause the // message to change its state. The message http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java ---------------------------------------------------------------------- diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java index 863b76c..db368d0 100644 --- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java +++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java @@ -89,7 +89,9 @@ public class SMIMEDecrypt extends GenericMailet { String privateStoreType = config.getInitParameter("keyStoreType"); String privateStoreFile = config.getInitParameter("keyStoreFileName"); - if (privateStoreFile == null) throw new MessagingException("No keyStoreFileName specified"); + if (privateStoreFile == null) { + throw new MessagingException("No keyStoreFileName specified"); + } String privateStorePass = config.getInitParameter("keyStorePassword"); @@ -97,7 +99,9 @@ public class SMIMEDecrypt extends GenericMailet { String keyPass = config.getInitParameter("keyAliasPassword"); String mailAttributeConf = config.getInitParameter("mailAttribute"); - if (mailAttributeConf != null) mailAttribute = mailAttributeConf; + if (mailAttributeConf != null) { + mailAttribute = mailAttributeConf; + } try { keyHolder = new SMIMEKeyHolder(privateStoreFile, privateStorePass, keyAlias, keyPass, privateStoreType); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMEEncrypted.java ---------------------------------------------------------------------- diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMEEncrypted.java b/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMEEncrypted.java index 1646361..f65344b 100644 --- a/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMEEncrypted.java +++ b/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMEEncrypted.java @@ -39,15 +39,21 @@ public class IsSMIMEEncrypted extends GenericMatcher { * @see org.apache.mailet.Matcher#match(org.apache.mailet.Mail) */ public Collection<MailAddress> match(Mail mail) throws MessagingException { - if (mail == null) return null; + if (mail == null) { + return null; + } MimeMessage message = mail.getMessage(); - if (message == null) return null; + if (message == null) { + return null; + } if ((message.isMimeType("application/x-pkcs7-mime") || message.isMimeType("application/pkcs7-mime")) && (message.getContentType().contains("smime-type=enveloped-data"))) { return mail.getRecipients(); - } else return null; + } else { + return null; + } } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMESigned.java ---------------------------------------------------------------------- diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMESigned.java b/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMESigned.java index 88ab165..5fd99a0 100644 --- a/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMESigned.java +++ b/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsSMIMESigned.java @@ -39,10 +39,14 @@ public class IsSMIMESigned extends GenericMatcher { * @see org.apache.mailet.Matcher#match(org.apache.mailet.Mail) */ public Collection<MailAddress> match(Mail mail) throws MessagingException { - if (mail == null) return null; + if (mail == null) { + return null; + } MimeMessage message = mail.getMessage(); - if (message == null) return null; + if (message == null) { + return null; + } if (message.isMimeType("multipart/signed") @@ -51,6 +55,8 @@ public class IsSMIMESigned extends GenericMatcher { || ((message.isMimeType("application/pkcs7-mime") || message.isMimeType("application/x-pkcs7-mime")) && message.getContentType().contains("signed-data"))) { return mail.getRecipients(); - } else return null; + } else { + return null; + } } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsX509CertificateSubject.java ---------------------------------------------------------------------- diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsX509CertificateSubject.java b/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsX509CertificateSubject.java index 30f920d..cb5c393 100644 --- a/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsX509CertificateSubject.java +++ b/mailet/crypto/src/main/java/org/apache/james/transport/matcher/IsX509CertificateSubject.java @@ -54,8 +54,9 @@ public class IsX509CertificateSubject extends GenericMatcher { public void init() throws MessagingException { String condition = getCondition(); - if(condition == null || !condition.contains(";")) - throw new MessagingException("Invalid matcher configuration: "+condition); + if(condition == null || !condition.contains(";")) { + throw new MessagingException("Invalid matcher configuration: " + condition); + } int pos = condition.indexOf(";"); sourceAttribute = condition.substring(0,pos).trim(); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/mailets/OnlyText.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/OnlyText.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/OnlyText.java index 4f8f2fd..20cfb43 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/OnlyText.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/OnlyText.java @@ -79,13 +79,11 @@ public class OnlyText extends GenericMailet { if (mp.getBodyPart(i).isMimeType("text/plain")) { setContentFromPart(mail.getMessage(), mp.getBodyPart(i), null, false); found = 1; - } else if (htmlPart == -1 && mp.getBodyPart(i).isMimeType("text/html")) + } else if (htmlPart == -1 && mp.getBodyPart(i).isMimeType("text/html")) { htmlPart = i; - - else if (stringPart == -1 && content instanceof String) + } else if (stringPart == -1 && content instanceof String) { stringPart = i; - - else if (content instanceof Multipart) { + } else if (content instanceof Multipart) { int[] res = process(mail, (Multipart) content, found, htmlPart, stringPart); found = res[0]; htmlPart = res[1]; @@ -123,12 +121,13 @@ public class OnlyText extends GenericMailet { } - if (found < 0 && optionsNotextProcessor != null) mail.setState(optionsNotextProcessor); + if (found < 0 && optionsNotextProcessor != null) { + mail.setState(optionsNotextProcessor); + } - } else if (!(content instanceof String) && optionsNotextProcessor != null) + } else if (!(content instanceof String) && optionsNotextProcessor != null) { mail.setState(optionsNotextProcessor); - - else if (mail.getMessage().isMimeType("text/html")) { + } else if (mail.getMessage().isMimeType("text/html")) { setContentFromPart(mail.getMessage(), mail.getMessage(), html2Text((String) mail.getMessage().getContent()), true); } @@ -147,7 +146,9 @@ public class OnlyText extends GenericMailet { } m.setContent(newText != null ? newText : p.getContent(), contentType); String[] h = p.getHeader("Content-Transfer-Encoding"); - if (h != null && h.length > 0) m.setHeader("Content-Transfer-Encoding", h[0]); + if (h != null && h.length > 0) { + m.setHeader("Content-Transfer-Encoding", h[0]); + } m.saveChanges(); } @@ -167,22 +168,35 @@ public class OnlyText extends GenericMailet { for (int i = 0; i < data.length(); i++) { char c = data.charAt(i); - if (c == '&' && lastAmp == -1) lastAmp = buffer.length(); - else if (c == ';' && (lastAmp > -1)) { // && (lastAmp > (buffer.length() - 7))) { // max: &#xxxx; - if (charMap.containsKey(buffer.toString())) res.append(charMap.get(buffer.toString())); - else res.append("&").append(buffer.toString()).append(";"); + if (c == '&' && lastAmp == -1) { + lastAmp = buffer.length(); + } else if (c == ';' && (lastAmp > -1)) { // && (lastAmp > (buffer.length() - 7))) { // max: &#xxxx; + if (charMap.containsKey(buffer.toString())) { + res.append(charMap.get(buffer.toString())); + } else { + res.append("&").append(buffer.toString()).append(";"); + } lastAmp = -1; buffer = new StringBuffer(); - } else if (lastAmp == -1) res.append(c); - else buffer.append(c); + } else if (lastAmp == -1) { + res.append(c); + } else { + buffer.append(c); + } } return res.toString(); } private void initEntityTable() { - for (int index = 11; index < 32; index++) charMap.put("#0" + index, String.valueOf((char) index)); - for (int index = 32; index < 128; index++) charMap.put("#" + index, String.valueOf((char) index)); - for (int index = 128; index < 256; index++) charMap.put("#" + index, String.valueOf((char) index)); + for (int index = 11; index < 32; index++) { + charMap.put("#0" + index, String.valueOf((char) index)); + } + for (int index = 32; index < 128; index++) { + charMap.put("#" + index, String.valueOf((char) index)); + } + for (int index = 128; index < 256; index++) { + charMap.put("#" + index, String.valueOf((char) index)); + } // A complete reference is here: // http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/mailets/UnwrapText.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/UnwrapText.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/UnwrapText.java index e35a9d5..2dcc6cc 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/UnwrapText.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/UnwrapText.java @@ -76,10 +76,9 @@ public class UnwrapText extends GenericMailet { try { // TODO replace non standard quotes (at least "> " with ">", otherwise the widely used "> > >" will not work. - if (FlowedMessageUtils.isFlowedTextMessage(mail.getMessage())) + if (FlowedMessageUtils.isFlowedTextMessage(mail.getMessage())) { FlowedMessageUtils.deflowMessage(mail.getMessage()); - - else { + } else { Object o = mail.getMessage().getContent(); if (o instanceof String) { String unwrapped = unwrap((String) o, quotewidth); @@ -109,20 +108,30 @@ public class UnwrapText extends GenericMailet { int width = 0; for (int i = 0; i < lines.length - 1; i++) { String l = lines[i].trim(); - if (l.length() > width) width = l.length(); + if (l.length() > width) { + width = l.length(); + } } - if (width < 40) return text; - if (qwidth < 0) qwidth = width - qwidth; + if (width < 40) { + return text; + } + if (qwidth < 0) { + qwidth = width - qwidth; + } StringBuilder result = new StringBuilder(); int prevWrapped = 0; for (int i = 0; i < lines.length; i++) { if (prevWrapped != 0) { if (prevWrapped > 0) { - if (result.charAt(result.length() - 1) != ' ') result.append(" "); + if (result.charAt(result.length() - 1) != ' ') { + result.append(" "); + } + } + else { + result.append("\r\n"); } - else result.append("\r\n"); } String l = lines[i]; Matcher m1 = p1.matcher(l); @@ -139,23 +148,32 @@ public class UnwrapText extends GenericMailet { )) { if (b) { - if (prevWrapped > 0 && m1.groupCount() >= 2) result.append(m1.group(2)); - else result.append(l); + if (prevWrapped > 0 && m1.groupCount() >= 2) { + result.append(m1.group(2)); + } else { + result.append(l); + } prevWrapped = 1; } else { lines[i + 1] = l + (l.charAt(l.length() - 1) != ' ' ? " " : "") + m2.group(2).trim(); // Revert the previous append if (prevWrapped != 0) { - if (prevWrapped > 0) result.deleteCharAt(result.length() - 1); - else result.delete(result.length() - 2, result.length()); + if (prevWrapped > 0) { + result.deleteCharAt(result.length() - 1); + } else { + result.delete(result.length() - 2, result.length()); + } } } } else { Matcher m3 = p2.matcher(l); - if (prevWrapped > 0 && m3.matches()) result.append(m3.group(2)); - else result.append(lines[i]); + if (prevWrapped > 0 && m3.matches()) { + result.append(m3.group(2)); + } else { + result.append(lines[i]); + } prevWrapped = -1; } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java index e103c10..f120f3f 100755 --- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java @@ -79,7 +79,9 @@ public abstract class AbstractQuotaMatcher extends GenericMatcher { protected boolean isOverQuota(MailAddress address, Mail mail) { try { boolean over = getQuota(address, mail) < getUsed(address, mail); - if (over) LOGGER.info("{} is over quota.", address); + if (over) { + LOGGER.info("{} is over quota.", address); + } return over; } catch (Throwable e) { LOGGER.error("Exception checking quota for: {}", address, e); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/matchers/FileRegexMatcher.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/FileRegexMatcher.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/FileRegexMatcher.java index 4a24139..1751900 100755 --- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/FileRegexMatcher.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/FileRegexMatcher.java @@ -43,7 +43,9 @@ public class FileRegexMatcher extends GenericRegexMatcher { try { patternSource = new java.io.RandomAccessFile(getCondition(), "r"); int lines = 0; - while(patternSource.readLine() != null) lines++; + while(patternSource.readLine() != null) { + lines++; + } patterns = new Object[lines][2]; patternSource.seek(0); for (int i = 0; i < lines; i++) { http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java index ff100aa..6844963 100755 --- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java @@ -68,17 +68,21 @@ public abstract class GenericRegexMatcher extends GenericMatcher { MimeMessage message = mail.getMessage(); //Loop through all the patterns - if (patterns != null) for (Object[] pattern1 : patterns) { - //Get the header name - String headerName = (String) pattern1[0]; - //Get the patterns for that header - Pattern pattern = (Pattern) pattern1[1]; - //Get the array of header values that match that - String headers[] = message.getHeader(headerName); - //Loop through the header values - if (headers != null) for (String header : headers) { - if (pattern.matcher(header).matches()) { - return mail.getRecipients(); + if (patterns != null) { + for (Object[] pattern1 : patterns) { + //Get the header name + String headerName = (String) pattern1[0]; + //Get the patterns for that header + Pattern pattern = (Pattern) pattern1[1]; + //Get the array of header values that match that + String headers[] = message.getHeader(headerName); + //Loop through the header values + if (headers != null) { + for (String header : headers) { + if (pattern.matcher(header).matches()) { + return mail.getRecipients(); + } + } } } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java index 5fe6939..e203f83 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java @@ -93,7 +93,7 @@ public class HasHabeasWarrantMark extends GenericMatcher MimeMessage message = mail.getMessage(); //Loop through all the patterns - for (String[] aWarrantMark : warrantMark) + for (String[] aWarrantMark : warrantMark) { try { String headerName = aWarrantMark[0]; //Get the header name String requiredValue = aWarrantMark[1]; //Get the required value @@ -105,11 +105,14 @@ public class HasHabeasWarrantMark extends GenericMatcher // others if they want to detect and report potentially // forged headers. - if (!(requiredValue.equals(headerValue))) return null; + if (!(requiredValue.equals(headerValue))) { + return null; + } } catch (Exception e) { LOGGER.info("Caught an exception while reading message", e); return null; //if we get an exception, don't validate the mark } + } // If we get here, all headers are present and match. return mail.getRecipients(); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValue.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValue.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValue.java index 4a02a35..3e82edb 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValue.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMailAttributeWithValue.java @@ -90,8 +90,9 @@ public class HasMailAttributeWithValue extends GenericMatcher Object attributeValue = mail.getAttribute(getAttributeName()); if (attributeValue != null - && attributeValue.toString().trim().equals(getAttributeValue())) + && attributeValue.toString().trim().equals(getAttributeValue())) { return mail.getRecipients(); + } return null; } @@ -140,11 +141,13 @@ public class HasMailAttributeWithValue extends GenericMatcher String condition = getCondition().trim(); int commaPosition = condition.indexOf(','); - if (-1 == commaPosition) + if (-1 == commaPosition) { throw new MessagingException("Syntax Error. Missing ','."); + } - if (0 == commaPosition) + if (0 == commaPosition) { throw new MessagingException("Syntax Error. Missing attribute name."); + } setAttributeName(condition.substring(0, commaPosition).trim()); setAttributeValue(condition.substring(commaPosition + 1).trim()); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java ---------------------------------------------------------------------- diff --git a/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java b/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java index f431a29..6292abc 100644 --- a/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java +++ b/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java @@ -1192,10 +1192,12 @@ public class ScriptBuilder { } else { inBuffer.compact(); int i = 0; - while ((i = source.read(inBuffer)) == 0) + while ((i = source.read(inBuffer)) == 0) { ; - if (i == -1) + } + if (i == -1) { throw new RuntimeException("Unexpected EOF"); + } inBuffer.flip(); result = next(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mpt/core/src/main/java/org/apache/james/mpt/protocol/FileProtocolSessionBuilder.java ---------------------------------------------------------------------- diff --git a/mpt/core/src/main/java/org/apache/james/mpt/protocol/FileProtocolSessionBuilder.java b/mpt/core/src/main/java/org/apache/james/mpt/protocol/FileProtocolSessionBuilder.java index f9e94fd..6b3c678 100644 --- a/mpt/core/src/main/java/org/apache/james/mpt/protocol/FileProtocolSessionBuilder.java +++ b/mpt/core/src/main/java/org/apache/james/mpt/protocol/FileProtocolSessionBuilder.java @@ -149,9 +149,10 @@ public class FileProtocolSessionBuilder extends ProtocolSessionBuilder { List<String> unorderedLines = new ArrayList<>(5); next = reader.readLine(); - if (next == null) + if (next == null) { throw new Exception("Readline doesn't contain any data, but must not be 'null' (linenumber=" - + lineNumber); + + lineNumber); + } while (!next.startsWith(CLOSE_UNORDERED_BLOCK_TAG)) { if (!next.startsWith(SERVER_TAG)) { @@ -162,10 +163,11 @@ public class FileProtocolSessionBuilder extends ProtocolSessionBuilder { next = reader.readLine(); lineNumber++; - if (next == null) + if (next == null) { throw new Exception( - "Readline doesn't contain any data, but must not be 'null' (linenumber=" - + lineNumber); + "Readline doesn't contain any data, but must not be 'null' (linenumber=" + + lineNumber); + } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java ---------------------------------------------------------------------- diff --git a/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java b/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java index 0edd5e4..6d30902 100644 --- a/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java +++ b/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java @@ -85,8 +85,9 @@ public final class ExternalSession implements Session { private void readlineInto(StringBuffer buffer) throws Exception { monitor.debug("[Reading line]"); readBuffer.flip(); - while (oneFromLine(buffer)) + while (oneFromLine(buffer)) { ; + } // May have partial read readBuffer.compact(); monitor.debug("[Done]"); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java b/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java index f8eda22..f1fb1b7 100644 --- a/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java +++ b/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java @@ -153,7 +153,9 @@ public class JCRHostSystem extends JamesImapHostSystem { private void delete(File home) throws Exception{ if (home.exists()) { File[] files = home.listFiles(); - if (files == null) return; + if (files == null) { + return; + } for (File f : files) { if (f.isDirectory()) { delete(f); http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/api/src/main/java/org/apache/james/protocols/api/AbstractResponse.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/AbstractResponse.java b/protocols/api/src/main/java/org/apache/james/protocols/api/AbstractResponse.java index 81706ea..b3b354d 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/AbstractResponse.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/AbstractResponse.java @@ -46,7 +46,9 @@ public abstract class AbstractResponse implements Response{ * @param description the description */ public AbstractResponse(String code, CharSequence description) { - if (code == null) throw new IllegalArgumentException("code can not be null"); + if (code == null) { + throw new IllegalArgumentException("code can not be null"); + } this.setRetCode(code); this.appendLine(description); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java b/protocols/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java index d126f2e..b5ec81c 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java @@ -236,25 +236,33 @@ public class HumanReadableText { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final HumanReadableText other = (HumanReadableText) obj; if (defaultValue == null) { - if (other.defaultValue != null) + if (other.defaultValue != null) { return false; - } else if (!defaultValue.equals(other.defaultValue)) + } + } else if (!defaultValue.equals(other.defaultValue)) { return false; + } if (key == null) { - if (other.key != null) + if (other.key != null) { return false; - } else if (!key.equals(other.key)) + } + } else if (!key.equals(other.key)) { return false; - if (!Arrays.equals(parameters, other.parameters)) + } + if (!Arrays.equals(parameters, other.parameters)) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/api/message/BodyFetchElement.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/BodyFetchElement.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/BodyFetchElement.java index ea173de..fe7531b 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/BodyFetchElement.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/BodyFetchElement.java @@ -144,37 +144,50 @@ public class BodyFetchElement { } public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final BodyFetchElement other = (BodyFetchElement) obj; if (fieldNames == null) { - if (other.fieldNames != null) + if (other.fieldNames != null) { return false; - } else if (!fieldNames.equals(other.fieldNames)) + } + } else if (!fieldNames.equals(other.fieldNames)) { return false; + } if (firstOctet == null) { - if (other.firstOctet != null) + if (other.firstOctet != null) { return false; - } else if (!firstOctet.equals(other.firstOctet)) + } + } else if (!firstOctet.equals(other.firstOctet)) { return false; + } if (name == null) { - if (other.name != null) + if (other.name != null) { return false; - } else if (!name.equals(other.name)) + } + } else if (!name.equals(other.name)) { return false; + } if (numberOfOctets == null) { - if (other.numberOfOctets != null) + if (other.numberOfOctets != null) { return false; - } else if (!numberOfOctets.equals(other.numberOfOctets)) + } + } else if (!numberOfOctets.equals(other.numberOfOctets)) { return false; - if (!Arrays.equals(path, other.path)) + } + if (!Arrays.equals(path, other.path)) { return false; - if (sectionType != other.sectionType) + } + if (sectionType != other.sectionType) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java index d25f576..7e836b7 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java @@ -175,36 +175,50 @@ public class FetchData { } public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final FetchData other = (FetchData) obj; - if (body != other.body) + if (body != other.body) { return false; + } if (bodyElements == null) { - if (other.bodyElements != null) + if (other.bodyElements != null) { return false; - } else if (!bodyElements.equals(other.bodyElements)) + } + } else if (!bodyElements.equals(other.bodyElements)) { return false; - if (bodyStructure != other.bodyStructure) + } + if (bodyStructure != other.bodyStructure) { return false; - if (envelope != other.envelope) + } + if (envelope != other.envelope) { return false; - if (flags != other.flags) + } + if (flags != other.flags) { return false; - if (internalDate != other.internalDate) + } + if (internalDate != other.internalDate) { return false; - if (setSeen != other.setSeen) + } + if (setSeen != other.setSeen) { return false; - if (size != other.size) + } + if (size != other.size) { return false; - if (uid != other.uid) + } + if (uid != other.uid) { return false; - if (modSeq != other.modSeq) + } + if (modSeq != other.modSeq) { return false; + } if (changedSince != other.changedSince) { return false; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java index 23aee17..8185cad 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java @@ -49,8 +49,9 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange>{ } public IdRange(long lowVal, long highVal) { - if (lowVal > highVal) + if (lowVal > highVal) { throw new IllegalArgumentException("LowVal must be <= HighVal"); + } _lowVal = lowVal; _highVal = highVal; } @@ -64,14 +65,16 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange>{ } public void setLowVal(long lowVal) { - if (lowVal > _highVal) + if (lowVal > _highVal) { throw new IllegalArgumentException("LowVal must be <= HighVal"); + } _lowVal = lowVal; } public void setHighVal(long highVal) { - if (_lowVal > highVal) + if (_lowVal > highVal) { throw new IllegalArgumentException("HighVal must be >= LowVal"); + } _highVal = highVal; } @@ -100,17 +103,22 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange>{ * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final IdRange other = (IdRange) obj; - if (_highVal != other._highVal) + if (_highVal != other._highVal) { return false; - if (_lowVal != other._lowVal) + } + if (_lowVal != other._lowVal) { return false; + } return true; } @@ -124,10 +132,11 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange>{ } public String getFormattedString() { - if (this._lowVal == this._highVal) + if (this._lowVal == this._highVal) { return Long.toString(this._lowVal); - else + } else { return this._lowVal + ":" + this._highVal; + } } /** http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/api/message/request/DayMonthYear.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/request/DayMonthYear.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/request/DayMonthYear.java index c9e9242..9a0c44d 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/request/DayMonthYear.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/request/DayMonthYear.java @@ -104,19 +104,25 @@ public class DayMonthYear { * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final DayMonthYear other = (DayMonthYear) obj; - if (day != other.day) + if (day != other.day) { return false; - if (month != other.month) + } + if (month != other.month) { return false; - if (year != other.year) + } + if (year != other.year) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/api/message/response/StatusResponse.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/response/StatusResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/response/StatusResponse.java index 4741a3e..1e0e4dd 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/response/StatusResponse.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/response/StatusResponse.java @@ -162,8 +162,9 @@ public interface StatusResponse extends ImapResponseMessage { } private static String formatRanges(IdRange[] ranges) { - if (ranges == null || ranges.length == 0) + if (ranges == null || ranges.length == 0) { return "*"; + } StringBuilder rangeBuilder = new StringBuilder(); for (int i = 0; i < ranges.length; i++) { rangeBuilder.append(ranges[i].getFormattedString()); @@ -415,25 +416,33 @@ public interface StatusResponse extends ImapResponseMessage { } public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } final ResponseCode other = (ResponseCode) obj; if (code == null) { - if (other.code != null) + if (other.code != null) { return false; - } else if (!code.equals(other.code)) + } + } else if (!code.equals(other.code)) { return false; - if (number != other.number) + } + if (number != other.number) { return false; + } if (parameters == null) { - if (other.parameters != null) + if (other.parameters != null) { return false; - } else if (!parameters.equals(other.parameters)) + } + } else if (!parameters.equals(other.parameters)) { return false; + } return true; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java index 57503a0..8506248 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java @@ -379,8 +379,9 @@ public abstract class ImapRequestLineReader { in = consumeLiteral(false); byte[] buf = new byte[ 0xFFFF ]; - for (int len; (len = in.read(buf)) != -1; ) - out.write( buf, 0, len); + for (int len; (len = in.read(buf)) != -1; ) { + out.write(buf, 0, len); + } final byte[] bytes = out.toByteArray(); final ByteBuffer buffer = ByteBuffer.wrap(bytes); @@ -819,8 +820,9 @@ public abstract class ImapRequestLineReader { return Long.MAX_VALUE; } else { long number = Long.parseLong(value); - if (number < ImapConstants.MIN_NZ_NUMBER || number > ImapConstants.MAX_NZ_NUMBER) + if (number < ImapConstants.MIN_NZ_NUMBER || number > ImapConstants.MAX_NZ_NUMBER) { throw new DecodingException(HumanReadableText.INVALID_MESSAGESET, "Invalid message set. Numbers must be unsigned 32-bit Integers"); + } return number; } @@ -858,8 +860,9 @@ public abstract class ImapRequestLineReader { public static class TagCharValidator extends ATOM_CHARValidator { public boolean isValid(char chr) { - if (chr == '+') + if (chr == '+') { return false; + } return super.isValid(chr); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java index 90b6789..a8115f4 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/StatusResponseEncoder.java @@ -80,13 +80,15 @@ public class StatusResponseEncoder extends AbstractChainedImapEncoder { composer.message(number); } if (parameters != null && !parameters.isEmpty()) { - if (useParens) - composer.openParen(); + if (useParens) { + composer.openParen(); + } for (String parameter : parameters) { composer.message(parameter); } - if (useParens) - composer.closeParen(); + if (useParens) { + composer.closeParen(); + } } composer.closeSquareBracket(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/protocols/imap/src/main/java/org/apache/james/imap/message/request/AbstractMessageRangeRequest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/request/AbstractMessageRangeRequest.java b/protocols/imap/src/main/java/org/apache/james/imap/message/request/AbstractMessageRangeRequest.java index 21bbdd9..269c1ca 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/message/request/AbstractMessageRangeRequest.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/message/request/AbstractMessageRangeRequest.java @@ -54,7 +54,9 @@ public abstract class AbstractMessageRangeRequest extends AbstractImapRequest { @Override public boolean equals(Object o) { - if (o == null || getClass() != o.getClass()) return false; + if (o == null || getClass() != o.getClass()) { + return false; + } AbstractMessageRangeRequest that = (AbstractMessageRangeRequest) o; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
