http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java index 8f592f9..dfe7857 100644 --- a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java +++ b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/JCRSubscriptionMapper.java @@ -100,7 +100,7 @@ public class JCRSubscriptionMapper extends AbstractJCRScalingMapper implements S */ public Subscription findMailboxSubscriptionForUser(String user, String mailbox) throws SubscriptionException { try { - String queryString = "/jcr:root/" + MAILBOXES_PATH + "//element(*,jamesMailbox:user)[@" + JCRSubscription.USERNAME_PROPERTY + "='" + user + "'] AND [@" + JCRSubscription.MAILBOXES_PROPERTY +"='" + mailbox + "']"; + String queryString = "/jcr:root/" + MAILBOXES_PATH + "//element(*,jamesMailbox:user)[@" + JCRSubscription.USERNAME_PROPERTY + "='" + user + "'] AND [@" + JCRSubscription.MAILBOXES_PROPERTY + "='" + mailbox + "']"; QueryManager manager = getSession().getWorkspace().getQueryManager(); QueryResult result = manager.createQuery(queryString, XPATH_LANGUAGE).execute();
http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java ---------------------------------------------------------------------- diff --git a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java index 6dbf244..b30d795 100644 --- a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java +++ b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/user/model/JCRSubscription.java @@ -107,11 +107,11 @@ public class JCRSubscription implements Subscription, Persistent, JCRImapConstan * (non-Javadoc) * @see org.apache.james.mailbox.jcr.IsPersistent#merge(javax.jcr.Node) */ - public void merge(Node node) throws RepositoryException{ + public void merge(Node node) throws RepositoryException { node.setProperty(USERNAME_PROPERTY, getUser()); if (node.hasProperty(MAILBOXES_PROPERTY)) { Value[] mailboxes = node.getProperty(MAILBOXES_PROPERTY).getValues(); - List<String>newMailboxes = new ArrayList<>(); + List<String> newMailboxes = new ArrayList<>(); for (Value mailbox : mailboxes) { String m = mailbox.getString(); newMailboxes.add(m); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/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 f5faca7..c33d607 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 @@ -69,7 +69,7 @@ public class JPAMessageManager extends StoreMessageManager { @Override protected MailboxMessage createMessage(Date internalDate, int size, int bodyStartOctet, SharedInputStream content, - final Flags flags, PropertyBuilder propertyBuilder, List<MessageAttachment> attachments) throws MailboxException{ + final Flags flags, PropertyBuilder propertyBuilder, List<MessageAttachment> attachments) throws MailboxException { return new JPAMailboxMessage((JPAMailbox) getMailboxEntity(), internalDate, size, flags, content, bodyStartOctet, propertyBuilder); } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/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 644dd3e..0170836 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 @@ -96,7 +96,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM } return mailbox.getMailboxId(); } catch (PersistenceException e) { - throw new MailboxException("Save of mailbox " + mailbox.getName() +" failed", e); + throw new MailboxException("Save of mailbox " + mailbox.getName() + " failed", e); } } @@ -217,7 +217,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM /** * @see org.apache.james.mailbox.store.mail.MailboxMapper#list() */ - public List<Mailbox> list() throws MailboxException{ + public List<Mailbox> list() throws MailboxException { try { return getEntityManager().createNamedQuery("listMailboxes", Mailbox.class).getResultList(); } catch (PersistenceException e) { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java index 3f216e4..991252b 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailbox.java @@ -35,31 +35,31 @@ import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.store.mail.model.Mailbox; import org.apache.james.mailbox.store.mail.model.MailboxUtil; -@Entity(name="Mailbox") -@Table(name="JAMES_MAILBOX") +@Entity(name = "Mailbox") +@Table(name = "JAMES_MAILBOX") @NamedQueries({ - @NamedQuery(name="findMailboxById", - query="SELECT mailbox FROM Mailbox mailbox WHERE mailbox.mailboxId = :idParam"), - @NamedQuery(name="findMailboxByName", - query="SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name = :nameParam and mailbox.user is NULL and mailbox.namespace= :namespaceParam"), - @NamedQuery(name="findMailboxByNameWithUser", - query="SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name = :nameParam and mailbox.user= :userParam and mailbox.namespace= :namespaceParam"), - @NamedQuery(name="deleteAllMailboxes", - query="DELETE FROM Mailbox mailbox"), - @NamedQuery(name="findMailboxWithNameLikeWithUser", - query="SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user= :userParam and mailbox.namespace= :namespaceParam"), - @NamedQuery(name="findMailboxWithNameLike", - query="SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user is NULL and mailbox.namespace= :namespaceParam"), - @NamedQuery(name="countMailboxesWithNameLikeWithUser", - query="SELECT COUNT(mailbox) FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user= :userParam and mailbox.namespace= :namespaceParam"), - @NamedQuery(name="countMailboxesWithNameLike", - query="SELECT COUNT(mailbox) FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user is NULL and mailbox.namespace= :namespaceParam"), - @NamedQuery(name="listMailboxes", - query="SELECT mailbox FROM Mailbox mailbox"), - @NamedQuery(name="findHighestModSeq", - query="SELECT mailbox.highestModSeq FROM Mailbox mailbox WHERE mailbox.mailboxId = :idParam"), - @NamedQuery(name="findLastUid", - query="SELECT mailbox.lastUid FROM Mailbox mailbox WHERE mailbox.mailboxId = :idParam") + @NamedQuery(name = "findMailboxById", + query = "SELECT mailbox FROM Mailbox mailbox WHERE mailbox.mailboxId = :idParam"), + @NamedQuery(name = "findMailboxByName", + query = "SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name = :nameParam and mailbox.user is NULL and mailbox.namespace= :namespaceParam"), + @NamedQuery(name = "findMailboxByNameWithUser", + query = "SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name = :nameParam and mailbox.user= :userParam and mailbox.namespace= :namespaceParam"), + @NamedQuery(name = "deleteAllMailboxes", + query = "DELETE FROM Mailbox mailbox"), + @NamedQuery(name = "findMailboxWithNameLikeWithUser", + query = "SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user= :userParam and mailbox.namespace= :namespaceParam"), + @NamedQuery(name = "findMailboxWithNameLike", + query = "SELECT mailbox FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user is NULL and mailbox.namespace= :namespaceParam"), + @NamedQuery(name = "countMailboxesWithNameLikeWithUser", + query = "SELECT COUNT(mailbox) FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user= :userParam and mailbox.namespace= :namespaceParam"), + @NamedQuery(name = "countMailboxesWithNameLike", + query = "SELECT COUNT(mailbox) FROM Mailbox mailbox WHERE mailbox.name LIKE :nameParam and mailbox.user is NULL and mailbox.namespace= :namespaceParam"), + @NamedQuery(name = "listMailboxes", + query = "SELECT mailbox FROM Mailbox mailbox"), + @NamedQuery(name = "findHighestModSeq", + query = "SELECT mailbox.highestModSeq FROM Mailbox mailbox WHERE mailbox.mailboxId = :idParam"), + @NamedQuery(name = "findLastUid", + query = "SELECT mailbox.lastUid FROM Mailbox mailbox WHERE mailbox.mailboxId = :idParam") }) public class JPAMailbox implements Mailbox { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailboxAnnotation.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailboxAnnotation.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailboxAnnotation.java index 0945e48..a031977 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailboxAnnotation.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAMailboxAnnotation.java @@ -30,12 +30,12 @@ import javax.persistence.Table; import com.google.common.base.Objects; -@Entity(name="MailboxAnnotation") -@Table(name="JAMES_MAILBOX_ANNOTATION") +@Entity(name = "MailboxAnnotation") +@Table(name = "JAMES_MAILBOX_ANNOTATION") @NamedQueries({ @NamedQuery(name = "retrieveAllAnnotations", query = "SELECT annotation FROM MailboxAnnotation annotation WHERE annotation.mailboxId = :idParam"), @NamedQuery(name = "retrieveByKey", query = "SELECT annotation FROM MailboxAnnotation annotation WHERE annotation.mailboxId = :idParam AND annotation.key = :keyParam"), - @NamedQuery(name= "countAnnotationsInMailbox", query = "SELECT COUNT(annotation) FROM MailboxAnnotation annotation WHERE annotation.mailboxId = :idParam"), + @NamedQuery(name = "countAnnotationsInMailbox", query = "SELECT COUNT(annotation) FROM MailboxAnnotation annotation WHERE annotation.mailboxId = :idParam"), @NamedQuery(name = "retrieveByKeyLike", query = "SELECT annotation FROM MailboxAnnotation annotation WHERE annotation.mailboxId = :idParam AND annotation.key LIKE :keyParam")}) @IdClass(JPAMailboxAnnotationId.class) public class JPAMailboxAnnotation { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAUserFlag.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAUserFlag.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAUserFlag.java index 0fa7872..9ed8cbf 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAUserFlag.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/JPAUserFlag.java @@ -25,8 +25,8 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; -@Entity(name="UserFlag") -@Table(name="JAMES_MAIL_USERFLAG") +@Entity(name = "UserFlag") +@Table(name = "JAMES_MAIL_USERFLAG") public class JPAUserFlag { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAEncryptedMailboxMessage.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAEncryptedMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAEncryptedMailboxMessage.java index 23a1480..cb03b02 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAEncryptedMailboxMessage.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAEncryptedMailboxMessage.java @@ -41,8 +41,8 @@ import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder; import org.apache.openjpa.persistence.Externalizer; import org.apache.openjpa.persistence.Factory; -@Entity(name="MailboxMessage") -@Table(name="JAMES_MAIL") +@Entity(name = "MailboxMessage") +@Table(name = "JAMES_MAIL") public class JPAEncryptedMailboxMessage extends AbstractJPAMailboxMessage { /** The value for the body field. Lazy loaded */ @@ -80,7 +80,7 @@ public class JPAEncryptedMailboxMessage extends AbstractJPAMailboxMessage { /** * Create a copy of the given message */ - public JPAEncryptedMailboxMessage(JPAMailbox mailbox, MessageUid uid, long modSeq, MailboxMessage message) throws MailboxException{ + public JPAEncryptedMailboxMessage(JPAMailbox mailbox, MessageUid uid, long modSeq, MailboxMessage message) throws MailboxException { super(mailbox, uid, modSeq, message); try { this.body = IOUtils.toByteArray(message.getBodyContent()); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessage.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessage.java index 5a5a908..0041018 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessage.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessage.java @@ -39,8 +39,8 @@ import org.apache.james.mailbox.jpa.mail.model.JPAMailbox; import org.apache.james.mailbox.store.mail.model.MailboxMessage; import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder; -@Entity(name="MailboxMessage") -@Table(name="JAMES_MAIL") +@Entity(name = "MailboxMessage") +@Table(name = "JAMES_MAIL") public class JPAMailboxMessage extends AbstractJPAMailboxMessage { /** The value for the body field. Lazy loaded */ @@ -79,7 +79,7 @@ public class JPAMailboxMessage extends AbstractJPAMailboxMessage { /** * Create a copy of the given message */ - public JPAMailboxMessage(JPAMailbox mailbox, MessageUid uid, long modSeq, MailboxMessage message) throws MailboxException{ + public JPAMailboxMessage(JPAMailbox mailbox, MessageUid uid, long modSeq, MailboxMessage message) throws MailboxException { super(mailbox, uid, modSeq, message); try { this.body = IOUtils.toByteArray(message.getBodyContent()); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAStreamingMailboxMessage.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAStreamingMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAStreamingMailboxMessage.java index 6b15fce..3055303 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAStreamingMailboxMessage.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAStreamingMailboxMessage.java @@ -48,8 +48,8 @@ import org.apache.openjpa.persistence.Persistent; * * TODO: Fix me! */ -@Entity(name="MailboxMessage") -@Table(name="JAMES_MAIL") +@Entity(name = "MailboxMessage") +@Table(name = "JAMES_MAIL") public class JPAStreamingMailboxMessage extends AbstractJPAMailboxMessage { @Persistent(optional = false, fetch = FetchType.LAZY) @@ -96,7 +96,7 @@ public class JPAStreamingMailboxMessage extends AbstractJPAMailboxMessage { @Override public InputStream getHeaderContent() throws IOException { - int headerEnd = getBodyStartOctet() -2; + int headerEnd = getBodyStartOctet() - 2; if (headerEnd < 0) { headerEnd = 0; } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxDefaultStorage.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxDefaultStorage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxDefaultStorage.java index f51ffce..6f18e97 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxDefaultStorage.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxDefaultStorage.java @@ -24,8 +24,8 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -@Entity(name="MaxDefaultStorage") -@Table(name="JAMES_MAX_DEFAULT_STORAGE") +@Entity(name = "MaxDefaultStorage") +@Table(name = "JAMES_MAX_DEFAULT_STORAGE") public class MaxDefaultStorage { public static final String DEFAULT_KEY = "default_key"; @@ -33,7 +33,7 @@ public class MaxDefaultStorage { @Column(name = "QUOTAROOT_ID") private String quotaRoot = DEFAULT_KEY; - @Column(name="VALUE") + @Column(name = "VALUE") private long value; public MaxDefaultStorage(long value) { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxUserMessageCount.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxUserMessageCount.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxUserMessageCount.java index 3c7653f..19897b7 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxUserMessageCount.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/model/MaxUserMessageCount.java @@ -24,8 +24,8 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -@Entity(name="MaxUserMessageCount") -@Table(name="JAMES_MAX_USER_MESSAGE_COUNT") +@Entity(name = "MaxUserMessageCount") +@Table(name = "JAMES_MAX_USER_MESSAGE_COUNT") public class MaxUserMessageCount { @Id @Column(name = "QUOTAROOT_ID") http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/user/model/JPASubscription.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/user/model/JPASubscription.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/user/model/JPASubscription.java index 3ae2683..edb2c3f 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/user/model/JPASubscription.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/user/model/JPASubscription.java @@ -38,7 +38,7 @@ import org.apache.james.mailbox.store.user.model.Subscription; name = "JAMES_SUBSCRIPTION", uniqueConstraints = @UniqueConstraint( - columnNames={ + columnNames = { "USER_NAME", "MAILBOX_NAME"}) ) http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java ---------------------------------------------------------------------- diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java index 69021a8..43bea41 100644 --- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java +++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java @@ -30,7 +30,7 @@ import org.apache.james.mailbox.store.JVMMailboxPathLocker; import org.junit.After; import org.junit.Before; -public class JPASubscriptionManagerTest extends AbstractSubscriptionManagerTest{ +public class JPASubscriptionManagerTest extends AbstractSubscriptionManagerTest { private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/kafka/src/main/java/org/apache/james/mailbox/kafka/KafkaMessageConsumer.java ---------------------------------------------------------------------- diff --git a/mailbox/kafka/src/main/java/org/apache/james/mailbox/kafka/KafkaMessageConsumer.java b/mailbox/kafka/src/main/java/org/apache/james/mailbox/kafka/KafkaMessageConsumer.java index 80a737b..4d7cf99 100644 --- a/mailbox/kafka/src/main/java/org/apache/james/mailbox/kafka/KafkaMessageConsumer.java +++ b/mailbox/kafka/src/main/java/org/apache/james/mailbox/kafka/KafkaMessageConsumer.java @@ -57,7 +57,7 @@ public class KafkaMessageConsumer implements MessageConsumer { private static final String ZK_SESSION_TIMEOUT = "400"; private static final String ZK_SYNC_TIME = "200"; - private static final String AUTO_COMMIT8INTERVAL_MS ="1000"; + private static final String AUTO_COMMIT8INTERVAL_MS = "1000"; private static final Logger LOG = LoggerFactory.getLogger(KafkaMessageConsumer.class); private final ConsumerConnector consumer; @@ -97,7 +97,7 @@ public class KafkaMessageConsumer implements MessageConsumer { @PostConstruct public void init(Topic topic) { - if(!isInitialized) { + if (!isInitialized) { this.isInitialized = true; List<KafkaStream<byte[], byte[]>> streams = getKafkaStreams(topic.getValue()); executor = Executors.newFixedThreadPool(numberOfTread); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LenientImapSearchAnalyzer.java ---------------------------------------------------------------------- diff --git a/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LenientImapSearchAnalyzer.java b/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LenientImapSearchAnalyzer.java index 39807ac..519ed95 100644 --- a/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LenientImapSearchAnalyzer.java +++ b/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LenientImapSearchAnalyzer.java @@ -32,7 +32,7 @@ import org.apache.lucene.util.Version; * most times exactly what the user would expect. * */ -public final class LenientImapSearchAnalyzer extends Analyzer{ +public final class LenientImapSearchAnalyzer extends Analyzer { public static final int DEFAULT_MAX_TOKEN_LENGTH = 4; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java ---------------------------------------------------------------------- diff --git a/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java b/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java index 3949f52..3832eed 100644 --- a/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java +++ b/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java @@ -151,7 +151,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { /** * {@link Field} which will contain the unique index of the {@link Document} */ - private static final String ID_FIELD ="id"; + private static final String ID_FIELD = "id"; /** @@ -183,12 +183,12 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { /** * Prefix which will be used for each message header to store it also in a seperate {@link Field} */ - private static final String PREFIX_HEADER_FIELD ="header_"; + private static final String PREFIX_HEADER_FIELD = "header_"; /** * {@link Field} which will contain the whole message header of the {@link MailboxMessage} */ - private static final String HEADERS_FIELD ="headers"; + private static final String HEADERS_FIELD = "headers"; /** * {@link Field} which will contain the mod-sequence of the message @@ -198,31 +198,31 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { /** * {@link Field} which will contain the TO-Address of the message */ - private static final String TO_FIELD ="to"; + private static final String TO_FIELD = "to"; - private static final String FIRST_TO_MAILBOX_NAME_FIELD ="firstToMailboxName"; - private static final String FIRST_TO_MAILBOX_DISPLAY_FIELD ="firstToMailboxDisplay"; + private static final String FIRST_TO_MAILBOX_NAME_FIELD = "firstToMailboxName"; + private static final String FIRST_TO_MAILBOX_DISPLAY_FIELD = "firstToMailboxDisplay"; /** * {@link Field} which will contain the CC-Address of the message */ - private static final String CC_FIELD ="cc"; + private static final String CC_FIELD = "cc"; - private static final String FIRST_CC_MAILBOX_NAME_FIELD ="firstCcMailboxName"; + private static final String FIRST_CC_MAILBOX_NAME_FIELD = "firstCcMailboxName"; /** * {@link Field} which will contain the FROM-Address of the message */ - private static final String FROM_FIELD ="from"; + private static final String FROM_FIELD = "from"; - private static final String FIRST_FROM_MAILBOX_NAME_FIELD ="firstFromMailboxName"; - private static final String FIRST_FROM_MAILBOX_DISPLAY_FIELD ="firstFromMailboxDisplay"; + private static final String FIRST_FROM_MAILBOX_NAME_FIELD = "firstFromMailboxName"; + private static final String FIRST_FROM_MAILBOX_DISPLAY_FIELD = "firstFromMailboxDisplay"; /** * {@link Field} which will contain the BCC-Address of the message */ - private static final String BCC_FIELD ="bcc"; + private static final String BCC_FIELD = "bcc"; private static final String BASE_SUBJECT_FIELD = "baseSubject"; @@ -230,44 +230,44 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { /** * {@link Field} which contain the internalDate of the message with YEAR-Resolution */ - private static final String INTERNAL_DATE_FIELD_YEAR_RESOLUTION ="internaldateYearResolution"; + private static final String INTERNAL_DATE_FIELD_YEAR_RESOLUTION = "internaldateYearResolution"; /** * {@link Field} which contain the internalDate of the message with MONTH-Resolution */ - private static final String INTERNAL_DATE_FIELD_MONTH_RESOLUTION ="internaldateMonthResolution"; + private static final String INTERNAL_DATE_FIELD_MONTH_RESOLUTION = "internaldateMonthResolution"; /** * {@link Field} which contain the internalDate of the message with DAY-Resolution */ - private static final String INTERNAL_DATE_FIELD_DAY_RESOLUTION ="internaldateDayResolution"; + private static final String INTERNAL_DATE_FIELD_DAY_RESOLUTION = "internaldateDayResolution"; /** * {@link Field} which contain the internalDate of the message with HOUR-Resolution */ - private static final String INTERNAL_DATE_FIELD_HOUR_RESOLUTION ="internaldateHourResolution"; + private static final String INTERNAL_DATE_FIELD_HOUR_RESOLUTION = "internaldateHourResolution"; /** * {@link Field} which contain the internalDate of the message with MINUTE-Resolution */ - private static final String INTERNAL_DATE_FIELD_MINUTE_RESOLUTION ="internaldateMinuteResolution"; + private static final String INTERNAL_DATE_FIELD_MINUTE_RESOLUTION = "internaldateMinuteResolution"; /** * {@link Field} which contain the internalDate of the message with SECOND-Resolution */ - private static final String INTERNAL_DATE_FIELD_SECOND_RESOLUTION ="internaldateSecondResolution"; + private static final String INTERNAL_DATE_FIELD_SECOND_RESOLUTION = "internaldateSecondResolution"; /** * {@link Field} which contain the internalDate of the message with MILLISECOND-Resolution */ - private static final String INTERNAL_DATE_FIELD_MILLISECOND_RESOLUTION ="internaldateMillisecondResolution"; + private static final String INTERNAL_DATE_FIELD_MILLISECOND_RESOLUTION = "internaldateMillisecondResolution"; /** * {@link Field} which will contain the id of the {@link Mailbox} */ - private static final String MAILBOX_ID_FIELD ="mailboxid"; + private static final String MAILBOX_ID_FIELD = "mailboxid"; /** * {@link Field} which will contain the user of the {@link MailboxSession} @@ -276,46 +276,46 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { /** * {@link Field} which will contain the id of the {@link MessageId} */ - private static final String MESSAGE_ID_FIELD ="messageid"; + private static final String MESSAGE_ID_FIELD = "messageid"; /** * {@link Field} which contain the Date header of the message with YEAR-Resolution */ - private static final String SENT_DATE_FIELD_YEAR_RESOLUTION ="sentdateYearResolution"; + private static final String SENT_DATE_FIELD_YEAR_RESOLUTION = "sentdateYearResolution"; /** * {@link Field} which contain the Date header of the message with MONTH-Resolution */ - private static final String SENT_DATE_FIELD_MONTH_RESOLUTION ="sentdateMonthResolution"; + private static final String SENT_DATE_FIELD_MONTH_RESOLUTION = "sentdateMonthResolution"; /** * {@link Field} which contain the Date header of the message with DAY-Resolution */ - private static final String SENT_DATE_FIELD_DAY_RESOLUTION ="sentdateDayResolution"; + private static final String SENT_DATE_FIELD_DAY_RESOLUTION = "sentdateDayResolution"; /** * {@link Field} which contain the Date header of the message with HOUR-Resolution */ - private static final String SENT_DATE_FIELD_HOUR_RESOLUTION ="sentdateHourResolution"; + private static final String SENT_DATE_FIELD_HOUR_RESOLUTION = "sentdateHourResolution"; /** * {@link Field} which contain the Date header of the message with MINUTE-Resolution */ - private static final String SENT_DATE_FIELD_MINUTE_RESOLUTION ="sentdateMinuteResolution"; + private static final String SENT_DATE_FIELD_MINUTE_RESOLUTION = "sentdateMinuteResolution"; /** * {@link Field} which contain the Date header of the message with SECOND-Resolution */ - private static final String SENT_DATE_FIELD_SECOND_RESOLUTION ="sentdateSecondResolution"; + private static final String SENT_DATE_FIELD_SECOND_RESOLUTION = "sentdateSecondResolution"; /** * {@link Field} which contain the Date header of the message with MILLISECOND-Resolution */ - private static final String SENT_DATE_FIELD_MILLISECOND_RESOLUTION ="sentdateMillisecondResolution"; + private static final String SENT_DATE_FIELD_MILLISECOND_RESOLUTION = "sentdateMillisecondResolution"; - private static final String SENT_DATE_SORT_FIELD_MILLISECOND_RESOLUTION ="sentdateSort"; + private static final String SENT_DATE_SORT_FIELD_MILLISECOND_RESOLUTION = "sentdateSort"; private static final String MEDIA_TYPE_TEXT = "text"; private static final String MEDIA_TYPE_MESSAGE = "message"; @@ -546,7 +546,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { * @param membership * @return document */ - private Document createMessageDocument(final MailboxSession session, final MailboxMessage membership) throws MailboxException{ + private Document createMessageDocument(final MailboxSession session, final MailboxMessage membership) throws MailboxException { final Document doc = new Document(); // TODO: Better handling doc.add(new Field(USERS, session.getUser().getUserName().toUpperCase(Locale.US), Store.YES, Index.NOT_ANALYZED)); @@ -556,7 +556,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { doc.add(new Field(MESSAGE_ID_FIELD, SearchUtil.getSerializedMessageIdIfSupportedByUnderlyingStorageOrNull(membership), Store.YES, Index.NOT_ANALYZED)); // create an unqiue key for the document which can be used later on updates to find the document - doc.add(new Field(ID_FIELD, membership.getMailboxId().serialize().toUpperCase(Locale.US) +"-" + Long.toString(membership.getUid().asLong()), Store.YES, Index.NOT_ANALYZED)); + doc.add(new Field(ID_FIELD, membership.getMailboxId().serialize().toUpperCase(Locale.US) + "-" + Long.toString(membership.getUid().asLong()), Store.YES, Index.NOT_ANALYZED)); doc.add(new Field(INTERNAL_DATE_FIELD_YEAR_RESOLUTION, DateTools.dateToString(membership.getInternalDate(), DateTools.Resolution.YEAR), Store.NO, Index.NOT_ANALYZED)); doc.add(new Field(INTERNAL_DATE_FIELD_MONTH_RESOLUTION, DateTools.dateToString(membership.getInternalDate(), DateTools.Resolution.MONTH), Store.NO, Index.NOT_ANALYZED)); @@ -583,7 +583,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { String firstToDisplay = ""; Iterator<org.apache.james.mime4j.stream.Field> fields = header.iterator(); - while(fields.hasNext()) { + while (fields.hasNext()) { org.apache.james.mime4j.stream.Field f = fields.next(); String headerName = f.getName().toUpperCase(Locale.US); String headerValue = f.getBody().toUpperCase(Locale.US); @@ -724,7 +724,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { // Read the content one line after the other and add it to the document BufferedReader bodyReader = new BufferedReader(new InputStreamReader(in, charset)); String line = null; - while((line = bodyReader.readLine()) != null) { + while ((line = bodyReader.readLine()) != null) { doc.add(new Field(BODY_FIELD, line.toUpperCase(Locale.US),Store.NO, Index.ANALYZED)); } @@ -863,7 +863,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { if (op instanceof SearchQuery.ContainsOperator) { ContainsOperator cop = (ContainsOperator) op; return createTermQuery(fieldName, cop.getValue().toUpperCase(Locale.US)); - } else if (op instanceof SearchQuery.ExistsOperator){ + } else if (op instanceof SearchQuery.ExistsOperator) { return new PrefixQuery(new Term(fieldName, "")); } else if (op instanceof SearchQuery.DateOperator) { DateOperator dop = (DateOperator) op; @@ -884,7 +884,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { DateResolution res = dop.getDateResultion(); DateTools.Resolution dRes = toResolution(res); String value = DateTools.dateToString(date, dRes); - switch(dop.getType()) { + switch (dop.getType()) { case ON: return new TermQuery(new Term(field, value)); case BEFORE: @@ -996,7 +996,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { } // add or remove recent uids - if (flag.equalsIgnoreCase("\\RECENT")){ + if (flag.equalsIgnoreCase("\\RECENT")) { if (isSet) { uids.addAll(recentUids); } else { @@ -1139,7 +1139,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { */ private Query createTextQuery(SearchQuery.TextCriterion crit) throws UnsupportedSearchException { String value = crit.getOperator().getValue().toUpperCase(Locale.US); - switch(crit.getType()) { + switch (crit.getType()) { case BODY: return createTermQuery(BODY_FIELD, value); case FULL: @@ -1159,7 +1159,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { * @return query * @throws UnsupportedSearchException */ - private Query createAllQuery(SearchQuery.AllCriterion crit) throws UnsupportedSearchException{ + private Query createAllQuery(SearchQuery.AllCriterion crit) throws UnsupportedSearchException { BooleanQuery query = new BooleanQuery(); query.add(createQuery(MessageRange.all()), BooleanClause.Occur.MUST); @@ -1283,7 +1283,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { BooleanQuery query = new BooleanQuery(); query.add(new TermQuery(new Term(MAILBOX_ID_FIELD, mailbox.getMailboxId().serialize())), BooleanClause.Occur.MUST); query.add(createQuery(MessageRange.one(uid)), BooleanClause.Occur.MUST); - query.add( new PrefixQuery(new Term(FLAGS_FIELD, "")), BooleanClause.Occur.MUST); + query.add(new PrefixQuery(new Term(FLAGS_FIELD, "")), BooleanClause.Occur.MUST); TopDocs docs = searcher.search(query, 100000); ScoreDoc[] sDocs = docs.scoreDocs; @@ -1316,7 +1316,7 @@ public class LuceneMessageSearchIndex extends ListeningMessageSearchIndex { */ private Document createFlagsDocument(MailboxMessage message) { Document doc = new Document(); - doc.add(new Field(ID_FIELD, "flags-" + message.getMailboxId().serialize() +"-" + Long.toString(message.getUid().asLong()), Store.YES, Index.NOT_ANALYZED)); + doc.add(new Field(ID_FIELD, "flags-" + message.getMailboxId().serialize() + "-" + Long.toString(message.getUid().asLong()), Store.YES, Index.NOT_ANALYZED)); doc.add(new Field(MAILBOX_ID_FIELD, message.getMailboxId().serialize(), Store.YES, Index.NOT_ANALYZED)); doc.add(new NumericField(UID_FIELD,Store.YES, true).setLongValue(message.getUid().asLong())); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/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 4e421c1..17fba92 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 @@ -491,8 +491,7 @@ public class MaildirFolder { } finally { IOUtils.closeQuietly(pw); } - } - else { + } else { FileReader fileReader = null; BufferedReader reader = null; try { @@ -787,8 +786,7 @@ public class MaildirFolder { for (String entry : lines) { pw.println(entry); } - } - else { + } else { // create the file if (!uidList.createNewFile()) { throw new IOException("Could not create file " + uidList); @@ -905,8 +903,7 @@ public class MaildirFolder { if (uid.equals(MessageUid.of(Long.valueOf(line.substring(0, line.indexOf(" ")))))) { deletedMessage = newMaildirMessageName(MaildirFolder.this, line.substring(gap + 1, line.length())); messageCount--; - } - else { + } else { lines.add(line); } } @@ -964,9 +961,8 @@ public class MaildirFolder { in = new FileInputStream(f); props.load(in); } catch (IOException e) { - throw new MailboxException("Unable to read last ACL from "+ f.getAbsolutePath(), e); - } - finally { + throw new MailboxException("Unable to read last ACL from " + f.getAbsolutePath(), e); + } finally { IOUtils.closeQuietly(in); } } @@ -1005,11 +1001,10 @@ public class MaildirFolder { if (f.exists()) { try { out = new FileOutputStream(f); - props.store(out, "written by "+ getClass().getName()); + props.store(out, "written by " + getClass().getName()); } catch (IOException e) { - throw new MailboxException("Unable to read last ACL from "+ f.getAbsolutePath(), e); - } - finally { + throw new MailboxException("Unable to read last ACL from " + f.getAbsolutePath(), e); + } finally { IOUtils.closeQuietly(out); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMessageName.java ---------------------------------------------------------------------- diff --git a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMessageName.java b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMessageName.java index 8b2cc80..0b21851 100644 --- a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMessageName.java +++ b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMessageName.java @@ -281,10 +281,10 @@ public class MaildirMessageName { } if (isMessageNameStrictParse()) { if (sizeString == null) { - throw new IllegalArgumentException("No message size found in message name: "+ fullName); + throw new IllegalArgumentException("No message size found in message name: " + fullName); } if (flagsString == null) { - throw new IllegalArgumentException("No flags found in message name: "+ fullName); + throw new IllegalArgumentException("No flags found in message name: " + fullName); } } } @@ -454,10 +454,10 @@ public class MaildirMessageName { */ public static MaildirMessageName createUniqueName(MaildirFolder parentFolder, long size) { String timestamp = String.valueOf(System.currentTimeMillis()); - timestamp = timestamp.substring(0, timestamp.length()-3); // time in seconds + timestamp = timestamp.substring(0, timestamp.length() - 3); // time in seconds StringBuilder uniquePart = new StringBuilder(); uniquePart.append(Integer.toHexString(random.nextInt())); // random number as hex - uniquePart.append(timestamp.substring(timestamp.length()-3)); // milliseconds + uniquePart.append(timestamp.substring(timestamp.length() - 3)); // milliseconds uniquePart.append(processName); // process name uniquePart.append(getNextDeliveryNumber()); // delivery number String sizeString = ",S=" + String.valueOf(size); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java index 84ce750..3400448 100644 --- a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java +++ b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMailboxMapper.java @@ -86,13 +86,11 @@ public class MaildirMailboxMapper extends NonTransactionalMapper implements Mail new File(folder, MaildirFolder.TMP), new File(folder, MaildirFolder.UIDLIST_FILE), new File(folder, MaildirFolder.VALIDITY_FILE)); - } - else { + } else { // We simply delete all the folder for non INBOX mailboxes. delete(folder); } - } - else { + } else { throw new MailboxNotFoundException(mailbox.generateAssociatedPath()); } } @@ -212,8 +210,7 @@ public class MaildirMailboxMapper extends NonTransactionalMapper implements Mail } catch (IOException e) { throw new MailboxException("Failed to save Mailbox " + mailbox, e); } - } - else { + } else { if (!originalFolder.getRootFile().renameTo(folder.getRootFile())) { throw new MailboxException("Failed to save Mailbox " + mailbox, new IOException("Could not rename folder " + originalFolder)); @@ -323,8 +320,7 @@ public class MaildirMailboxMapper extends NonTransactionalMapper implements Mail if (domain == null) { userName = user.getName(); - } - else { + } else { userName = user.getName() + "@" + domain.getName(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java index bc502aa..601b873 100644 --- a/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java +++ b/mailbox/maildir/src/main/java/org/apache/james/mailbox/maildir/mail/MaildirMessageMapper.java @@ -316,10 +316,9 @@ public class MaildirMessageMapper extends AbstractMessageMapper { if (message.isRecent()) { messageName.setFlags(message.createFlags()); newMessageFile = new File(folder.getNewFolder(), messageName.getFullName()); - } - // appended via IMAP (might already have flags etc, goes to ./cur - // directly) - else { + } else { + // appended via IMAP (might already have flags etc, goes to ./cur + // directly) messageName.setFlags(message.createFlags()); newMessageFile = new File(folder.getCurFolder(), messageName.getFullName()); } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java ---------------------------------------------------------------------- diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java index 50b1052..6c37bba 100644 --- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java +++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java @@ -26,7 +26,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.rules.TemporaryFolder; -public class MaildirSubscriptionManagerTest extends AbstractSubscriptionManagerTest{ +public class MaildirSubscriptionManagerTest extends AbstractSubscriptionManagerTest { @Rule public TemporaryFolder tmpFolder = new TemporaryFolder(); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java index 09fa357..fb85d67 100644 --- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java +++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryMailboxMapper.java @@ -159,7 +159,7 @@ public class InMemoryMailboxMapper implements MailboxMapper { } @Override - public ACLDiff updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand) throws MailboxException{ + public ACLDiff updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand) throws MailboxException { MailboxACL oldACL = mailbox.getACL(); MailboxACL newACL = mailbox.getACL().apply(mailboxACLCommand); mailboxesByPath.get(mailbox.generateAssociatedPath()).setACL(newACL); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryUidProvider.java ---------------------------------------------------------------------- diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryUidProvider.java b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryUidProvider.java index e396880..cc3e0d0 100644 --- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryUidProvider.java +++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryUidProvider.java @@ -32,7 +32,7 @@ import org.apache.james.mailbox.model.MailboxId; import org.apache.james.mailbox.store.mail.UidProvider; import org.apache.james.mailbox.store.mail.model.Mailbox; -public class InMemoryUidProvider implements UidProvider{ +public class InMemoryUidProvider implements UidProvider { private final ConcurrentMap<InMemoryId, AtomicLong> map = new ConcurrentHashMap<>(); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageIdMapperTest.java ---------------------------------------------------------------------- diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageIdMapperTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageIdMapperTest.java index a8af3f1..43a90a0 100644 --- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageIdMapperTest.java +++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMessageIdMapperTest.java @@ -24,7 +24,7 @@ import org.apache.james.mailbox.store.mail.model.MapperProvider; import org.apache.james.mailbox.store.mail.model.MessageIdMapperTest; import org.junit.Before; -public class InMemoryMessageIdMapperTest extends MessageIdMapperTest{ +public class InMemoryMessageIdMapperTest extends MessageIdMapperTest { @Before public void setUp() throws MailboxException { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/AbstractMailboxPathLocker.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/AbstractMailboxPathLocker.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/AbstractMailboxPathLocker.java index aa7dea9..a056285 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/AbstractMailboxPathLocker.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/AbstractMailboxPathLocker.java @@ -24,7 +24,7 @@ import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxPath; -public abstract class AbstractMailboxPathLocker implements MailboxPathLocker{ +public abstract class AbstractMailboxPathLocker implements MailboxPathLocker { @Override public <T> T executeWithLock(MailboxSession session, MailboxPath path, LockAwareExecution<T> execution) throws MailboxException { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java index 6e1865b..33120c8 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java @@ -21,7 +21,7 @@ package org.apache.james.mailbox.store; import java.util.HashMap; import java.util.Map; -public class FakeAuthenticator implements Authenticator{ +public class FakeAuthenticator implements Authenticator { private final Map<String, String> users = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java index 5b7d435..c77c8a9 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/LazyMimeDescriptor.java @@ -39,7 +39,7 @@ import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder; * * */ -public class LazyMimeDescriptor implements MimeDescriptor{ +public class LazyMimeDescriptor implements MimeDescriptor { private final Message message; private final MessageResult result; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/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 8a69f43..bfdc15f 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 @@ -40,10 +40,10 @@ import org.apache.james.mailbox.store.user.SubscriptionMapperFactory; */ public abstract class MailboxSessionMapperFactory implements RequestAware, MailboxMapperFactory, MessageMapperFactory, SubscriptionMapperFactory { - protected static final String MESSAGEMAPPER ="MESSAGEMAPPER"; - protected static final String MESSAGEIDMAPPER ="MESSAGEIDMAPPER"; - protected static final String MAILBOXMAPPER ="MAILBOXMAPPER"; - protected static final String SUBSCRIPTIONMAPPER ="SUBSCRIPTIONMAPPER"; + protected static final String MESSAGEMAPPER = "MESSAGEMAPPER"; + protected static final String MESSAGEIDMAPPER = "MESSAGEIDMAPPER"; + protected static final String MAILBOXMAPPER = "MAILBOXMAPPER"; + protected static final String SUBSCRIPTIONMAPPER = "SUBSCRIPTIONMAPPER"; protected static final String ANNOTATIONMAPPER = "ANNOTATIONMAPPER"; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/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 c530715..288916c 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 @@ -152,7 +152,7 @@ public class MessageResultImpl implements MessageResult { public String toString() { final String TAB = " "; - return "MessageResultImpl ( " + "uid = " + getUid() + TAB + "flags = " + getFlags() + TAB + "size = " + getSize() + TAB + "internalDate = " + getInternalDate()+ ")"; + return "MessageResultImpl ( " + "uid = " + getUid() + TAB + "flags = " + getFlags() + TAB + "size = " + getSize() + TAB + "internalDate = " + getInternalDate() + ")"; } /** http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java index a791c9d..a81b135 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/MimeDescriptorImpl.java @@ -329,7 +329,7 @@ public class MimeDescriptorImpl implements MimeDescriptor { public InputStream getInputStream() throws IOException { StringBuilder sb = new StringBuilder(); Iterator<MessageResult.Header> hIt = headers.iterator(); - while(hIt.hasNext()) { + while (hIt.hasNext()) { MessageResult.Header header = hIt.next(); sb.append(header.getName()).append(": ").append(header.getValue()).append("\r\n"); } @@ -348,7 +348,7 @@ public class MimeDescriptorImpl implements MimeDescriptor { } // Add for CLRF - result +=2; + result += 2; return result; } } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMessageMetaData.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMessageMetaData.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMessageMetaData.java index 19ad052..ae1566f 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMessageMetaData.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/SimpleMessageMetaData.java @@ -31,7 +31,7 @@ import org.apache.james.mailbox.store.mail.model.MailboxMessage; import com.google.common.base.Objects; -public class SimpleMessageMetaData implements MessageMetaData{ +public class SimpleMessageMetaData implements MessageMetaData { private final MessageUid uid; private final Flags flags; private final long size; @@ -79,7 +79,7 @@ public class SimpleMessageMetaData implements MessageMetaData{ @Override public boolean equals(Object obj) { - if(obj instanceof SimpleMessageMetaData) { + if (obj instanceof SimpleMessageMetaData) { return uid.equals(((SimpleMessageMetaData) obj).getUid()); } return false; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/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 3af1c65..8b46697 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 @@ -742,7 +742,7 @@ public class StoreMessageManager implements org.apache.james.mailbox.MessageMana SortedMap<MessageUid, MessageMetaData> copiedUids = collectMetadata(to.copy(originalRows, session)); ImmutableMap.Builder<MessageUid, MailboxMessage> messagesMap = ImmutableMap.builder(); - for(MailboxMessage message: originalRows.getEntriesSeen()) { + for (MailboxMessage message: originalRows.getEntriesSeen()) { messagesMap.put(message.getUid(), immutableMailboxMessageFactory.from(to.getMailboxEntity().getMailboxId(), message)); } dispatcher.added(session, copiedUids, to.getMailboxEntity(), messagesMap.build()); @@ -757,7 +757,7 @@ public class StoreMessageManager implements org.apache.james.mailbox.MessageMana SortedMap<MessageUid, MessageMetaData> moveUids = collectMetadata(moveResult.getMovedMessages()); ImmutableMap.Builder<MessageUid, MailboxMessage> messagesMap = ImmutableMap.builder(); - for(MailboxMessage message: originalRows.getEntriesSeen()) { + for (MailboxMessage message: originalRows.getEntriesSeen()) { messagesMap.put(message.getUid(), immutableMailboxMessageFactory.from(to.getMailboxEntity().getMailboxId(), message)); } dispatcher.added(session, moveUids, to.getMailboxEntity(), messagesMap.build()); @@ -780,7 +780,7 @@ public class StoreMessageManager implements org.apache.james.mailbox.MessageMana } /** * Return the count of unseen messages - * + * * @param session * @return count of unseen messages * @throws MailboxException http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SynchronousEventDelivery.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SynchronousEventDelivery.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SynchronousEventDelivery.java index 8f2b883..d791ec5 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SynchronousEventDelivery.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SynchronousEventDelivery.java @@ -31,7 +31,7 @@ public class SynchronousEventDelivery implements EventDelivery { public void deliver(MailboxListener mailboxListener, MailboxListener.Event event) { try { mailboxListener.event(event); - } catch(Throwable throwable) { + } catch (Throwable throwable) { LOGGER.error("Error while processing listener {} for {}", mailboxListener.getClass().getCanonicalName(), event.getClass().getCanonicalName(), throwable); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/DistantMailboxPathRegister.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/DistantMailboxPathRegister.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/DistantMailboxPathRegister.java index 3ea6d54..c92cb87 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/DistantMailboxPathRegister.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/distributed/DistantMailboxPathRegister.java @@ -64,7 +64,7 @@ public class DistantMailboxPathRegister implements MailboxPathRegister { @Override public void run() { Set<Map.Entry<MailboxPath, Long>> snapshot = ImmutableSet.copyOf(registeredMailboxPathCount.entrySet()); - for(Map.Entry<MailboxPath, Long> entry : snapshot) { + for (Map.Entry<MailboxPath, Long> entry : snapshot) { if (entry.getValue() > 0) { mapper.doRegister(entry.getKey(), topic); } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java index d1225b0..1414d45 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/EventConverter.java @@ -78,7 +78,7 @@ public class EventConverter { mailboxDataTransferObject, ((MailboxListener.FlagsUpdated) event).getUids(), ((MailboxListener.FlagsUpdated) event).getUpdatedFlags()); - } else if ( event instanceof MailboxListener.MailboxRenamed) { + } else if (event instanceof MailboxListener.MailboxRenamed) { return constructMailboxRenamedProxy(event.getSession(), mailboxDataTransferObject, event.getMailboxPath()); @@ -168,7 +168,7 @@ public class EventConverter { List<MessageUid> uids, MailboxListener.MetaDataHoldingEvent event) { HashMap<MessageUid, MessageMetaDataDataTransferObject> metaDataProxyMap = new HashMap<>(); - for(MessageUid uid : uids) { + for (MessageUid uid : uids) { metaDataProxyMap.put(uid, new MessageMetaDataDataTransferObject( event.getMetaData(uid) )); @@ -183,7 +183,7 @@ public class EventConverter { } private SortedMap<MessageUid, MessageMetaData> retrieveMetadata(Map<MessageUid, MessageMetaDataDataTransferObject> metaDataProxyMap) { - if(metaDataProxyMap != null) { + if (metaDataProxyMap != null) { TreeMap<MessageUid, MessageMetaData> result = new TreeMap<>(); Set<Map.Entry<MessageUid, MessageMetaDataDataTransferObject>> entrySet = metaDataProxyMap.entrySet(); for (Map.Entry<MessageUid, MessageMetaDataDataTransferObject> entry : entrySet) { http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java index b0850a3..d3beae3 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/EventType.java @@ -21,7 +21,7 @@ package org.apache.james.mailbox.store.json.event.dto; import com.fasterxml.jackson.annotation.JsonFormat; -@JsonFormat(shape= JsonFormat.Shape.NUMBER) +@JsonFormat(shape = JsonFormat.Shape.NUMBER) public enum EventType { ADDED, DELETED, http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java index 9b2459f..a2c168f 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/FlagsDataTransferObject.java @@ -57,25 +57,25 @@ public class FlagsDataTransferObject { @JsonIgnore public Flags getFlags() { Flags result = new Flags(); - if(answered) { + if (answered) { result.add(Flags.Flag.ANSWERED); } - if(flagged) { + if (flagged) { result.add(Flags.Flag.FLAGGED); } - if(recent) { + if (recent) { result.add(Flags.Flag.RECENT); } - if(deleted) { + if (deleted) { result.add(Flags.Flag.DELETED); } - if(draft) { + if (draft) { result.add(Flags.Flag.DRAFT); } - if(seen) { + if (seen) { result.add(Flags.Flag.SEEN); } - for(String flag : userFlags) { + for (String flag : userFlags) { result.add(flag); } return result; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java index 5b4acaa..2c59ba0 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MailboxSessionDataTransferObject.java @@ -85,7 +85,7 @@ public class MailboxSessionDataTransferObject { } private MailboxSession.SessionType retrieveSessionType() { - switch(this.sessionType) { + switch (this.sessionType) { case 0: return MailboxSession.SessionType.User; case 1: @@ -97,7 +97,7 @@ public class MailboxSessionDataTransferObject { } private int extractSessionType(MailboxSession session) { - switch(session.getType()) { + switch (session.getType()) { case User: return 0; case System: http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java index 637d003..91c36e0 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/json/event/dto/MessageMetaDataDataTransferObject.java @@ -86,7 +86,7 @@ public class MessageMetaDataDataTransferObject { public SimpleMessageMetaData getMetadata() { try { return new SimpleMessageMetaData(MessageUid.of(uid), modseq, flags.getFlags(), size, parse(date), messageId); - } catch(ParseException parseException) { + } catch (ParseException parseException) { LOG.error("Parse exception while parsing date while deserializing metadata upon event serialization. Using nowadays date instead.", parseException); return new SimpleMessageMetaData(MessageUid.of(uid), modseq, flags.getFlags(), size, new Date(), messageId); } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingModSeqProvider.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingModSeqProvider.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingModSeqProvider.java index 5cef27d..dd790b4 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingModSeqProvider.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingModSeqProvider.java @@ -32,7 +32,7 @@ import org.apache.james.mailbox.store.mail.model.Mailbox; * * */ -public abstract class AbstractLockingModSeqProvider implements ModSeqProvider{ +public abstract class AbstractLockingModSeqProvider implements ModSeqProvider { private final MailboxPathLocker locker; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingUidProvider.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingUidProvider.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingUidProvider.java index b6d365a..165d567 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingUidProvider.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractLockingUidProvider.java @@ -34,7 +34,7 @@ import org.apache.james.mailbox.store.mail.model.Mailbox; * * */ -public abstract class AbstractLockingUidProvider implements UidProvider{ +public abstract class AbstractLockingUidProvider implements UidProvider { private final MailboxPathLocker locker; http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractMessageMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractMessageMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractMessageMapper.java index 49997f5..f1f24be 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractMessageMapper.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AbstractMessageMapper.java @@ -87,8 +87,8 @@ public abstract class AbstractMessageMapper extends TransactionalMapper implemen modSeq = modSeqProvider.nextModSeq(mailboxSession, mailbox); } } - while(messages.hasNext()) { - final MailboxMessage member = messages.next(); + while (messages.hasNext()) { + final MailboxMessage member = messages.next(); Flags originalFlags = member.createFlags(); member.setFlags(flagsUpdateCalculator.buildNewFlags(originalFlags)); Flags newFlags = member.createFlags(); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageUtils.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageUtils.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageUtils.java index 44f385d..cb6b71c 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageUtils.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/MessageUtils.java @@ -77,7 +77,7 @@ public class MessageUtils { long modSeq = nextModSeq(mailbox); - while(messages.hasNext()) { + while (messages.hasNext()) { MailboxMessage member = messages.next(); Flags originalFlags = member.createFlags(); member.setFlags(flagsUpdateCalculator.buildNewFlags(originalFlags)); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java index 33ee262..6d4c65a 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/PropertyBuilder.java @@ -136,9 +136,8 @@ public class PropertyBuilder { * @param localName not null * @param value null to remove property */ - public void setProperty(String namespace, String localName, String value) - { - for (Iterator<SimpleProperty> it= properties.iterator();it.hasNext();) { + public void setProperty(String namespace, String localName, String value) { + for (Iterator<SimpleProperty> it = properties.iterator();it.hasNext();) { final SimpleProperty property = it.next(); if (property.isNamed(namespace, localName)) { it.remove(); @@ -156,16 +155,15 @@ public class PropertyBuilder { * @param localName not null * @param values null to remove property */ - public void setProperty(String namespace, String localName, List<String> values) - { - for (Iterator<SimpleProperty> it= properties.iterator();it.hasNext();) { + public void setProperty(String namespace, String localName, List<String> values) { + for (Iterator<SimpleProperty> it = properties.iterator();it.hasNext();) { final SimpleProperty property = it.next(); if (property.isNamed(namespace, localName)) { it.remove(); } } - if (values !=null) { - for(String value:values) { + if (values != null) { + for (String value:values) { properties.add(new SimpleProperty(namespace, localName, value)); } } @@ -194,7 +192,7 @@ public class PropertyBuilder { * @param valuesByLocalName not null */ public void setProperties(String namespace, Map<String,String> valuesByLocalName) { - for (Iterator<SimpleProperty> it= properties.iterator();it.hasNext();) { + for (Iterator<SimpleProperty> it = properties.iterator();it.hasNext();) { final SimpleProperty property = it.next(); if (property.isInSpace(namespace)) { it.remove(); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java index 2fcbbfc..56e1e0f 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/publisher/Publisher.java @@ -26,7 +26,7 @@ import java.io.Closeable; * * For instance you can send information to a message queue like Kafka or perform a POST on a restful API */ -public interface Publisher extends Closeable{ +public interface Publisher extends Closeable { void publish(Topic topic, byte[] message); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/CurrentQuotaCalculator.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/CurrentQuotaCalculator.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/CurrentQuotaCalculator.java index 4c66901..17f1465 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/CurrentQuotaCalculator.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/CurrentQuotaCalculator.java @@ -59,7 +59,7 @@ public class CurrentQuotaCalculator { for (Mailbox mailbox : mailboxes) { Iterator<MailboxMessage> messages = mapper.findInMailbox(mailbox, MessageRange.all(), MessageMapper.FetchType.Metadata, -1); messageCount += mapper.countMessagesInMailbox(mailbox); - while(messages.hasNext()) { + while (messages.hasNext()) { messagesSizes += messages.next().getFullContentOctets(); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultQuotaRootResolver.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultQuotaRootResolver.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultQuotaRootResolver.java index 4fa9cf6..793c854 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultQuotaRootResolver.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/DefaultQuotaRootResolver.java @@ -62,7 +62,7 @@ public class DefaultQuotaRootResolver implements QuotaRootResolver { public List<MailboxPath> retrieveAssociatedMailboxes(QuotaRoot quotaRoot, MailboxSession mailboxSession) throws MailboxException { List<String> parts = Lists.newArrayList(Splitter.on(SEPARATOR).split(quotaRoot.getValue())); if (parts.size() != 2) { - throw new MailboxException(quotaRoot + " used as QuotaRoot should not contain 2 \""+SEPARATOR+"\""); + throw new MailboxException(quotaRoot + " used as QuotaRoot should not contain 2 \"" + SEPARATOR + "\""); } String namespace = parts.get(0); String user = parts.get(1); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java index ca5657d..1742e6c 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java @@ -62,7 +62,7 @@ public class ListeningCurrentQuotaUpdater implements MailboxListener, QuotaUpdat } else if (event instanceof Expunged) { handleExpungedEvent((Expunged) event, quotaRoot); } - } catch(MailboxException e) { + } catch (MailboxException e) { LOGGER.error("Error while updating quotas", e); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaImpl.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaImpl.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaImpl.java index 11d1a38..852b295 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaImpl.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaImpl.java @@ -23,7 +23,7 @@ import com.google.common.base.Preconditions; import org.apache.james.mailbox.model.Quota; -public final class QuotaImpl implements Quota{ +public final class QuotaImpl implements Quota { private static final Quota UNLIMITED_QUOTA = new QuotaImpl(UNKNOWN, UNLIMITED); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/StoreQuotaManager.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/StoreQuotaManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/StoreQuotaManager.java index 65cb3fe..a5e9dba 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/StoreQuotaManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/StoreQuotaManager.java @@ -50,7 +50,7 @@ public class StoreQuotaManager implements QuotaManager { public Quota getMessageQuota(QuotaRoot quotaRoot) throws MailboxException { long maxValue = maxQuotaManager.getMaxMessage(quotaRoot); - if(maxValue == Quota.UNLIMITED && !calculateWhenUnlimited) { + if (maxValue == Quota.UNLIMITED && !calculateWhenUnlimited) { return QuotaImpl.quota(Quota.UNKNOWN, Quota.UNLIMITED); } return QuotaImpl.quota(currentQuotaManager.getCurrentMessageCount(quotaRoot), maxValue); @@ -59,7 +59,7 @@ public class StoreQuotaManager implements QuotaManager { public Quota getStorageQuota(QuotaRoot quotaRoot) throws MailboxException { long maxValue = maxQuotaManager.getMaxStorage(quotaRoot); - if(maxValue == Quota.UNLIMITED && !calculateWhenUnlimited) { + if (maxValue == Quota.UNLIMITED && !calculateWhenUnlimited) { return QuotaImpl.quota(Quota.UNKNOWN, Quota.UNLIMITED); } return QuotaImpl.quota(currentQuotaManager.getCurrentStorage(quotaRoot), maxValue); http://git-wip-us.apache.org/repos/asf/james-project/blob/fe712f1a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java index 5262c88..320c8e0 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java @@ -110,7 +110,7 @@ public class LazyMessageSearchIndex extends ListeningMessageSearchIndex { } synchronized (done) { Iterator<MailboxMessage> messages = getFactory().getMessageMapper(session).findInMailbox(mailbox, MessageRange.all(), FetchType.Full, -1); - while(messages.hasNext()) { + while (messages.hasNext()) { final MailboxMessage message = messages.next(); try { add(session, mailbox, message); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
