JAMES-2277 tab to 4 spaces
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a61d975a Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a61d975a Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a61d975a Branch: refs/heads/master Commit: a61d975aa64a3fb19ec988f75ba2f722cee137e9 Parents: fe712f1 Author: Matthieu Baechler <[email protected]> Authored: Tue Dec 26 17:02:29 2017 +0100 Committer: Raphael Ouazana <[email protected]> Committed: Wed Jan 10 10:45:39 2018 +0100 ---------------------------------------------------------------------- .../james/mailbox/mock/MockMailboxSession.java | 6 +- .../caching/CacheLoaderFromUnderlying.java | 2 +- .../mailbox/caching/CachingMailboxMapper.java | 142 +++++------ .../CachingMailboxSessionMapperFactory.java | 28 +-- .../mailbox/caching/MailboxByPathCache.java | 16 +- .../mailbox/caching/MailboxMetadataCache.java | 24 +- .../caching/guava/AbstractGuavaCache.java | 12 +- .../caching/guava/GuavaCacheWrapper.java | 46 ++-- .../caching/guava/GuavaMailboxByPathCache.java | 136 +++++------ .../guava/GuavaMailboxMetadataCache.java | 244 +++++++++---------- .../mailbox/hbase/mail/HBaseMessageMapper.java | 4 +- .../james/mailbox/jcr/JCRImapConstants.java | 8 +- .../james/mailbox/jpa/JPAMessageManager.java | 2 +- .../mailbox/jpa/mail/JPAMailboxMapper.java | 2 +- .../jpa/openjpa/OpenJPAMessageManager.java | 2 +- .../LuceneMailboxMessageSearchIndexTest.java | 2 +- .../james/mailbox/maildir/MaildirFolder.java | 2 +- .../james/mailbox/store/MessageResultImpl.java | 2 +- .../mailbox/store/StoreMessageManager.java | 2 +- .../store/search/SimpleMessageSearchIndex.java | 24 +- .../transaction/NonTransactionalMapper.java | 6 +- .../mailbox/store/user/SubscriptionMapper.java | 2 +- .../james/mailbox/copier/MailboxCopierTest.java | 2 +- .../mailbox/store/mail/ZooUidProviderTest.java | 140 +++++------ .../apache/james/ai/classic/SystemContext.java | 2 +- .../java/org/apache/mailet/LookupException.java | 4 +- .../java/org/apache/mailet/MailetException.java | 6 +- .../apache/mailet/TemporaryLookupException.java | 4 +- .../james/transport/mailets/AddFooter.java | 4 +- .../transport/mailets/SerialiseToHTTP.java | 10 +- .../maildir/host/MaildirHostSystem.java | 4 +- .../apache/james/mpt/smtp/ForwardSmtpTest.java | 2 +- .../org/apache/james/mpt/maven/AddUser.java | 6 +- .../james/mpt/maven/MailProtocolTest.java | 184 +++++++------- .../james/mpt/maven/MailProtocolTestMojo.java | 24 +- .../imap/decode/ImapRequestLineReader.java | 20 +- .../imap/decode/parser/MoveCommandParser.java | 18 +- .../imap/encode/ExistsResponseEncoder.java | 2 +- .../james/imap/encode/FetchResponseEncoder.java | 14 +- .../james/imap/encode/ListingEncodingUtils.java | 4 +- .../encode/MailboxStatusResponseEncoder.java | 14 +- .../imap/encode/SearchResponseEncoder.java | 8 +- .../imap/encode/StatusResponseEncoder.java | 14 +- .../james/imap/message/request/MoveRequest.java | 6 +- .../james/imap/processor/StoreProcessor.java | 2 +- .../imap/processor/fetch/EnvelopeBuilder.java | 22 +- .../imap/decode/main/IdRangeParseTest.java | 108 ++++---- .../parser/SearchCommandParserCharsetTest.java | 2 +- .../SearchCommandParserQuotedCharsetTest.java | 2 +- .../decode/parser/StoreCommandParserTest.java | 2 +- .../imap/encode/ListResponseEncoderTest.java | 2 +- .../imap/encode/XListResponseEncoderTest.java | 2 +- .../encode/base/ByteImapResponseWriter.java | 2 +- .../imap/processor/SearchProcessorTest.java | 4 +- .../imap/utils/DecoderUtilsLocaleDateTest.java | 2 +- .../protocols/imap/utils/DecoderUtilsTest.java | 4 +- .../netty/AbstractChannelPipelineFactory.java | 2 +- .../netty/BasicChannelUpstreamHandler.java | 2 +- .../ConnectionPerIpLimitUpstreamHandler.java | 4 +- .../protocols/pop3/core/CapaCmdHandler.java | 2 +- .../pop3/core/MessageMetaDataUtils.java | 2 +- .../protocols/pop3/core/TopCmdHandler.java | 16 +- .../protocols/pop3/mailbox/ImapMailbox.java | 20 +- .../pop3/mailbox/ImapMessageMetaData.java | 4 +- .../protocols/pop3/mailbox/MessageMetaData.java | 20 +- .../smtp/core/AbstractHookableCmdHandler.java | 2 +- .../protocols/smtp/core/DataCmdHandler.java | 2 +- .../protocols/smtp/core/ExpnCmdHandler.java | 2 +- .../protocols/smtp/core/HeloCmdHandler.java | 2 +- .../protocols/smtp/core/HelpCmdHandler.java | 2 +- .../protocols/smtp/core/MailCmdHandler.java | 4 +- .../protocols/smtp/core/NoopCmdHandler.java | 2 +- .../protocols/smtp/core/QuitCmdHandler.java | 2 +- .../protocols/smtp/core/RcptCmdHandler.java | 4 +- .../protocols/smtp/core/RsetCmdHandler.java | 2 +- .../protocols/smtp/core/VrfyCmdHandler.java | 2 +- .../smtp/core/esmtp/AuthCmdHandler.java | 2 +- .../smtp/core/esmtp/EhloCmdHandler.java | 2 +- .../james/protocols/smtp/hook/MessageHook.java | 8 +- .../james/protocols/smtp/hook/UnknownHook.java | 14 +- .../org/apache/james/cli/ServerCmdTest.java | 8 +- .../adapter/mailbox/MailboxManagementTest.java | 2 +- .../util/retry/DoublingRetryScheduleTest.java | 56 ++--- .../util/retry/ExceptionRetryHandlerTest.java | 184 +++++++------- .../naming/NamingExceptionRetryHandlerTest.java | 106 ++++---- .../user/file/UsersFileRepositoryTest.java | 2 +- .../mailets/configuration/CommonProcessors.java | 2 +- .../mailets/remoteDelivery/DelayTest.java | 2 +- .../remoteDelivery/DelaysAndMaxRetryTest.java | 6 +- .../james/jmap/JMAPAuthenticationTest.java | 6 +- .../jmap/memory/cucumber/MemoryStepdefs.java | 2 +- .../org/apache/james/jmap/JMAPServletTest.java | 10 +- .../netty/ChannelImapResponseWriter.java | 4 +- .../SwitchableDelimiterBasedFrameDecoder.java | 54 ++-- .../netty/AbstractConfigurableAsyncServer.java | 4 +- .../james/smtpserver/ExtendedSMTPSession.java | 2 +- .../WebAdminServerIntegrationTest.java | 8 +- .../webadmin/routes/DomainsRoutesTest.java | 13 +- .../james/webadmin/routes/UsersRoutesTest.java | 12 +- .../webadmin/routes/GlobalQuotaRoutes.java | 2 +- .../james/webadmin/swagger/SwaggerParser.java | 76 +++--- 101 files changed, 1022 insertions(+), 1023 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/api/src/test/java/org/apache/james/mailbox/mock/MockMailboxSession.java ---------------------------------------------------------------------- diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/mock/MockMailboxSession.java b/mailbox/api/src/test/java/org/apache/james/mailbox/mock/MockMailboxSession.java index ae362cc..678d436 100644 --- a/mailbox/api/src/test/java/org/apache/james/mailbox/mock/MockMailboxSession.java +++ b/mailbox/api/src/test/java/org/apache/james/mailbox/mock/MockMailboxSession.java @@ -100,9 +100,9 @@ public class MockMailboxSession implements MailboxSession { return open; } - public char getPathDelimiter() { - return '.'; - } + public char getPathDelimiter() { + return '.'; + } public SessionType getType() { return type; http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheLoaderFromUnderlying.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheLoaderFromUnderlying.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheLoaderFromUnderlying.java index 40b0ac0..63cd0a6 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheLoaderFromUnderlying.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CacheLoaderFromUnderlying.java @@ -1,5 +1,5 @@ package org.apache.james.mailbox.caching; public interface CacheLoaderFromUnderlying<Key, Value, Underlying, Except extends Throwable> { - Value load(Key key, Underlying underlying) throws Except; + Value load(Key key, Underlying underlying) throws Except; } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxMapper.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxMapper.java index 0d85d87..3223bdb 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxMapper.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxMapper.java @@ -39,46 +39,46 @@ import org.apache.james.mailbox.store.mail.model.Mailbox; public class CachingMailboxMapper implements MailboxMapper { - private final MailboxMapper underlying; - private final MailboxByPathCache cache; - - public CachingMailboxMapper(MailboxMapper underlying, MailboxByPathCache cache) { - this.underlying = underlying; - this.cache = cache; - } - - @Override - public void endRequest() { - underlying.endRequest(); - } - - @Override - public <T> T execute(Transaction<T> transaction) throws MailboxException { - return underlying.execute(transaction); - } - - @Override - public MailboxId save(Mailbox mailbox) throws MailboxException { - invalidate(mailbox); - return underlying.save(mailbox); - } - - @Override - public void delete(Mailbox mailbox) throws MailboxException { - invalidate(mailbox); - underlying.delete(mailbox); - } - - @Override - public Mailbox findMailboxByPath(MailboxPath mailboxName) - throws MailboxException, MailboxNotFoundException { - try { - return cache.findMailboxByPath(mailboxName, underlying); - } catch (MailboxNotFoundException e) { - cache.invalidate(mailboxName); - throw e; - } - } + private final MailboxMapper underlying; + private final MailboxByPathCache cache; + + public CachingMailboxMapper(MailboxMapper underlying, MailboxByPathCache cache) { + this.underlying = underlying; + this.cache = cache; + } + + @Override + public void endRequest() { + underlying.endRequest(); + } + + @Override + public <T> T execute(Transaction<T> transaction) throws MailboxException { + return underlying.execute(transaction); + } + + @Override + public MailboxId save(Mailbox mailbox) throws MailboxException { + invalidate(mailbox); + return underlying.save(mailbox); + } + + @Override + public void delete(Mailbox mailbox) throws MailboxException { + invalidate(mailbox); + underlying.delete(mailbox); + } + + @Override + public Mailbox findMailboxByPath(MailboxPath mailboxName) + throws MailboxException, MailboxNotFoundException { + try { + return cache.findMailboxByPath(mailboxName, underlying); + } catch (MailboxNotFoundException e) { + cache.invalidate(mailboxName); + throw e; + } + } @Override public Mailbox findMailboxById(MailboxId mailboxId) @@ -95,37 +95,37 @@ public class CachingMailboxMapper implements MailboxMapper { return underlying.findMailboxWithPathLike(mailboxPath); } - @Override - public boolean hasChildren(Mailbox mailbox, char delimiter) - throws MailboxException, MailboxNotFoundException { - // TODO possible to meaningfully cache it? - return underlying.hasChildren(mailbox, delimiter); - } - - @Override - public List<Mailbox> list() throws MailboxException { - // TODO possible to meaningfully cache it? is it used at all? - return underlying.list(); - } - - @Override - public ACLDiff updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand) throws MailboxException { - MailboxACL oldACL = mailbox.getACL(); - MailboxACL newACL = mailbox.getACL().apply(mailboxACLCommand); - mailbox.setACL(newACL); - return ACLDiff.computeDiff(oldACL, newACL); - } - - @Override - public ACLDiff setACL(Mailbox mailbox, MailboxACL mailboxACL) throws MailboxException { - MailboxACL oldMailboxAcl = mailbox.getACL(); - mailbox.setACL(mailboxACL); - return ACLDiff.computeDiff(oldMailboxAcl, mailboxACL); - } - - private void invalidate(Mailbox mailbox) { - cache.invalidate(mailbox); - } + @Override + public boolean hasChildren(Mailbox mailbox, char delimiter) + throws MailboxException, MailboxNotFoundException { + // TODO possible to meaningfully cache it? + return underlying.hasChildren(mailbox, delimiter); + } + + @Override + public List<Mailbox> list() throws MailboxException { + // TODO possible to meaningfully cache it? is it used at all? + return underlying.list(); + } + + @Override + public ACLDiff updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand) throws MailboxException { + MailboxACL oldACL = mailbox.getACL(); + MailboxACL newACL = mailbox.getACL().apply(mailboxACLCommand); + mailbox.setACL(newACL); + return ACLDiff.computeDiff(oldACL, newACL); + } + + @Override + public ACLDiff setACL(Mailbox mailbox, MailboxACL mailboxACL) throws MailboxException { + MailboxACL oldMailboxAcl = mailbox.getACL(); + mailbox.setACL(mailboxACL); + return ACLDiff.computeDiff(oldMailboxAcl, mailboxACL); + } + + private void invalidate(Mailbox mailbox) { + cache.invalidate(mailbox); + } @Override public List<Mailbox> findNonPersonalMailboxes(String userName, Right right) throws MailboxException { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxSessionMapperFactory.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxSessionMapperFactory.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxSessionMapperFactory.java index 071e028..2021828 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxSessionMapperFactory.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/CachingMailboxSessionMapperFactory.java @@ -22,21 +22,21 @@ import org.apache.james.mailbox.store.user.SubscriptionMapper; public class CachingMailboxSessionMapperFactory extends MailboxSessionMapperFactory { - private final MailboxSessionMapperFactory underlying; - private final MailboxByPathCache mailboxByPathCache; - private final MailboxMetadataCache mailboxMetadataCache; + private final MailboxSessionMapperFactory underlying; + private final MailboxByPathCache mailboxByPathCache; + private final MailboxMetadataCache mailboxMetadataCache; - public CachingMailboxSessionMapperFactory(MailboxSessionMapperFactory underlying, MailboxByPathCache mailboxByPathCache, MailboxMetadataCache mailboxMetadataCache) { - this.underlying = underlying; - this.mailboxByPathCache = mailboxByPathCache; - this.mailboxMetadataCache = mailboxMetadataCache; - } - - @Override - public MessageMapper createMessageMapper(MailboxSession session) - throws MailboxException { - return new CachingMessageMapper(underlying.createMessageMapper(session), mailboxMetadataCache); - } + public CachingMailboxSessionMapperFactory(MailboxSessionMapperFactory underlying, MailboxByPathCache mailboxByPathCache, MailboxMetadataCache mailboxMetadataCache) { + this.underlying = underlying; + this.mailboxByPathCache = mailboxByPathCache; + this.mailboxMetadataCache = mailboxMetadataCache; + } + + @Override + public MessageMapper createMessageMapper(MailboxSession session) + throws MailboxException { + return new CachingMessageMapper(underlying.createMessageMapper(session), mailboxMetadataCache); + } @Override public MailboxMapper createMailboxMapper(MailboxSession session) http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxByPathCache.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxByPathCache.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxByPathCache.java index 5933786..e897c60 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxByPathCache.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxByPathCache.java @@ -12,15 +12,15 @@ import org.apache.james.mailbox.store.mail.model.Mailbox; */ public interface MailboxByPathCache { - Mailbox findMailboxByPath(MailboxPath mailboxName, - MailboxMapper underlying) throws MailboxNotFoundException, - MailboxException; + Mailbox findMailboxByPath(MailboxPath mailboxName, + MailboxMapper underlying) throws MailboxNotFoundException, + MailboxException; - void invalidate(Mailbox mailbox); - - void invalidate(MailboxPath mailboxPath); + void invalidate(Mailbox mailbox); - // for the purpose of cascading the invalidations; does it make sense? - //public void connectTo(MailboxMetadataCache<Id> mailboxMetadataCache); + void invalidate(MailboxPath mailboxPath); + + // for the purpose of cascading the invalidations; does it make sense? + //public void connectTo(MailboxMetadataCache<Id> mailboxMetadataCache); } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxMetadataCache.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxMetadataCache.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxMetadataCache.java index f40e486..ab25b16 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxMetadataCache.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/MailboxMetadataCache.java @@ -14,23 +14,23 @@ import org.apache.james.mailbox.store.mail.model.Mailbox; */ public interface MailboxMetadataCache { - long countMessagesInMailbox(Mailbox mailbox, - MessageMapper underlying) throws MailboxException; + long countMessagesInMailbox(Mailbox mailbox, + MessageMapper underlying) throws MailboxException; - long countUnseenMessagesInMailbox(Mailbox mailbox, - MessageMapper underlying) throws MailboxException; + long countUnseenMessagesInMailbox(Mailbox mailbox, + MessageMapper underlying) throws MailboxException; - MessageUid findFirstUnseenMessageUid(Mailbox mailbox, - MessageMapper underlying) throws MailboxException; + MessageUid findFirstUnseenMessageUid(Mailbox mailbox, + MessageMapper underlying) throws MailboxException; - Optional<MessageUid> getLastUid(Mailbox mailbox, - MessageMapper underlying) throws MailboxException; + Optional<MessageUid> getLastUid(Mailbox mailbox, + MessageMapper underlying) throws MailboxException; - long getHighestModSeq(Mailbox mailbox, - MessageMapper underlying) throws MailboxException; + long getHighestModSeq(Mailbox mailbox, + MessageMapper underlying) throws MailboxException; - void invalidate(Mailbox mailbox); + void invalidate(Mailbox mailbox); -// public abstract void invalidate(MailboxPath mailboxPath); +// public abstract void invalidate(MailboxPath mailboxPath); } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/AbstractGuavaCache.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/AbstractGuavaCache.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/AbstractGuavaCache.java index 0a1188f..1285964 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/AbstractGuavaCache.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/AbstractGuavaCache.java @@ -6,11 +6,11 @@ import com.google.common.cache.CacheBuilder; public class AbstractGuavaCache { - // TODO this can probably be instantiated more elegant way - protected static final CacheBuilder<Object, Object> BUILDER = - CacheBuilder.newBuilder() - .maximumSize(100000) - .recordStats() - .expireAfterWrite(15, TimeUnit.MINUTES); + // TODO this can probably be instantiated more elegant way + protected static final CacheBuilder<Object, Object> BUILDER = + CacheBuilder.newBuilder() + .maximumSize(100000) + .recordStats() + .expireAfterWrite(15, TimeUnit.MINUTES); } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaCacheWrapper.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaCacheWrapper.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaCacheWrapper.java index d3da17e..5160540 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaCacheWrapper.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaCacheWrapper.java @@ -5,37 +5,37 @@ import org.apache.james.mailbox.caching.CacheLoaderFromUnderlying; import com.google.common.cache.Cache; public abstract class GuavaCacheWrapper<Key, Value, Underlying, KeyRepresentation, Except extends Throwable> - implements CacheLoaderFromUnderlying<Key, Value, Underlying, Except> { - - private final Cache<KeyRepresentation, Value> cache; -// private final CacheLoaderFromUnderlying<Key, Value, Underlying, Except> loader; - - public GuavaCacheWrapper(Cache<KeyRepresentation, Value> cache/*, CacheLoaderFromUnderlying<Key, Value, Underlying, Except> loader*/) { - this.cache = cache; -// this.loader = loader; - } - - public Value get(Key key, Underlying underlying) throws Except { - Value value = cache.getIfPresent(getKeyRepresentation(key)); - if (value != null) { + implements CacheLoaderFromUnderlying<Key, Value, Underlying, Except> { + + private final Cache<KeyRepresentation, Value> cache; +// private final CacheLoaderFromUnderlying<Key, Value, Underlying, Except> loader; + + public GuavaCacheWrapper(Cache<KeyRepresentation, Value> cache/*, CacheLoaderFromUnderlying<Key, Value, Underlying, Except> loader*/) { + this.cache = cache; +// this.loader = loader; + } + + public Value get(Key key, Underlying underlying) throws Except { + Value value = cache.getIfPresent(getKeyRepresentation(key)); + if (value != null) { return value; } else { - value = load(key, underlying); - if (value != null) { + value = load(key, underlying); + if (value != null) { cache.put(getKeyRepresentation(key), value); } - return value; - } + return value; + } + + } - } - - public void invalidate(Key key) { - if (key != null) //needed? + public void invalidate(Key key) { + if (key != null) //needed? { cache.invalidate(getKeyRepresentation(key)); } - } + } - public abstract KeyRepresentation getKeyRepresentation(Key key); + public abstract KeyRepresentation getKeyRepresentation(Key key); } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxByPathCache.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxByPathCache.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxByPathCache.java index f893b91..d717ac8 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxByPathCache.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxByPathCache.java @@ -16,72 +16,72 @@ import com.google.common.cache.Cache; * */ public class GuavaMailboxByPathCache extends AbstractGuavaCache implements MailboxByPathCache { - - private final Cache<String, Mailbox> findMailboxByPathCache = BUILDER.build(); - - private final MailboxByPathCacheWrapper wrapper; - - - public GuavaMailboxByPathCache() { - this.wrapper = new MailboxByPathCacheWrapper(findMailboxByPathCache); - } - - @Override - public Mailbox findMailboxByPath(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxNotFoundException, MailboxException { - - return wrapper.get(mailboxName, underlying); - } - -// alternative plain implementation - review and choose the better -// public Mailbox findMailboxByPath(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxNotFoundException, MailboxException { -// Mailbox mailbox = findMailboxByPathCache.getIfPresent(mailboxName.toString()); -// if (mailbox != null) -// return mailbox; -// else { -// mailbox = new MailboxByPathCacheLoaderFromUnderlying().load(mailboxName, underlying); -// findMailboxByPathCache.put(mailboxName.toString(), mailbox); -// return mailbox; -// } -// } - - - - @Override - public void invalidate(Mailbox mailbox) { - invalidate(mailbox.generateAssociatedPath()); - } - - @Override - public void invalidate(MailboxPath mailboxPath) { - wrapper.invalidate(mailboxPath); - } - - - //Does it make sense to define such loaders as separate classes for reuse? -// class MailboxByPathCacheLoaderFromUnderlying implements CacheLoaderFromUnderlying<MailboxPath, Mailbox, MailboxMapper, MailboxException> { -// @Override -// public Mailbox load(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxException { -// return underlying.findMailboxByPath(mailboxName); -// } -// } - - class MailboxByPathCacheWrapper extends GuavaCacheWrapper<MailboxPath, Mailbox, MailboxMapper, String, MailboxException> { - - public MailboxByPathCacheWrapper( - Cache<String, Mailbox> cache/*, - MailboxByPathCacheLoaderFromUnderlying loader*/) { - super(cache); - } - - @Override - public Mailbox load(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxException { - return underlying.findMailboxByPath(mailboxName); - } - - @Override - public String getKeyRepresentation(MailboxPath key) { - return key.toString(); - } - - } + + private final Cache<String, Mailbox> findMailboxByPathCache = BUILDER.build(); + + private final MailboxByPathCacheWrapper wrapper; + + + public GuavaMailboxByPathCache() { + this.wrapper = new MailboxByPathCacheWrapper(findMailboxByPathCache); + } + + @Override + public Mailbox findMailboxByPath(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxNotFoundException, MailboxException { + + return wrapper.get(mailboxName, underlying); + } + +// alternative plain implementation - review and choose the better +// public Mailbox findMailboxByPath(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxNotFoundException, MailboxException { +// Mailbox mailbox = findMailboxByPathCache.getIfPresent(mailboxName.toString()); +// if (mailbox != null) +// return mailbox; +// else { +// mailbox = new MailboxByPathCacheLoaderFromUnderlying().load(mailboxName, underlying); +// findMailboxByPathCache.put(mailboxName.toString(), mailbox); +// return mailbox; +// } +// } + + + + @Override + public void invalidate(Mailbox mailbox) { + invalidate(mailbox.generateAssociatedPath()); + } + + @Override + public void invalidate(MailboxPath mailboxPath) { + wrapper.invalidate(mailboxPath); + } + + + //Does it make sense to define such loaders as separate classes for reuse? +// class MailboxByPathCacheLoaderFromUnderlying implements CacheLoaderFromUnderlying<MailboxPath, Mailbox, MailboxMapper, MailboxException> { +// @Override +// public Mailbox load(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxException { +// return underlying.findMailboxByPath(mailboxName); +// } +// } + + class MailboxByPathCacheWrapper extends GuavaCacheWrapper<MailboxPath, Mailbox, MailboxMapper, String, MailboxException> { + + public MailboxByPathCacheWrapper( + Cache<String, Mailbox> cache/*, + MailboxByPathCacheLoaderFromUnderlying loader*/) { + super(cache); + } + + @Override + public Mailbox load(MailboxPath mailboxName, MailboxMapper underlying) throws MailboxException { + return underlying.findMailboxByPath(mailboxName); + } + + @Override + public String getKeyRepresentation(MailboxPath key) { + return key.toString(); + } + + } } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxMetadataCache.java ---------------------------------------------------------------------- diff --git a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxMetadataCache.java b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxMetadataCache.java index 80728ca..a877ed2 100644 --- a/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxMetadataCache.java +++ b/mailbox/caching/src/main/java/org/apache/james/mailbox/caching/guava/GuavaMailboxMetadataCache.java @@ -18,127 +18,127 @@ import com.google.common.cache.Cache; public class GuavaMailboxMetadataCache extends AbstractGuavaCache implements MailboxMetadataCache { - // TODO these can probably be instantiated more elegant way - private final Cache<MailboxId, Long> cacheCountMessagesInMailbox = BUILDER.build(); - private final Cache<MailboxId, Long> cacheCountUnseenMessagesInMailbox = BUILDER.build(); - private final Cache<MailboxId, MessageUid> cacheFindFirstUnseenMessageUid = BUILDER.build(); - private final Cache<MailboxId, Optional<MessageUid>> cacheGetLastUid = BUILDER.build(); - private final Cache<MailboxId, Long> cacheGetHighestModSeq = BUILDER.build(); - - private final MetadataCacheWrapper<Long> countMessagesInMailboxWrapper = new CountMessagesInMailboxWrapper(cacheCountMessagesInMailbox); - private final MetadataCacheWrapper<Long> countUnseenMessagesInMailboxWrapper = new CountUnseenMessagesInMailboxWrapper(cacheCountUnseenMessagesInMailbox); - private final MetadataCacheWrapper<MessageUid> findFirstUnseenMessageUid = new FindFirstUnseenMessageUidWrapper(cacheFindFirstUnseenMessageUid); - private final MetadataCacheWrapper<Long> highestModSeqWrapper = new HighestModseqCacheWrapper(cacheGetHighestModSeq); - private final MetadataCacheWrapper<Optional<MessageUid>> lastUidWrapper = new LastUidCacheWrapper(cacheGetLastUid); - - @Override - public long countMessagesInMailbox(Mailbox mailbox, MessageMapper underlying) throws MailboxException { - return countMessagesInMailboxWrapper.get(mailbox, underlying); - } - - @Override - public long countUnseenMessagesInMailbox(Mailbox mailbox, MessageMapper underlying) - throws MailboxException { - return countUnseenMessagesInMailboxWrapper.get(mailbox, underlying); - } - - @Override - public MessageUid findFirstUnseenMessageUid(Mailbox mailbox, MessageMapper underlying) - throws MailboxException { - return findFirstUnseenMessageUid.get(mailbox, underlying); - } - - @Override - public Optional<MessageUid> getLastUid(Mailbox mailbox, MessageMapper underlying) throws MailboxException { - return lastUidWrapper.get(mailbox, underlying); - - } - - @Override - public long getHighestModSeq(Mailbox mailbox, MessageMapper underlying) throws MailboxException { - return highestModSeqWrapper.get(mailbox, underlying); - } - - @Override - public void invalidate(Mailbox mailbox) { - cacheCountMessagesInMailbox.invalidate(mailbox); - cacheCountUnseenMessagesInMailbox.invalidate(mailbox); - cacheFindFirstUnseenMessageUid.invalidate(mailbox); - lastUidWrapper.invalidate(mailbox); - highestModSeqWrapper.invalidate(mailbox); - } - - - abstract class MetadataCacheWrapper<Value> extends GuavaCacheWrapper<Mailbox, Value, MessageMapper, MailboxId, MailboxException> { - - public MetadataCacheWrapper(Cache<MailboxId, Value> cache) { - super(cache); - } - - @Override - public MailboxId getKeyRepresentation(Mailbox key) { - return key.getMailboxId(); - } - - } - - class CountMessagesInMailboxWrapper extends MetadataCacheWrapper<Long> { - - public CountMessagesInMailboxWrapper(Cache<MailboxId, Long> cache) { - super(cache); - } - @Override - public Long load(Mailbox mailbox, MessageMapper underlying) - throws MailboxException { - return underlying.countMessagesInMailbox(mailbox); - } - - } - - class CountUnseenMessagesInMailboxWrapper extends MetadataCacheWrapper<Long> { - - public CountUnseenMessagesInMailboxWrapper(Cache<MailboxId, Long> cache) { - super(cache); - } - @Override - public Long load(Mailbox mailbox, MessageMapper underlying) - throws MailboxException { - return underlying.countUnseenMessagesInMailbox(mailbox); - } - - } - - class FindFirstUnseenMessageUidWrapper extends MetadataCacheWrapper<MessageUid> { - - public FindFirstUnseenMessageUidWrapper(Cache<MailboxId, MessageUid> cache) { - super(cache); - } - @Override - public MessageUid load(Mailbox mailbox, MessageMapper underlying) - throws MailboxException { - return underlying.findFirstUnseenMessageUid(mailbox); - } - - } - - class LastUidCacheWrapper extends MetadataCacheWrapper<Optional<MessageUid>> { - public LastUidCacheWrapper(Cache<MailboxId, Optional<MessageUid>> cache) { - super(cache); - } - @Override - public Optional<MessageUid> load(Mailbox mailbox, MessageMapper underlying) throws MailboxException { - return underlying.getLastUid(mailbox); - } - } - - class HighestModseqCacheWrapper extends MetadataCacheWrapper<Long> { - public HighestModseqCacheWrapper(Cache<MailboxId, Long> cache) { - super(cache); - } - @Override - public Long load(Mailbox mailbox, MessageMapper underlying) throws MailboxException { - return underlying.getHighestModSeq(mailbox); - } - } + // TODO these can probably be instantiated more elegant way + private final Cache<MailboxId, Long> cacheCountMessagesInMailbox = BUILDER.build(); + private final Cache<MailboxId, Long> cacheCountUnseenMessagesInMailbox = BUILDER.build(); + private final Cache<MailboxId, MessageUid> cacheFindFirstUnseenMessageUid = BUILDER.build(); + private final Cache<MailboxId, Optional<MessageUid>> cacheGetLastUid = BUILDER.build(); + private final Cache<MailboxId, Long> cacheGetHighestModSeq = BUILDER.build(); + + private final MetadataCacheWrapper<Long> countMessagesInMailboxWrapper = new CountMessagesInMailboxWrapper(cacheCountMessagesInMailbox); + private final MetadataCacheWrapper<Long> countUnseenMessagesInMailboxWrapper = new CountUnseenMessagesInMailboxWrapper(cacheCountUnseenMessagesInMailbox); + private final MetadataCacheWrapper<MessageUid> findFirstUnseenMessageUid = new FindFirstUnseenMessageUidWrapper(cacheFindFirstUnseenMessageUid); + private final MetadataCacheWrapper<Long> highestModSeqWrapper = new HighestModseqCacheWrapper(cacheGetHighestModSeq); + private final MetadataCacheWrapper<Optional<MessageUid>> lastUidWrapper = new LastUidCacheWrapper(cacheGetLastUid); + + @Override + public long countMessagesInMailbox(Mailbox mailbox, MessageMapper underlying) throws MailboxException { + return countMessagesInMailboxWrapper.get(mailbox, underlying); + } + + @Override + public long countUnseenMessagesInMailbox(Mailbox mailbox, MessageMapper underlying) + throws MailboxException { + return countUnseenMessagesInMailboxWrapper.get(mailbox, underlying); + } + + @Override + public MessageUid findFirstUnseenMessageUid(Mailbox mailbox, MessageMapper underlying) + throws MailboxException { + return findFirstUnseenMessageUid.get(mailbox, underlying); + } + + @Override + public Optional<MessageUid> getLastUid(Mailbox mailbox, MessageMapper underlying) throws MailboxException { + return lastUidWrapper.get(mailbox, underlying); + + } + + @Override + public long getHighestModSeq(Mailbox mailbox, MessageMapper underlying) throws MailboxException { + return highestModSeqWrapper.get(mailbox, underlying); + } + + @Override + public void invalidate(Mailbox mailbox) { + cacheCountMessagesInMailbox.invalidate(mailbox); + cacheCountUnseenMessagesInMailbox.invalidate(mailbox); + cacheFindFirstUnseenMessageUid.invalidate(mailbox); + lastUidWrapper.invalidate(mailbox); + highestModSeqWrapper.invalidate(mailbox); + } + + + abstract class MetadataCacheWrapper<Value> extends GuavaCacheWrapper<Mailbox, Value, MessageMapper, MailboxId, MailboxException> { + + public MetadataCacheWrapper(Cache<MailboxId, Value> cache) { + super(cache); + } + + @Override + public MailboxId getKeyRepresentation(Mailbox key) { + return key.getMailboxId(); + } + + } + + class CountMessagesInMailboxWrapper extends MetadataCacheWrapper<Long> { + + public CountMessagesInMailboxWrapper(Cache<MailboxId, Long> cache) { + super(cache); + } + @Override + public Long load(Mailbox mailbox, MessageMapper underlying) + throws MailboxException { + return underlying.countMessagesInMailbox(mailbox); + } + + } + + class CountUnseenMessagesInMailboxWrapper extends MetadataCacheWrapper<Long> { + + public CountUnseenMessagesInMailboxWrapper(Cache<MailboxId, Long> cache) { + super(cache); + } + @Override + public Long load(Mailbox mailbox, MessageMapper underlying) + throws MailboxException { + return underlying.countUnseenMessagesInMailbox(mailbox); + } + + } + + class FindFirstUnseenMessageUidWrapper extends MetadataCacheWrapper<MessageUid> { + + public FindFirstUnseenMessageUidWrapper(Cache<MailboxId, MessageUid> cache) { + super(cache); + } + @Override + public MessageUid load(Mailbox mailbox, MessageMapper underlying) + throws MailboxException { + return underlying.findFirstUnseenMessageUid(mailbox); + } + + } + + class LastUidCacheWrapper extends MetadataCacheWrapper<Optional<MessageUid>> { + public LastUidCacheWrapper(Cache<MailboxId, Optional<MessageUid>> cache) { + super(cache); + } + @Override + public Optional<MessageUid> load(Mailbox mailbox, MessageMapper underlying) throws MailboxException { + return underlying.getLastUid(mailbox); + } + } + + class HighestModseqCacheWrapper extends MetadataCacheWrapper<Long> { + public HighestModseqCacheWrapper(Cache<MailboxId, Long> cache) { + super(cache); + } + @Override + public Long load(Mailbox mailbox, MessageMapper underlying) throws MailboxException { + return underlying.getHighestModSeq(mailbox); + } + } } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java b/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java index a6a82d4..67f1e2c 100644 --- a/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java +++ b/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/mail/HBaseMessageMapper.java @@ -605,8 +605,8 @@ public class HBaseMessageMapper extends NonTransactionalMapper implements Messag @Override public MessageMetaData move(Mailbox mailbox, MailboxMessage original) throws MailboxException { - //TODO implement if possible - throw new UnsupportedOperationException(); + //TODO implement if possible + throw new UnsupportedOperationException(); } @Override http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRImapConstants.java ---------------------------------------------------------------------- diff --git a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRImapConstants.java b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRImapConstants.java index 72fe670..80b8150 100644 --- a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRImapConstants.java +++ b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRImapConstants.java @@ -25,9 +25,9 @@ package org.apache.james.mailbox.jcr; public interface JCRImapConstants { - /** - * Delimiter for Nodes - */ - String NODE_DELIMITER = "/"; + /** + * Delimiter for Nodes + */ + String NODE_DELIMITER = "/"; } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMessageManager.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMessageManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMessageManager.java index c33d607..c37b5c4 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMessageManager.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMessageManager.java @@ -62,7 +62,7 @@ public class JPAMessageManager extends StoreMessageManager { BatchSizes batchSizes, ImmutableMailboxMessage.Factory immutableMailboxMessageFactory, StoreRightManager storeRightManager) throws MailboxException { - + super(mapperFactory, index, dispatcher, locker, mailbox, quotaManager, quotaRootResolver, messageParser, messageIdFactory, batchSizes, immutableMailboxMessageFactory, storeRightManager); } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java index 0170836..52859fc 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java @@ -214,7 +214,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM return numberOfChildMailboxes != null && numberOfChildMailboxes > 0; } - /** + /** * @see org.apache.james.mailbox.store.mail.MailboxMapper#list() */ public List<Mailbox> list() throws MailboxException { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java index e82ee00..d6668c6 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java @@ -65,7 +65,7 @@ public class OpenJPAMessageManager extends JPAMessageManager { QuotaManager quotaManager, QuotaRootResolver quotaRootResolver, MessageParser messageParser, MessageId.Factory messageIdFactory, BatchSizes batchSizes, ImmutableMailboxMessage.Factory immutableMailboxMessageFactory, StoreRightManager storeRightManager) throws MailboxException { - + super(mapperFactory, index, dispatcher, locker, mailbox, quotaManager, quotaRootResolver, messageParser, messageIdFactory, batchSizes, immutableMailboxMessageFactory, storeRightManager); this.feature = f; http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java ---------------------------------------------------------------------- diff --git a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java b/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java index 6d57fd7..d838f96 100644 --- a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java +++ b/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java @@ -641,7 +641,7 @@ public class LuceneMailboxMessageSearchIndexTest { private final TestId id; public SimpleMailbox(long id) { - this.id = TestId.of(id); + this.id = TestId.of(id); } public void setMailboxId(MailboxId id) { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirFolder.java ---------------------------------------------------------------------- diff --git a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirFolder.java b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirFolder.java index 17fba92..9279949 100644 --- a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirFolder.java +++ b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirFolder.java @@ -657,7 +657,7 @@ public class MaildirFolder { if (gap == -1) { // there must be some issues in the file if no gap can be found - LOGGER.info("Corrupted entry in uid-file {} line {}", uidList, lineNumber); + LOGGER.info("Corrupted entry in uid-file {} line {}", uidList, lineNumber); continue; } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java index 288916c..2f6c8c8 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MessageResultImpl.java @@ -55,7 +55,7 @@ public class MessageResultImpl implements MessageResult { private MimeDescriptor mimeDescriptor; - private final MailboxMessage message; + private final MailboxMessage message; private HeadersImpl headers; private Content fullContent; http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java index 8b46697..e70a4d7 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java @@ -733,7 +733,7 @@ public class StoreMessageManager implements org.apache.james.mailbox.MessageMana movedRows.add(data); } return new MoveResult(movedRows.iterator(), originalRowsCopy.iterator()); - } + } private SortedMap<MessageUid, MessageMetaData> copy(MessageRange set, StoreMessageManager to, MailboxSession session) throws MailboxException { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java index d5875bb..6796b7e 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java @@ -94,17 +94,17 @@ public class SimpleMessageSearchIndex implements MessageSearchIndex { * first UidCriterion found * null - if not found */ - private static UidCriterion findConjugatedUidCriterion(List<Criterion> crits) { - for (Criterion crit : crits) { - if (crit instanceof UidCriterion) { - return (UidCriterion) crit; - } else if (crit instanceof ConjunctionCriterion) { - return findConjugatedUidCriterion(((ConjunctionCriterion) crit) - .getCriteria()); - } - } - return null; - } + private static UidCriterion findConjugatedUidCriterion(List<Criterion> crits) { + for (Criterion crit : crits) { + if (crit instanceof UidCriterion) { + return (UidCriterion) crit; + } else if (crit instanceof ConjunctionCriterion) { + return findConjugatedUidCriterion(((ConjunctionCriterion) crit) + .getCriteria()); + } + } + return null; + } @Override public Iterator<MessageUid> search(MailboxSession session, final Mailbox mailbox, SearchQuery query) throws MailboxException { @@ -133,7 +133,7 @@ public class SimpleMessageSearchIndex implements MessageSearchIndex { } } } else { - // we have to fetch all messages + // we have to fetch all messages Iterator<MailboxMessage> messages = mapper.findInMailbox(mailbox, MessageRange.all(), FetchType.Full, -1); while (messages.hasNext()) { MailboxMessage m = messages.next(); http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/store/src/main/java/org/apache/james/mailbox/store/transaction/NonTransactionalMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/transaction/NonTransactionalMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/transaction/NonTransactionalMapper.java index 4b92e23..3eb7149 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/transaction/NonTransactionalMapper.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/transaction/NonTransactionalMapper.java @@ -29,9 +29,9 @@ import org.apache.james.mailbox.exception.MailboxException; public abstract class NonTransactionalMapper implements Mapper { /** - * @see org.apache.james.mailbox.store.transaction.Mapper#execute(org.apache.james.mailbox.store.transaction.Mapper.Transaction) - */ - public final <T> T execute(Transaction<T> transaction) throws MailboxException { + * @see org.apache.james.mailbox.store.transaction.Mapper#execute(org.apache.james.mailbox.store.transaction.Mapper.Transaction) + */ + public final <T> T execute(Transaction<T> transaction) throws MailboxException { return transaction.run(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java index 53d0a69..48ee42f 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/user/SubscriptionMapper.java @@ -30,7 +30,7 @@ import org.apache.james.mailbox.store.user.model.Subscription; */ public interface SubscriptionMapper extends Mapper { - + /** * Finds any subscriptions for a given user to the given mailbox. * @param user not null http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java ---------------------------------------------------------------------- diff --git a/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java b/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java index 7e702c8..126bc39 100644 --- a/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java +++ b/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java @@ -91,7 +91,7 @@ public class MailboxCopierTest { */ @Test public void testMailboxCopy() throws MailboxException, IOException { - if (srcMemMailboxManager instanceof StoreMailboxManager) { + if (srcMemMailboxManager instanceof StoreMailboxManager) { ((StoreMailboxManager) srcMemMailboxManager).init(); } if (dstMemMailboxManager instanceof StoreMailboxManager) { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/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 121cd26..60452aa 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 @@ -136,73 +136,73 @@ public class ZooUidProviderTest { } } - - - private static TestingServer testServer; - private static final int ZOO_TEST_PORT = 3123; - private final RetryPolicy retryPolicy = new RetryOneTime(1); - private CuratorFramework client; - private ZooUidProvider uuidProvider; - private ZooUidProvider longProvider; - private SimpleMailbox mailboxUUID; - private SimpleMailbox mailboxLong; - private UUID randomUUID = UUID.randomUUID(); - - @Before - public void setUp() throws Exception { - testServer = new TestingServer(ZOO_TEST_PORT); - client = CuratorFrameworkFactory.builder().connectString("localhost:" + ZOO_TEST_PORT).retryPolicy(retryPolicy). - namespace("JAMES").build(); - client.start(); - uuidProvider = new ZooUidProvider(client, retryPolicy); - longProvider = new ZooUidProvider(client, retryPolicy); - MailboxPath path1 = new MailboxPath("namespacetest", "namespaceuser", "UUID"); - MailboxPath path2 = new MailboxPath("namespacetest", "namespaceuser", "Long"); - mailboxUUID = new SimpleMailbox(path1, 1L); - mailboxUUID.setMailboxId(UUIDId.of(randomUUID)); - mailboxLong = new SimpleMailbox(path2, 2L); - mailboxLong.setMailboxId(new LongId(123L)); - } - - @After - public void tearDown() throws Exception { - client.close(); - testServer.close(); - } - - /** - * Test of nextUid method, of class ZooUidProvider. - */ - @Test - public void testNextUid() throws Exception { - System.out.println("Testing nextUid"); - MessageUid result = uuidProvider.nextUid(null, mailboxUUID); - assertEquals("Next UID is 1", 1, result.asLong()); - result = longProvider.nextUid(null, mailboxLong); - assertEquals("Next UID is 1", 1, result.asLong()); - } - - /** - * Test of lastUid method, of class ZooUidProvider. - */ - @Test - public void testLastUid() throws Exception { - System.out.println("Testing lastUid"); - Optional<MessageUid> result = uuidProvider.lastUid(null, mailboxUUID); - assertEquals("Next UID is empty", Optional.empty(), result); - MessageUid nextResult = uuidProvider.nextUid(null, mailboxUUID); - assertEquals("Next UID is 1", 1, nextResult.asLong()); - } - - /** - * Test of lastUid method, of class ZooUidProvider. - */ - @Test - public void testLongLastUid() throws Exception { - System.out.println("Testing long lastUid"); - Optional<MessageUid> result = longProvider.lastUid(null, mailboxLong); - assertEquals("Next UID is empty", Optional.empty(), result); - MessageUid nextResult = longProvider.nextUid(null, mailboxLong); - assertEquals("Next UID is 1", 1, nextResult.asLong()); - } - } + + + private static TestingServer testServer; + private static final int ZOO_TEST_PORT = 3123; + private final RetryPolicy retryPolicy = new RetryOneTime(1); + private CuratorFramework client; + private ZooUidProvider uuidProvider; + private ZooUidProvider longProvider; + private SimpleMailbox mailboxUUID; + private SimpleMailbox mailboxLong; + private UUID randomUUID = UUID.randomUUID(); + + @Before + public void setUp() throws Exception { + testServer = new TestingServer(ZOO_TEST_PORT); + client = CuratorFrameworkFactory.builder().connectString("localhost:" + ZOO_TEST_PORT).retryPolicy(retryPolicy). + namespace("JAMES").build(); + client.start(); + uuidProvider = new ZooUidProvider(client, retryPolicy); + longProvider = new ZooUidProvider(client, retryPolicy); + MailboxPath path1 = new MailboxPath("namespacetest", "namespaceuser", "UUID"); + MailboxPath path2 = new MailboxPath("namespacetest", "namespaceuser", "Long"); + mailboxUUID = new SimpleMailbox(path1, 1L); + mailboxUUID.setMailboxId(UUIDId.of(randomUUID)); + mailboxLong = new SimpleMailbox(path2, 2L); + mailboxLong.setMailboxId(new LongId(123L)); + } + + @After + public void tearDown() throws Exception { + client.close(); + testServer.close(); + } + + /** + * Test of nextUid method, of class ZooUidProvider. + */ + @Test + public void testNextUid() throws Exception { + System.out.println("Testing nextUid"); + MessageUid result = uuidProvider.nextUid(null, mailboxUUID); + assertEquals("Next UID is 1", 1, result.asLong()); + result = longProvider.nextUid(null, mailboxLong); + assertEquals("Next UID is 1", 1, result.asLong()); + } + + /** + * Test of lastUid method, of class ZooUidProvider. + */ + @Test + public void testLastUid() throws Exception { + System.out.println("Testing lastUid"); + Optional<MessageUid> result = uuidProvider.lastUid(null, mailboxUUID); + assertEquals("Next UID is empty", Optional.empty(), result); + MessageUid nextResult = uuidProvider.nextUid(null, mailboxUUID); + assertEquals("Next UID is 1", 1, nextResult.asLong()); + } + + /** + * Test of lastUid method, of class ZooUidProvider. + */ + @Test + public void testLongLastUid() throws Exception { + System.out.println("Testing long lastUid"); + Optional<MessageUid> result = longProvider.lastUid(null, mailboxLong); + assertEquals("Next UID is empty", Optional.empty(), result); + MessageUid nextResult = longProvider.nextUid(null, mailboxLong); + assertEquals("Next UID is 1", 1, nextResult.asLong()); + } + } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemContext.java ---------------------------------------------------------------------- diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemContext.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemContext.java index bd58998..1540027 100644 --- a/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemContext.java +++ b/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemContext.java @@ -28,5 +28,5 @@ import org.w3c.dom.Document; */ public interface SystemContext { - Document readXml(String name) throws IOException; + Document readXml(String name) throws IOException; } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailet/api/src/main/java/org/apache/mailet/LookupException.java ---------------------------------------------------------------------- diff --git a/mailet/api/src/main/java/org/apache/mailet/LookupException.java b/mailet/api/src/main/java/org/apache/mailet/LookupException.java index 9e7461a..fd3432a 100644 --- a/mailet/api/src/main/java/org/apache/mailet/LookupException.java +++ b/mailet/api/src/main/java/org/apache/mailet/LookupException.java @@ -27,9 +27,9 @@ import java.io.IOException; */ public class LookupException extends IOException { - private static final long serialVersionUID = -2016705390234811363L; + private static final long serialVersionUID = -2016705390234811363L; - /** + /** * Constructs a new lookup exception. */ public LookupException() { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailet/api/src/main/java/org/apache/mailet/MailetException.java ---------------------------------------------------------------------- diff --git a/mailet/api/src/main/java/org/apache/mailet/MailetException.java b/mailet/api/src/main/java/org/apache/mailet/MailetException.java index e044f50..425247d 100644 --- a/mailet/api/src/main/java/org/apache/mailet/MailetException.java +++ b/mailet/api/src/main/java/org/apache/mailet/MailetException.java @@ -29,10 +29,10 @@ public class MailetException extends MessagingException { /** * @since Mailet API 2.5 - */ - private static final long serialVersionUID = -2753505469139276160L; + */ + private static final long serialVersionUID = -2753505469139276160L; - /** + /** * Constructs a new mailet exception. */ public MailetException() { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailet/api/src/main/java/org/apache/mailet/TemporaryLookupException.java ---------------------------------------------------------------------- diff --git a/mailet/api/src/main/java/org/apache/mailet/TemporaryLookupException.java b/mailet/api/src/main/java/org/apache/mailet/TemporaryLookupException.java index 9db7906..f462481 100644 --- a/mailet/api/src/main/java/org/apache/mailet/TemporaryLookupException.java +++ b/mailet/api/src/main/java/org/apache/mailet/TemporaryLookupException.java @@ -26,9 +26,9 @@ package org.apache.mailet; */ public class TemporaryLookupException extends LookupException { - private static final long serialVersionUID = 6732299701194103662L; + private static final long serialVersionUID = 6732299701194103662L; - /** + /** * Constructs a new lookup exception. */ public TemporaryLookupException() { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java index a1e20fa..223f156 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java @@ -95,7 +95,7 @@ public class AddFooter extends GenericMailet { MimeMultipart multipart = (MimeMultipart) part.getContent(); boolean added = attachFooterToFirstPart(multipart); if (added) { - part.setContent(multipart); + part.setContent(multipart); } return added; @@ -103,7 +103,7 @@ public class AddFooter extends GenericMailet { MimeMultipart multipart = (MimeMultipart) part.getContent(); boolean added = attachFooterToAllSubparts(multipart); if (added) { - part.setContent(multipart); + part.setContent(multipart); } return added; } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mailet/standard/src/main/java/org/apache/james/transport/mailets/SerialiseToHTTP.java ---------------------------------------------------------------------- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/SerialiseToHTTP.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/SerialiseToHTTP.java index 7f812fa..58c6d20 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/SerialiseToHTTP.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/SerialiseToHTTP.java @@ -48,11 +48,11 @@ import org.slf4j.LoggerFactory; * Sample configuration: * * <mailet match="All" class="SerialiseToHTTP"> - * <name>URL</name> <value>url where serialised message will be posted</value> - * <name>ParameterKey</name> <value>An arbitrary parameter be added to the post</value> - * <name>ParameterValue</name> <value>A value for the arbitrary parameter</value> - * <name>MessageKeyName</name> <value>Field name for the serialised message</value> - * <name>passThrough</name> <value>true or false</value> + * <name>URL</name> <value>url where serialised message will be posted</value> + * <name>ParameterKey</name> <value>An arbitrary parameter be added to the post</value> + * <name>ParameterValue</name> <value>A value for the arbitrary parameter</value> + * <name>MessageKeyName</name> <value>Field name for the serialised message</value> + * <name>passThrough</name> <value>true or false</value> * </mailet> * */ http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java index c00d99c..0066773 100644 --- a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java +++ b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java @@ -100,9 +100,9 @@ public class MaildirHostSystem extends JamesImapHostSystem { public void afterTest() throws Exception { resetUserMetaData(); try { - FileUtils.deleteDirectory(new File(MAILDIR_HOME)); + FileUtils.deleteDirectory(new File(MAILDIR_HOME)); } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java index 37b691a..174d6df 100644 --- a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java +++ b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java @@ -43,7 +43,7 @@ public abstract class ForwardSmtpTest { @Rule public FakeSmtp fakeSmtp = new FakeSmtp(); - + private ConditionFactory calmlyAwait; protected abstract SmtpHostSystem createSmtpHostSystem(); http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/AddUser.java ---------------------------------------------------------------------- diff --git a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/AddUser.java b/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/AddUser.java index 2e1192f..1bfa1de 100644 --- a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/AddUser.java +++ b/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/AddUser.java @@ -44,7 +44,7 @@ public class AddUser { } public void setHost(String host) { - this.host = host; + this.host = host; } /** @@ -112,11 +112,11 @@ public class AddUser { } public File getScriptFile() { - return scriptFile; + return scriptFile; } public void setScriptFile(File scriptFile) { - this.scriptFile = scriptFile; + this.scriptFile = scriptFile; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java ---------------------------------------------------------------------- diff --git a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java b/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java index f059bbc..f189ea9 100644 --- a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java +++ b/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java @@ -52,23 +52,23 @@ public class MailProtocolTest implements Monitor { private AddUser[] addUsers; public void setScriptFile(File scriptFile) { - this.scriptFile = scriptFile; + this.scriptFile = scriptFile; } public void setPort(Integer port) { - this.port = port; + this.port = port; } public void setHost(String host) { - this.host = host; + this.host = host; } public void setShabang(String shabang) { - this.shabang = shabang; + this.shabang = shabang; } public void setAddUser(AddUser[] addUsers) { - this.addUsers = addUsers; + this.addUsers = addUsers; } @@ -95,102 +95,102 @@ public class MailProtocolTest implements Monitor { * (non-Javadoc) * @see org.apache.maven.plugin.AbstractMojo#execute() */ - public void execute() throws MojoExecutionException, MojoFailureException { - validate(); - - - for (AddUser addUser : addUsers) { - try { - - final Reader reader; - if (addUser.getScriptText() != null) { - reader = new StringReader(addUser.getScriptText()); - } else { - reader = new FileReader(addUser.getScriptFile()); - } - final ScriptedUserAdder adder = new ScriptedUserAdder(addUser.getHost(), addUser.getPort(), this); - adder.addUser(addUser.getUser(), addUser.getPasswd(), reader); - } catch (Exception e) { - //getLog().error("Unable to add user", e); - throw new MojoFailureException("User addition failed: \n" + e.getMessage()); - } - } + public void execute() throws MojoExecutionException, MojoFailureException { + validate(); + + + for (AddUser addUser : addUsers) { + try { + + final Reader reader; + if (addUser.getScriptText() != null) { + reader = new StringReader(addUser.getScriptText()); + } else { + reader = new FileReader(addUser.getScriptFile()); + } + final ScriptedUserAdder adder = new ScriptedUserAdder(addUser.getHost(), addUser.getPort(), this); + adder.addUser(addUser.getUser(), addUser.getPasswd(), reader); + } catch (Exception e) { + //getLog().error("Unable to add user", e); + throw new MojoFailureException("User addition failed: \n" + e.getMessage()); + } + } final Runner runner = new Runner(); InputStream inputStream; - try { - inputStream = new FileInputStream(scriptFile); + try { + inputStream = new FileInputStream(scriptFile); - final ExternalHostSystem hostSystem = new ExternalHostSystem(SUPPORTED_FEATURES, host, port, this, shabang, null); - final ProtocolSessionBuilder builder = new ProtocolSessionBuilder(); - - builder.addProtocolLines(scriptFile.getName(), inputStream, runner.getTestElements()); - runner.runSessions(hostSystem); + final ExternalHostSystem hostSystem = new ExternalHostSystem(SUPPORTED_FEATURES, host, port, this, shabang, null); + final ProtocolSessionBuilder builder = new ProtocolSessionBuilder(); - } catch (IOException e1) { + builder.addProtocolLines(scriptFile.getName(), inputStream, runner.getTestElements()); + runner.runSessions(hostSystem); + + } catch (IOException e1) { throw new MojoExecutionException("Cannot load script " + scriptFile.getName(), e1); } catch (Exception e) { throw new MojoExecutionException("[FAILURE] in script " + scriptFile.getName() + "\n" + e.getMessage(), e); } - } - - /** - * Validate if the configured parameters are valid - * - * @throws MojoFailureException - */ - private void validate() throws MojoFailureException { - if (port <= 0) { + } + + /** + * Validate if the configured parameters are valid + * + * @throws MojoFailureException + */ + private void validate() throws MojoFailureException { + if (port <= 0) { throw new MojoFailureException("'port' configuration must be set."); - } - - if (scriptFile.exists() == false) { + } + + if (scriptFile.exists() == false) { throw new MojoFailureException("'scriptFile' not exists"); - } - - for (AddUser addUser : addUsers) { - - if (addUser.getScriptText() == null && addUser.getScriptFile() == null) { - throw new MojoFailureException("AddUser must contain the text of the script or a scriptFile"); - } - - if (addUser.getPort() <= 0) { - throw new MojoFailureException("'port' attribute must be set on AddUser to the port against which the script should run."); - } - - if (addUser.getHost() == null) { - throw new MojoFailureException("'host' attribute must be set on AddUser to the host against which the script should run."); - } - } - - } - - - /* - * (non-Javadoc) - * @see org.apache.james.mpt.Monitor#debug(char) - */ - public void debug(char character) { - //getLog().debug("'" + character + "'"); - // do nothing by default - } - - /* - * (non-Javadoc) - * @see org.apache.james.mpt.Monitor#debug(java.lang.String) - */ - public void debug(String message) { - //getLog().debug(message); - // do nothing by default - - } - - /* - * (non-Javadoc) - * @see org.apache.james.mpt.Monitor#note(java.lang.String) - */ - public void note(String message) { - //getLog().debug(message); - System.out.println(message); - } + } + + for (AddUser addUser : addUsers) { + + if (addUser.getScriptText() == null && addUser.getScriptFile() == null) { + throw new MojoFailureException("AddUser must contain the text of the script or a scriptFile"); + } + + if (addUser.getPort() <= 0) { + throw new MojoFailureException("'port' attribute must be set on AddUser to the port against which the script should run."); + } + + if (addUser.getHost() == null) { + throw new MojoFailureException("'host' attribute must be set on AddUser to the host against which the script should run."); + } + } + + } + + + /* + * (non-Javadoc) + * @see org.apache.james.mpt.Monitor#debug(char) + */ + public void debug(char character) { + //getLog().debug("'" + character + "'"); + // do nothing by default + } + + /* + * (non-Javadoc) + * @see org.apache.james.mpt.Monitor#debug(java.lang.String) + */ + public void debug(String message) { + //getLog().debug(message); + // do nothing by default + + } + + /* + * (non-Javadoc) + * @see org.apache.james.mpt.Monitor#note(java.lang.String) + */ + public void note(String message) { + //getLog().debug(message); + System.out.println(message); + } } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java ---------------------------------------------------------------------- diff --git a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java b/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java index a620b7d..c2ce668 100644 --- a/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java +++ b/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java @@ -29,20 +29,20 @@ import org.apache.maven.plugin.MojoFailureException; */ public class MailProtocolTestMojo extends AbstractMojo { - /** - * The Mail Protocol Tests (MPT) to run - * - * @parameter - * @required - * @since 0.1 - */ + /** + * The Mail Protocol Tests (MPT) to run + * + * @parameter + * @required + * @since 0.1 + */ private MailProtocolTest[] mailProtocolTests; - public void execute() throws MojoExecutionException, MojoFailureException { - for (MailProtocolTest test : mailProtocolTests) { - test.execute(); - } - } + public void execute() throws MojoExecutionException, MojoFailureException { + for (MailProtocolTest test : mailProtocolTests) { + test.execute(); + } + } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/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 8506248..49330ff 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 @@ -376,10 +376,10 @@ public abstract class ImapRequestLineReader { FastByteArrayOutputStream out = new FastByteArrayOutputStream(); InputStream in = null; try { - in = consumeLiteral(false); - byte[] buf = new byte[ 0xFFFF ]; + in = consumeLiteral(false); + byte[] buf = new byte[ 0xFFFF ]; - for (int len; (len = in.read(buf)) != -1; ) { + for (int len; (len = in.read(buf)) != -1; ) { out.write(buf, 0, len); } @@ -390,13 +390,13 @@ public abstract class ImapRequestLineReader { } catch (IOException e) { throw new DecodingException(HumanReadableText.BAD_IO_ENCODING, "Bad character encoding", e); } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - // ignore on close - } - } + if (in != null) { + try { + in.close(); + } catch (IOException e) { + // ignore on close + } + } try { out.close(); } catch (IOException e) { http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java index a30dfdc..006337e 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/MoveCommandParser.java @@ -9,15 +9,15 @@ import org.apache.james.imap.message.request.MoveRequest; * Parse MOVE commands */ public class MoveCommandParser extends AbstractMessageRangeCommandParser { - - public MoveCommandParser() { - super(ImapCommand.selectedStateCommand(ImapConstants.MOVE_COMMAND_NAME)); - } - @Override - protected MoveRequest createRequest(ImapCommand command, String tag, - boolean useUids, IdRange[] idSet, String mailboxName) { - return new MoveRequest(command, idSet, mailboxName, useUids, tag); - } + public MoveCommandParser() { + super(ImapCommand.selectedStateCommand(ImapConstants.MOVE_COMMAND_NAME)); + } + + @Override + protected MoveRequest createRequest(ImapCommand command, String tag, + boolean useUids, IdRange[] idSet, String mailboxName) { + return new MoveRequest(command, idSet, mailboxName, useUids, tag); + } } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/protocols/imap/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java index 18aeba8..3faf0c5 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/ExistsResponseEncoder.java @@ -28,7 +28,7 @@ import org.apache.james.imap.message.response.ExistsResponse; public class ExistsResponseEncoder extends AbstractChainedImapEncoder { - public static final String EXISTS = "EXISTS"; + public static final String EXISTS = "EXISTS"; public ExistsResponseEncoder(ImapEncoder next) { super(next); http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java index d936837..48bc82f 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java @@ -70,7 +70,7 @@ public class FetchResponseEncoder extends AbstractChainedImapEncoder { final FetchResponse fetchResponse = (FetchResponse) acceptableMessage; final long messageNumber = fetchResponse.getMessageNumber(); - composer.untagged().message(messageNumber).message(ImapConstants.FETCH_COMMAND_NAME).openParen(); + composer.untagged().message(messageNumber).message(ImapConstants.FETCH_COMMAND_NAME).openParen(); encodeModSeq(composer, fetchResponse); @@ -323,7 +323,7 @@ public class FetchResponseEncoder extends AbstractChainedImapEncoder { final String messageId = envelope.getMessageId(); if (prefixWithName) { - composer.message(ENVELOPE); + composer.message(ENVELOPE); } composer.openParen(); nillableQuote(composer, date); @@ -369,9 +369,9 @@ public class FetchResponseEncoder extends AbstractChainedImapEncoder { private ImapResponseComposer nillableQuote(ImapResponseComposer composer, String message) throws IOException { if (message == null) { - composer.nil(); + composer.nil(); } else { - composer.quote(message); + composer.quote(message); } return composer; } @@ -379,11 +379,11 @@ public class FetchResponseEncoder extends AbstractChainedImapEncoder { private ImapResponseComposer nillableQuotes(ImapResponseComposer composer, List<String> quotes) throws IOException { if (quotes == null || quotes.size() == 0) { - composer.nil(); + composer.nil(); } else { - composer.openParen(); + composer.openParen(); for (String string : quotes) { - nillableQuote(composer,string); + nillableQuote(composer,string); } composer.closeParen(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/a61d975a/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java index 9be5fdc..9e9efdc 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/ListingEncodingUtils.java @@ -47,9 +47,9 @@ public class ListingEncodingUtils { private static void writeDelimiter(ImapResponseComposer composer, char hierarchyDelimiter) throws IOException { if (hierarchyDelimiter == Character.UNASSIGNED) { - composer.nil(); + composer.nil(); } else { - composer.quote(Character.toString(hierarchyDelimiter)); + composer.quote(Character.toString(hierarchyDelimiter)); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
