You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2016/08/08 15:47:03 UTC

activemq git commit: AMQ-6389 - init the size attribute prior to logging a message send in the logging plugin

Repository: activemq
Updated Branches:
  refs/heads/master 5e5b673af -> 924931568


AMQ-6389 - init the size attribute prior to logging a message send in the logging plugin


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/92493156
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/92493156
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/92493156

Branch: refs/heads/master
Commit: 9249315688e43aeb8f9b5f7a0ece71a5b08b6bda
Parents: 5e5b673
Author: gtully <ga...@gmail.com>
Authored: Mon Aug 8 16:46:49 2016 +0100
Committer: gtully <ga...@gmail.com>
Committed: Mon Aug 8 16:46:49 2016 +0100

----------------------------------------------------------------------
 .../apache/activemq/broker/util/LoggingBrokerPlugin.java  |  1 +
 .../test/java/org/apache/activemq/bugs/AMQ3779Test.java   | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/92493156/activemq-broker/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java b/activemq-broker/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
index 82d4214..a0b17bd 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/util/LoggingBrokerPlugin.java
@@ -276,6 +276,7 @@ public class LoggingBrokerPlugin extends BrokerPluginSupport {
     }
 
     private void logSend(Message copy) {
+        copy.getSize();
         Logger perDestinationsLogger = LOG;
         if (isPerDestinationLogger()) {
             ActiveMQDestination destination = copy.getDestination();

http://git-wip-us.apache.org/repos/asf/activemq/blob/92493156/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3779Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3779Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3779Test.java
index a076f03..edd334a 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3779Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3779Test.java
@@ -34,6 +34,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class AMQ3779Test {
@@ -44,7 +45,8 @@ public class AMQ3779Test {
     private BrokerService brokerService;
     private Appender appender;
     private final AtomicBoolean ok = new AtomicBoolean(false);
-
+    private final AtomicBoolean gotZeroSize = new AtomicBoolean(false);
+    
     @Before
     public void setUp() throws Exception {
         ok.set(false);
@@ -55,6 +57,10 @@ public class AMQ3779Test {
                 if (event.getLoggerName().toString().contains(qName)) {
                     ok.set(true);
                 }
+
+                if (event.getMessage().toString().contains("Sending") && event.getMessage().toString().contains("size = 0")) {
+                    gotZeroSize.set(true);
+                }
             }
         };
 
@@ -100,5 +106,7 @@ public class AMQ3779Test {
         connection.close();
 
         assertTrue("got expected log message", ok.get());
+
+        assertFalse("did not get zero size in send message", gotZeroSize.get());
     }
 }