activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6142
Date Mon, 11 Apr 2016 12:32:52 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 837da7e58 -> e69c2cbad


https://issues.apache.org/jira/browse/AMQ-6142

Moving the bytes copy to the parent Message class to solve this this
issue for all message types as that is the root cause


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

Branch: refs/heads/master
Commit: e69c2cbad6611fa355bd9eb592f03bd3b8f90abb
Parents: 837da7e
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Authored: Mon Apr 11 12:31:57 2016 +0000
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Mon Apr 11 12:31:57 2016 +0000

----------------------------------------------------------------------
 .../apache/activemq/command/ActiveMQBytesMessage.java    |  2 --
 .../main/java/org/apache/activemq/command/Message.java   | 11 +++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/e69c2cba/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
index 5d618ac..8806028 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/ActiveMQBytesMessage.java
@@ -890,8 +890,6 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
         Inflater inflater = new Inflater();
         ByteArrayOutputStream decompressed = new ByteArrayOutputStream();
         try {
-            //copy to prevent a race condition - AMQ-6142
-            dataSequence = new ByteSequence(dataSequence.getData(), dataSequence.getOffset(),
dataSequence.getLength());
             length = ByteSequenceData.readIntBig(dataSequence);
             dataSequence.offset = 0;
             byte[] data = Arrays.copyOfRange(dataSequence.getData(), 4, dataSequence.getLength());

http://git-wip-us.apache.org/repos/asf/activemq/blob/e69c2cba/activemq-client/src/main/java/org/apache/activemq/command/Message.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/Message.java b/activemq-client/src/main/java/org/apache/activemq/command/Message.java
index b2640b3..a500768 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/Message.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/Message.java
@@ -143,8 +143,8 @@ public abstract class Message extends BaseCommand implements MarshallAware,
Mess
             copy.properties = properties;
         }
 
-        copy.content = content;
-        copy.marshalledProperties = marshalledProperties;
+        copy.content = copyByteSequence(content);
+        copy.marshalledProperties = copyByteSequence(marshalledProperties);
         copy.dataStructure = dataStructure;
         copy.readOnlyProperties = readOnlyProperties;
         copy.readOnlyBody = readOnlyBody;
@@ -165,6 +165,13 @@ public abstract class Message extends BaseCommand implements MarshallAware,
Mess
         // copy.referenceCount = referenceCount;
     }
 
+    private ByteSequence copyByteSequence(ByteSequence content) {
+        if (content != null) {
+            return new ByteSequence(content.getData(), content.getOffset(), content.getLength());
+        }
+        return null;
+    }
+
     public Object getProperty(String name) throws IOException {
         if (properties == null) {
             if (marshalledProperties == null) {


Mime
View raw message