logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject svn commit: r1481278 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java
Date Sat, 11 May 2013 09:33:29 GMT
Author: rpopma
Date: Sat May 11 09:33:29 2013
New Revision: 1481278

URL: http://svn.apache.org/r1481278
Log:
check if LogEvents array removed from buffer is empty (may happen in concurrent scenarios)
to avoid sending an empty email

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java?rev=1481278&r1=1481277&r2=1481278&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/SMTPManager.java
Sat May 11 09:33:29 2013
@@ -135,6 +135,9 @@ public class SMTPManager extends Abstrac
         }
         try {
             final LogEvent[] priorEvents = buffer.removeAll();
+            if (priorEvents == null || priorEvents.length == 0) {
+                return; // nothing to do, another thread already took all events
+            }
             final byte[] rawBytes = formatContentToBytes(priorEvents, appendEvent, layout);
 
             final String contentType = layout.getContentType();



Mime
View raw message