Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E64918C9E for ; Fri, 30 Oct 2015 12:02:35 +0000 (UTC) Received: (qmail 26692 invoked by uid 500); 30 Oct 2015 12:02:35 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 26653 invoked by uid 500); 30 Oct 2015 12:02:34 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 26644 invoked by uid 99); 30 Oct 2015 12:02:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Oct 2015 12:02:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9B156E016C; Fri, 30 Oct 2015 12:02:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gtully@apache.org To: commits@activemq.apache.org Message-Id: <05db333159b243c2b4c34beceb76a824@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: activemq git commit: https://issues.apache.org/jira/browse/AMQ-6016 - ensure xstream inits transients to default values when it bypasses the default creation method through object deserialization. Can make it more general if there are ever more instances Date: Fri, 30 Oct 2015 12:02:34 +0000 (UTC) Repository: activemq Updated Branches: refs/heads/master f8bfff0bc -> 8136e67b4 https://issues.apache.org/jira/browse/AMQ-6016 - ensure xstream inits transients to default values when it bypasses the default creation method through object deserialization. Can make it more general if there are ever more instances of this. It avoids the need to check for null and sync Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/8136e67b Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/8136e67b Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/8136e67b Branch: refs/heads/master Commit: 8136e67b408a3d756241ebdf8de9347eb6135363 Parents: f8bfff0 Author: gtully Authored: Fri Oct 30 11:53:09 2015 +0000 Committer: gtully Committed: Fri Oct 30 12:01:08 2015 +0000 ---------------------------------------------------------------------- .../main/java/org/apache/activemq/command/ConsumerInfo.java | 5 +++++ .../apache/activemq/transport/xstream/XStreamWireFormat.java | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/8136e67b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java ---------------------------------------------------------------------- diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java index ed97a48..16e6f8c2 100755 --- a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java +++ b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerInfo.java @@ -527,4 +527,9 @@ public class ConsumerInfo extends BaseCommand { return result; } + public void initTransients() { + assignedGroupCount = new ConcurrentHashMap<>(); + lastDeliveredSequenceId = RemoveInfo.LAST_DELIVERED_UNSET; + } + } http://git-wip-us.apache.org/repos/asf/activemq/blob/8136e67b/activemq-http/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java ---------------------------------------------------------------------- diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java b/activemq-http/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java index 7174fdf..f98fc61 100755 --- a/activemq-http/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java @@ -24,6 +24,7 @@ import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.apache.activemq.command.ConsumerInfo; import org.apache.activemq.command.MarshallAware; import org.apache.activemq.command.MessageDispatch; import org.apache.activemq.transport.stomp.XStreamSupport; @@ -65,7 +66,11 @@ public class XStreamWireFormat extends TextWireFormat { @Override public Object unmarshalText(Reader reader) { - return getXStream().fromXML(reader); + Object val = getXStream().fromXML(reader); + if (val instanceof ConsumerInfo) { + ((ConsumerInfo)val).initTransients(); + } + return val; } @Override