james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [24/34] james-project git commit: JAMES-2085 Review "should never happen" in catch blocks
Date Wed, 05 Jul 2017 13:59:31 GMT
JAMES-2085 Review "should never happen" in catch blocks


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/154a7402
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/154a7402
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/154a7402

Branch: refs/heads/master
Commit: 154a740200e68b65a5416fb9f523d4cc0db91d9e
Parents: ad20e72
Author: benwa <btellier@linagora.com>
Authored: Mon Jul 3 17:18:39 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Wed Jul 5 17:13:48 2017 +0700

----------------------------------------------------------------------
 .../core/src/main/java/org/apache/james/core/MailImpl.java   | 8 ++++++--
 .../apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java | 5 ++++-
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/154a7402/server/container/core/src/main/java/org/apache/james/core/MailImpl.java
----------------------------------------------------------------------
diff --git a/server/container/core/src/main/java/org/apache/james/core/MailImpl.java b/server/container/core/src/main/java/org/apache/james/core/MailImpl.java
index ca94a9d..c0cbdeb 100644
--- a/server/container/core/src/main/java/org/apache/james/core/MailImpl.java
+++ b/server/container/core/src/main/java/org/apache/james/core/MailImpl.java
@@ -25,6 +25,8 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.PerRecipientHeaders;
 import org.apache.mailet.PerRecipientHeaders.Header;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
@@ -67,6 +69,8 @@ import java.util.UUID;
  */
 public class MailImpl implements Disposable, Mail {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(MailImpl.class);
+
     /**
      * We hardcode the serialVersionUID so that from James 1.2 on, MailImpl will
      * be deserializable (so your mail doesn't get lost)
@@ -181,10 +185,10 @@ public class MailImpl implements Disposable, Mail {
                 setAttributesRaw(attribs);
             }
         } catch (IOException e) {
-            // should never happen for in memory streams
+            LOGGER.error("Error while deserializing attributes", e);
             setAttributesRaw(new HashMap<String, Object>());
         } catch (ClassNotFoundException e) {
-            // should never happen as we just serialized it
+            LOGGER.error("Error while deserializing attributes", e);
             setAttributesRaw(new HashMap<String, Object>());
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/154a7402/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java
b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java
index 32abe94..8539dee 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/SMTPCommandHandlerStats.java
@@ -29,6 +29,8 @@ import org.apache.james.lifecycle.api.Disposable;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.api.handler.CommandHandler;
 import org.apache.james.protocols.lib.jmx.AbstractCommandHandlerStats;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -36,6 +38,7 @@ import org.apache.james.protocols.lib.jmx.AbstractCommandHandlerStats;
  */
 public class SMTPCommandHandlerStats extends AbstractCommandHandlerStats implements SMTPCommandHandlerStatsMBean,
Disposable {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(SMTPCommandHandlerStats.class);
     private final AtomicLong temp = new AtomicLong(0);
     private final AtomicLong perm = new AtomicLong(0);
     private final AtomicLong ok = new AtomicLong(0);
@@ -84,7 +87,7 @@ public class SMTPCommandHandlerStats extends AbstractCommandHandlerStats
impleme
             }
 
         } catch (NumberFormatException e) {
-            // should never happen
+            LOGGER.error("Error while reading SMTP return code " + response.getRetCode(),
e);
         }
     }
 


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


Mime
View raw message