You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2018/01/10 10:14:07 UTC

[07/53] [abbrv] james-project git commit: JAMES-2277 control flow should use blocks

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/RemoteDeliverySocketFactory.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/RemoteDeliverySocketFactory.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/RemoteDeliverySocketFactory.java
index 19a0052..569ca0a 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/RemoteDeliverySocketFactory.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remoteDelivery/RemoteDeliverySocketFactory.java
@@ -69,10 +69,11 @@ public class RemoteDeliverySocketFactory extends SocketFactory {
      *            the ip address or host name the delivery socket will bind to
      */
     public static void setBindAdress(String addr) throws UnknownHostException {
-        if (addr == null)
+        if (addr == null) {
             bindAddress = null;
-        else
+        } else {
             bindAddress = InetAddress.getByName(addr);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/InSpammerBlacklist.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/InSpammerBlacklist.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/InSpammerBlacklist.java
index 2950f4f..bcc55e6 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/InSpammerBlacklist.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/InSpammerBlacklist.java
@@ -67,8 +67,9 @@ public class InSpammerBlacklist extends GenericMatcher {
         network = getCondition();
 
         // check if the needed condition was given
-        if (network == null)
+        if (network == null) {
             throw new MessagingException("Please configure a blacklist");
+        }
 
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/Account.java
----------------------------------------------------------------------
diff --git a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/Account.java b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/Account.java
index 631914d..19f5fa0 100644
--- a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/Account.java
+++ b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/Account.java
@@ -268,12 +268,15 @@ class Account implements Comparable<Account> {
      */
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         final Account other = (Account) obj;
         return getSequenceNumber() == other.getSequenceNumber();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
----------------------------------------------------------------------
diff --git a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
index 7d63468..76c9898 100644
--- a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
+++ b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
@@ -416,14 +416,17 @@ public class FetchMail implements Runnable, Configurable {
 
         // Setup the Accounts
         List<HierarchicalConfiguration> allAccounts = configuration.configurationsAt("accounts");
-        if (allAccounts.size() < 1)
+        if (allAccounts.size() < 1) {
             throw new ConfigurationException("Missing <accounts> section.");
-        if (allAccounts.size() > 1)
+        }
+        if (allAccounts.size() > 1) {
             throw new ConfigurationException("Too many <accounts> sections, there must be exactly one");
+        }
         HierarchicalConfiguration accounts = allAccounts.get(0);
 
-        if (!accounts.getKeys().hasNext())
+        if (!accounts.getKeys().hasNext()) {
             throw new ConfigurationException("Missing <account> section.");
+        }
 
         int i = 0;
         // Create an Account for every configured account
@@ -658,8 +661,9 @@ public class FetchMail implements Runnable, Configurable {
             throw new ConfigurationException("Unable to acces UsersRepository", e);
         }
         Map<DynamicAccountKey, DynamicAccount> oldAccounts = getDynamicAccountsBasic();
-        if (null == oldAccounts)
+        if (null == oldAccounts) {
             oldAccounts = new HashMap<>(0);
+        }
 
         // Process each ParsedDynamicParameters
         for (ParsedDynamicAccountParameters parsedDynamicAccountParameters : getParsedDynamicAccountParameters()) {
@@ -669,8 +673,9 @@ public class FetchMail implements Runnable, Configurable {
             // newAccounts are created.
             Iterator<DynamicAccountKey> oldAccountsIterator = oldAccounts.keySet().iterator();
             while (oldAccountsIterator.hasNext()) {
-                if (accounts.containsKey(oldAccountsIterator.next()))
+                if (accounts.containsKey(oldAccountsIterator.next())) {
                     oldAccountsIterator.remove();
+                }
             }
             // Add this parameter's accounts to newAccounts
             newAccounts.putAll(accounts);

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FolderProcessor.java
----------------------------------------------------------------------
diff --git a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FolderProcessor.java b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FolderProcessor.java
index 119e5a4..1755fc0 100644
--- a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FolderProcessor.java
+++ b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FolderProcessor.java
@@ -111,8 +111,9 @@ public class FolderProcessor extends ProcessorAbstract {
 
         // Recurse through sub-folders if required
         try {
-            if (isRecurse())
+            if (isRecurse()) {
                 recurse();
+            }
         } catch (MessagingException mex) {
             LOGGER.error("A MessagingException has terminated recursing through sub-folders", mex);
         }
@@ -124,8 +125,9 @@ public class FolderProcessor extends ProcessorAbstract {
      * @throws MessagingException
      */
     protected void close() throws MessagingException {
-        if (null != getFolder() && getFolder().isOpen())
+        if (null != getFolder() && getFolder().isOpen()) {
             getFolder().close(true);
+        }
     }
 
     /**
@@ -153,8 +155,9 @@ public class FolderProcessor extends ProcessorAbstract {
     protected void open() throws MessagingException {
         int openFlag = Folder.READ_WRITE;
 
-        if (isOpenReadOnly())
+        if (isOpenReadOnly()) {
             openFlag = Folder.READ_ONLY;
+        }
 
         getFolder().open(openFlag);
     }
@@ -177,10 +180,11 @@ public class FolderProcessor extends ProcessorAbstract {
      */
     protected boolean isSeen(MimeMessage aMessage) throws MessagingException {
         boolean isSeen;
-        if (isMarkSeenPermanent())
+        if (isMarkSeenPermanent()) {
             isSeen = aMessage.isSet(Flags.Flag.SEEN);
-        else
+        } else {
             isSeen = handleMarkSeenNotPermanent(aMessage);
+        }
         return isSeen;
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
----------------------------------------------------------------------
diff --git a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
index ade4313..53f61de 100644
--- a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
+++ b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
@@ -403,11 +403,13 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void rejectRemoteRecipient(MailAddress recipient) throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveRemoteRecipient())
+        if (!isLeaveRemoteRecipient()) {
             setMessageDeleted();
+        }
 
-        if (isMarkRemoteRecipientSeen())
+        if (isMarkRemoteRecipientSeen()) {
             setMessageSeen();
+        }
 
         StringBuilder messageBuffer = new StringBuilder("Rejected mail intended for remote recipient: ");
         messageBuffer.append(recipient);
@@ -423,10 +425,12 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void rejectBlacklistedRecipient(MailAddress recipient) throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveBlacklisted())
+        if (!isLeaveBlacklisted()) {
             setMessageDeleted();
-        if (isMarkBlacklistedSeen())
+        }
+        if (isMarkBlacklistedSeen()) {
             setMessageSeen();
+        }
 
         StringBuilder messageBuffer = new StringBuilder("Rejected mail intended for blacklisted recipient: ");
         messageBuffer.append(recipient);
@@ -441,11 +445,13 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void rejectRecipientNotFound() throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveRecipientNotFound())
+        if (!isLeaveRecipientNotFound()) {
             setMessageDeleted();
+        }
 
-        if (isMarkRecipientNotFoundSeen())
+        if (isMarkRecipientNotFoundSeen()) {
             setMessageSeen();
+        }
 
         StringBuilder messageBuffer = new StringBuilder("Rejected mail for which a sole intended recipient could not be found.");
         messageBuffer.append(" Recipients: ");
@@ -466,11 +472,13 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void rejectUserUndefined(MailAddress recipient) throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveUserUndefined())
+        if (!isLeaveUserUndefined()) {
             setMessageDeleted();
+        }
 
-        if (isMarkUserUndefinedSeen())
+        if (isMarkUserUndefinedSeen()) {
             setMessageSeen();
+        }
 
         StringBuilder messageBuffer = new StringBuilder("Rejected mail intended for undefined user: ");
         messageBuffer.append(recipient);
@@ -486,11 +494,13 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void rejectMaxMessageSizeExceeded(int messageSize) throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveMaxMessageSizeExceeded())
+        if (!isLeaveMaxMessageSizeExceeded()) {
             setMessageDeleted();
+        }
 
-        if (isMarkMaxMessageSizeExceededSeen())
+        if (isMarkMaxMessageSizeExceededSeen()) {
             setMessageSeen();
+        }
 
         StringBuilder messageBuffer = new StringBuilder("Rejected mail exceeding message size limit. Message size: ");
         messageBuffer.append(messageSize / 1024);
@@ -505,11 +515,13 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void rejectRemoteReceivedHeaderInvalid() throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveRemoteReceivedHeaderInvalid())
+        if (!isLeaveRemoteReceivedHeaderInvalid()) {
             setMessageDeleted();
+        }
 
-        if (isMarkRemoteReceivedHeaderInvalidSeen())
+        if (isMarkRemoteReceivedHeaderInvalidSeen()) {
             setMessageSeen();
+        }
 
         StringBuilder messageBuffer = new StringBuilder("Rejected mail with an invalid Received: header at index ");
         messageBuffer.append(getRemoteReceivedHeaderIndex());
@@ -534,10 +546,11 @@ public class MessageProcessor extends ProcessorAbstract {
     protected MimeMessage createMessage() throws MessagingException {
         // Create a new messsage from the received message
         MimeMessage messageOut;
-        if (isMaxMessageSizeExceeded())
+        if (isMaxMessageSizeExceeded()) {
             messageOut = createEmptyMessage();
-        else
+        } else {
             messageOut = new MimeMessage(getMessageIn());
+        }
 
         // set the X-fetched headers
         // Note this is still required to detect bouncing mail and
@@ -561,8 +574,9 @@ public class MessageProcessor extends ProcessorAbstract {
         // Propogate the headers and subject
         @SuppressWarnings("unchecked")
         Enumeration<String> headersInEnum = getMessageIn().getAllHeaderLines();
-        while (headersInEnum.hasMoreElements())
+        while (headersInEnum.hasMoreElements()) {
             messageOut.addHeaderLine(headersInEnum.nextElement());
+        }
         messageOut.setSubject(getMessageIn().getSubject());
 
         // Add empty text
@@ -715,8 +729,9 @@ public class MessageProcessor extends ProcessorAbstract {
         StringBuilder domainBuffer = new StringBuilder();
         String[] headers = null;
 
-        if (getRemoteReceivedHeaderIndex() > -1)
+        if (getRemoteReceivedHeaderIndex() > -1) {
             headers = getMessageIn().getHeader(RFC2822Headers.RECEIVED);
+        }
 
         // There are RECEIVED headers if the array is not null
         // and its length at is greater than 0
@@ -731,8 +746,9 @@ public class MessageProcessor extends ProcessorAbstract {
                 // Find the "from" token
                 StringTokenizer tokenizer = new StringTokenizer(headers[headerIndex], headerTokens);
                 boolean inFrom = false;
-                while (!inFrom && tokenizer.hasMoreTokens())
+                while (!inFrom && tokenizer.hasMoreTokens()) {
                     inFrom = tokenizer.nextToken().equals("from");
+                }
                 // Add subsequent tokens to the domain buffer until another
                 // field is encountered or there are no more tokens
                 while (inFrom && tokenizer.hasMoreTokens()) {
@@ -782,10 +798,12 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void handleParseException(ParseException ex) throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveUndeliverable())
+        if (!isLeaveUndeliverable()) {
             setMessageDeleted();
-        if (isMarkUndeliverableSeen())
+        }
+        if (isMarkUndeliverableSeen()) {
             setMessageSeen();
+        }
         logStatusWarn("Message could not be delivered due to an error parsing a mail address.");
         LOGGER.debug("UNDELIVERABLE Message ID: {}", getMessageIn().getMessageID(), ex);
     }
@@ -798,11 +816,13 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected void handleUnknownHostException(UnknownHostException ex) throws MessagingException {
         // Update the flags of the received message
-        if (!isLeaveUndeliverable())
+        if (!isLeaveUndeliverable()) {
             setMessageDeleted();
+        }
 
-        if (isMarkUndeliverableSeen())
+        if (isMarkUndeliverableSeen()) {
             setMessageSeen();
+        }
 
         logStatusWarn("Message could not be delivered due to an error determining the remote domain.");
         LOGGER.debug("UNDELIVERABLE Message ID: {}", getMessageIn().getMessageID(), ex);
@@ -860,8 +880,9 @@ public class MessageProcessor extends ProcessorAbstract {
         int count = 0;
         while (enumeration.hasMoreElements()) {
             String header = enumeration.nextElement();
-            if (header.equals(getFetchTaskName()))
+            if (header.equals(getFetchTaskName())) {
                 count++;
+            }
         }
         return count >= 3;
     }
@@ -877,11 +898,13 @@ public class MessageProcessor extends ProcessorAbstract {
         getMailQueue().enQueue(mail);
 
         // Update the flags of the received message
-        if (!isLeave())
+        if (!isLeave()) {
             setMessageDeleted();
+        }
 
-        if (isMarkSeen())
+        if (isMarkSeen()) {
             setMessageSeen();
+        }
 
         // Log the status
         StringBuilder messageBuffer = new StringBuilder("Spooled message to recipients: ");
@@ -910,8 +933,9 @@ public class MessageProcessor extends ProcessorAbstract {
             String[] headers = msg.getHeader(getCustomRecipientHeader());
             if (headers != null) {
                 String mailFor = headers[0];
-                if (mailFor.startsWith("<") && mailFor.endsWith(">"))
+                if (mailFor.startsWith("<") && mailFor.endsWith(">")) {
                     mailFor = mailFor.substring(1, (mailFor.length() - 1));
+                }
                 return mailFor;
             }
         } else {
@@ -947,8 +971,9 @@ public class MessageProcessor extends ProcessorAbstract {
                                         end = c;
                                         break;
                                 }
-                                if (end > 0)
+                                if (end > 0) {
                                     break;
+                                }
                             }
                         }
                     }
@@ -957,8 +982,9 @@ public class MessageProcessor extends ProcessorAbstract {
                         String mailFor = received.substring(start, end);
 
                         // strip the <> around the address if there are any
-                        if (mailFor.startsWith("<") && mailFor.endsWith(">"))
+                        if (mailFor.startsWith("<") && mailFor.endsWith(">")) {
                             mailFor = mailFor.substring(1, (mailFor.length() - 1));
+                        }
 
                         return mailFor;
                     }
@@ -1093,8 +1119,9 @@ public class MessageProcessor extends ProcessorAbstract {
      */
     protected StringBuilder getStatusReport(String detailMsg) throws MessagingException {
         StringBuilder messageBuffer = new StringBuilder(detailMsg);
-        if (detailMsg.length() > 0)
+        if (detailMsg.length() > 0) {
             messageBuffer.append(' ');
+        }
         messageBuffer.append("Message ID: ");
         messageBuffer.append(getMessageIn().getMessageID());
         messageBuffer.append(". Flags: Seen = ");
@@ -1149,10 +1176,11 @@ public class MessageProcessor extends ProcessorAbstract {
     protected void setMessageSeen() throws MessagingException {
         // If the Seen flag is not handled by the folder
         // allow a handler to do whatever it deems necessary
-        if (!getMessageIn().getFolder().getPermanentFlags().contains(Flags.Flag.SEEN))
+        if (!getMessageIn().getFolder().getPermanentFlags().contains(Flags.Flag.SEEN)) {
             handleMarkSeenNotPermanent();
-        else
+        } else {
             getMessageIn().setFlag(Flags.Flag.SEEN, true);
+        }
     }
 
     /**
@@ -1209,32 +1237,41 @@ public class MessageProcessor extends ProcessorAbstract {
 
         aMail.setAttribute(getAttributePrefix() + "folderName", getMessageIn().getFolder().getFullName());
 
-        if (isRemoteRecipient())
+        if (isRemoteRecipient()) {
             aMail.setAttribute(getAttributePrefix() + "isRemoteRecipient", null);
+        }
 
-        if (isUserUndefined())
+        if (isUserUndefined()) {
             aMail.setAttribute(getAttributePrefix() + "isUserUndefined", true);
+        }
 
-        if (isBlacklistedRecipient())
+        if (isBlacklistedRecipient()) {
             aMail.setAttribute(getAttributePrefix() + "isBlacklistedRecipient", true);
+        }
 
-        if (isRecipientNotFound())
+        if (isRecipientNotFound()) {
             aMail.setAttribute(getAttributePrefix() + "isRecipientNotFound", true);
+        }
 
-        if (isMaxMessageSizeExceeded())
+        if (isMaxMessageSizeExceeded()) {
             aMail.setAttribute(getAttributePrefix() + "isMaxMessageSizeExceeded", Integer.toString(getMessageIn().getSize()));
+        }
 
-        if (isRemoteReceivedHeaderInvalid())
+        if (isRemoteReceivedHeaderInvalid()) {
             aMail.setAttribute(getAttributePrefix() + "isRemoteReceivedHeaderInvalid", true);
+        }
 
-        if (isDefaultSenderLocalPart())
+        if (isDefaultSenderLocalPart()) {
             aMail.setAttribute(getAttributePrefix() + "isDefaultSenderLocalPart", true);
+        }
 
-        if (isDefaultSenderDomainPart())
+        if (isDefaultSenderDomainPart()) {
             aMail.setAttribute(getAttributePrefix() + "isDefaultSenderDomainPart", true);
+        }
 
-        if (isDefaultRemoteAddress())
+        if (isDefaultRemoteAddress()) {
             aMail.setAttribute(getAttributePrefix() + "isDefaultRemoteAddress", true);
+        }
     }
 
     /**
@@ -1348,8 +1385,9 @@ public class MessageProcessor extends ProcessorAbstract {
             address = domain.substring(ipAddressStart + 1, ipAddressEnd);
         } else {
             int hostNameEnd = domain.indexOf(' ');
-            if (hostNameEnd == -1)
+            if (hostNameEnd == -1) {
                 hostNameEnd = domain.length();
+            }
             address = domain.substring(0, hostNameEnd);
         }
         validatedAddress = getDNSServer().getByName(address).getHostAddress();
@@ -1483,8 +1521,9 @@ public class MessageProcessor extends ProcessorAbstract {
      * @return Boolean
      */
     protected Boolean computeMaxMessageSizeExceeded() throws MessagingException {
-        if (0 == getMaxMessageSizeLimit())
+        if (0 == getMaxMessageSizeLimit()) {
             return Boolean.FALSE;
+        }
         return getMessageIn().getSize() > getMaxMessageSizeLimit();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/StoreProcessor.java
----------------------------------------------------------------------
diff --git a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/StoreProcessor.java b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/StoreProcessor.java
index d9cb43e..a41460f 100644
--- a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/StoreProcessor.java
+++ b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/StoreProcessor.java
@@ -60,15 +60,17 @@ public class StoreProcessor extends ProcessorAbstract {
             store = getSession().getStore(getJavaMailProviderName());
 
             // Connect
-            if (getHost() != null || getUser() != null || getPassword() != null)
+            if (getHost() != null || getUser() != null || getPassword() != null) {
                 store.connect(getHost(), getUser(), getPassword());
-            else
+            } else {
                 store.connect();
+            }
 
             // Get the Folder
             folder = store.getFolder(getJavaMailFolderName());
-            if (folder == null)
+            if (folder == null) {
                 LOGGER.error("{} No default folder", getFetchTaskName());
+            }
 
             // Process the Folder
             new FolderProcessor(folder, getAccount()).process();
@@ -77,8 +79,9 @@ public class StoreProcessor extends ProcessorAbstract {
             LOGGER.error("A MessagingException has terminated processing of this Folder", ex);
         } finally {
             try {
-                if (null != store && store.isConnected())
+                if (null != store && store.isConnected()) {
                     store.close();
+                }
             } catch (MessagingException ex) {
                 LOGGER.error("A MessagingException occured while closing the Store", ex);
             }

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
index 8693ed5..47c2e5e 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
@@ -43,8 +43,9 @@ public abstract class AbstractNettyImapRequestLineReader extends ImapRequestLine
         // only write the request out if this is not a retry to process the
         // request..
 
-        if (!retry)
+        if (!retry) {
             channel.write(cRequest);
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
index 89f0e95..b744406 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
@@ -109,8 +109,9 @@ public class ImapChannelUpstreamHandler extends SimpleChannelUpstreamHandler imp
             // remove the stored attribute for the channel to free up resources
             // See JAMES-1195
             ImapSession imapSession = (ImapSession) attributes.remove(ctx.getChannel());
-            if (imapSession != null)
+            if (imapSession != null) {
                 imapSession.logout();
+            }
             imapConnectionsMetric.decrement();
 
             super.channelClosed(ctx, e);
@@ -161,8 +162,9 @@ public class ImapChannelUpstreamHandler extends SimpleChannelUpstreamHandler imp
 
                 // logout on error not sure if that is the best way to handle it
                 final ImapSession imapSession = (ImapSession) attributes.get(ctx.getChannel());
-                if (imapSession != null)
+                if (imapSession != null) {
                     imapSession.logout();
+                }
 
                 // Make sure we close the channel after all the buffers were flushed out
                 Channel channel = ctx.getChannel();

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
index d6c46e6..f3da750 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapSession.java
@@ -140,8 +140,9 @@ public class NettyImapSession implements ImapSession, NettyConstants {
      * @see org.apache.james.imap.api.process.ImapSession#startTLS()
      */
     public boolean startTLS() {
-        if (!supportStartTLS())
+        if (!supportStartTLS()) {
             return false;
+        }
         channel.setReadable(false);
 
         SslHandler filter = new SslHandler(sslContext.createSSLEngine(), false);
@@ -175,8 +176,9 @@ public class NettyImapSession implements ImapSession, NettyConstants {
      * @see org.apache.james.imap.api.process.ImapSession#startCompression()
      */
     public boolean startCompression() {
-        if (!isCompressionSupported())
+        if (!isCompressionSupported()) {
             return false;
+        }
 
         channel.setReadable(false);
         ZlibDecoder decoder = new ZlibDecoder(ZlibWrapper.NONE);

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
index 364e94e..8a6e26f 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
@@ -56,13 +56,15 @@ public class ProtocolHandlerChainImpl implements ProtocolHandlerChain {
 
         // check if the coreHandlersPackage was specified in the config, if
         // not add the default
-        if (handlerchainConfig.getString("[@coreHandlersPackage]") == null)
+        if (handlerchainConfig.getString("[@coreHandlersPackage]") == null) {
             handlerchainConfig.addProperty("[@coreHandlersPackage]", coreHandlersPackage);
+        }
 
         String coreHandlersPackage = handlerchainConfig.getString("[@coreHandlersPackage]");
 
-        if (handlerchainConfig.getString("[@jmxHandlersPackage]") == null)
+        if (handlerchainConfig.getString("[@jmxHandlersPackage]") == null) {
             handlerchainConfig.addProperty("[@jmxHandlersPackage]", jmxHandlersPackage);
+        }
 
         String jmxHandlersPackage = handlerchainConfig.getString("[@jmxHandlersPackage]");
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index e4538bb..280304b 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -233,8 +233,9 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
         useStartTLS = config.getBoolean("tls.[@startTLS]", false);
         useSSL = config.getBoolean("tls.[@socketTLS]", false);
 
-        if (useSSL && useStartTLS)
+        if (useSSL && useStartTLS) {
             throw new ConfigurationException("startTLS is only supported when using plain sockets");
+        }
 
         if (useStartTLS || useSSL) {
             enabledCipherSuites = config.getStringArray("tls.supportedCipherSuites.cipherSuite");

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
index f5082b3..d0adf08 100644
--- a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
+++ b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
@@ -65,10 +65,12 @@ public class PortUtil {
         while (true) {
             try {
                 nextPortCandidate++;
-                if (PORT_LAST_USED == nextPortCandidate)
+                if (PORT_LAST_USED == nextPortCandidate) {
                     throw new RuntimeException("no free port found");
-                if (nextPortCandidate > PORT_RANGE_END)
+                }
+                if (nextPortCandidate > PORT_RANGE_END) {
                     nextPortCandidate = PORT_RANGE_START; // start over
+                }
 
                 // test, port is available
                 ServerSocket ss;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/MailPriorityHandler.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/MailPriorityHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/MailPriorityHandler.java
index 18d9ffd..7abbdaf 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/MailPriorityHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/MailPriorityHandler.java
@@ -66,15 +66,17 @@ public class MailPriorityHandler implements JamesMessageHook, ProtocolHandler {
                     }
 
                     // already the highest priority
-                    if (p == MailPrioritySupport.HIGH_PRIORITY)
+                    if (p == MailPrioritySupport.HIGH_PRIORITY) {
                         break;
+                    }
                 }
             }
         }
 
         // set the priority if one was found
-        if (p != null)
+        if (p != null) {
             mail.setAttribute(MailPrioritySupport.MAIL_PRIORITY, p);
+        }
         return new HookResult(HookReturnCode.DECLINED);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
index ee767b9..26e98bd 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
@@ -32,14 +32,16 @@ public class ValidSenderDomainHandler extends org.apache.james.protocols.smtp.co
     private DNSService dnsService;
 
     @Inject
-    public void setDNSService(DNSService dnsService) {
+    public void setDNSService(DNSService dnsService) {
         this.dnsService = dnsService;
     }
 
     @Override
     protected boolean hasMXRecord(SMTPSession session, String domain) {
         // null sender so return
-        if (domain == null) return false;
+        if (domain == null) {
+            return false;
+        }
 
         Collection<String> records = null;
             

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
index 7eeecf0..a7c8233 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
@@ -130,12 +130,13 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe
         super.doConfigure(configuration);
         if (isEnabled()) {
             String authRequiredString = configuration.getString("authRequired", "false").trim().toLowerCase(Locale.US);
-            if (authRequiredString.equals("true"))
+            if (authRequiredString.equals("true")) {
                 authRequired = AUTH_REQUIRED;
-            else if (authRequiredString.equals("announce"))
+            } else if (authRequiredString.equals("announce")) {
                 authRequired = AUTH_ANNOUNCE;
-            else
+            } else {
                 authRequired = AUTH_DISABLED;
+            }
             if (authRequired != AUTH_DISABLED) {
                 LOGGER.info("This SMTP server requires authentication.");
             } else {
@@ -176,8 +177,9 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe
 
             heloEhloEnforcement = configuration.getBoolean("heloEhloEnforcement", true);
 
-            if (authRequiredString.equals("true"))
+            if (authRequiredString.equals("true")) {
                 authRequired = AUTH_REQUIRED;
+            }
 
             // get the smtpGreeting
             smtpGreeting = configuration.getString("smtpGreeting", null);
@@ -260,8 +262,9 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe
          * @see org.apache.james.protocols.smtp.SMTPConfiguration#isAuthRequired(java.lang.String)
          */
         public boolean isAuthRequired(String remoteIP) {
-            if (SMTPServer.this.authRequired == AUTH_ANNOUNCE)
+            if (SMTPServer.this.authRequired == AUTH_ANNOUNCE) {
                 return true;
+            }
             boolean authRequired = SMTPServer.this.authRequired != AUTH_DISABLED;
             if (authorizedNetworks != null) {
                 authRequired = authRequired && !SMTPServer.this.authorizedNetworks.matchInetNetwork(remoteIP);

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
index e7124c3..0f61b5a 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPTestConfiguration.java
@@ -134,10 +134,12 @@ public class SMTPTestConfiguration extends DefaultConfigurationBuilder {
         addProperty("[@enabled]", true);
 
         addProperty("bind", "127.0.0.1:0");
-        if (m_connectionLimit != null)
+        if (m_connectionLimit != null) {
             addProperty("connectionLimit", "" + m_connectionLimit);
-        if (m_connectionBacklog != null)
+        }
+        if (m_connectionBacklog != null) {
             addProperty("connectionBacklog", "" + m_connectionBacklog);
+        }
 
         addProperty("helloName", "myMailServer");
         addProperty("connectiontimeout", 360000);
@@ -150,8 +152,9 @@ public class SMTPTestConfiguration extends DefaultConfigurationBuilder {
         addProperty("tls.[@startTLS]", m_startTLS);
         addProperty("tls.keystore", "file://conf/test_keystore");
         addProperty("tls.secret", "jamestest");
-        if (m_verifyIdentity)
+        if (m_verifyIdentity) {
             addProperty("verifyIdentity", m_verifyIdentity);
+        }
 
         // add the rbl handler
         if (m_useRBL) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c18f12f/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueue.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueue.java b/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueue.java
index 5c873ba..fc32416 100644
--- a/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueue.java
+++ b/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueue.java
@@ -168,12 +168,16 @@ public class FileMailQueue implements ManageableMailQueue {
             oout = new ObjectOutputStream(foout);
             oout.writeObject(mail);
             oout.flush();
-            if (sync) foout.getFD().sync();
+            if (sync) {
+                foout.getFD().sync();
+            }
             out = new FileOutputStream(item.getMessageFile());
 
             mail.getMessage().writeTo(out);
             out.flush();
-            if (sync) out.getFD().sync();
+            if (sync) {
+                out.getFD().sync();
+            }
 
             keyMappings.put(key, item);
 


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