You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/11/30 13:27:44 UTC

[24/27] activemq-artemis git commit: Fix NPE with QueueQueryV3 plus a couple other things

Fix NPE with QueueQueryV3 plus a couple other things


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

Branch: refs/heads/ARTEMIS-780
Commit: 6ae97b22fff26c1eaa6a192529d0ab34125db73f
Parents: 762e4f1
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 23:57:05 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Wed Nov 30 00:05:27 2016 -0600

----------------------------------------------------------------------
 .../core/protocol/core/impl/ActiveMQSessionContext.java        | 3 +--
 .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java  | 6 +++---
 .../apache/activemq/artemis/core/server/impl/AddressInfo.java  | 4 +++-
 3 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6ae97b22/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
index 1a52e9b..5707645 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
@@ -79,7 +79,6 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionInd
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionProducerCreditsFailMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
-import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V2;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V3;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
@@ -266,7 +265,7 @@ public class ActiveMQSessionContext extends SessionContext {
    @Override
    public ClientSession.QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException {
       SessionQueueQueryMessage request = new SessionQueueQueryMessage(queueName);
-      SessionQueueQueryResponseMessage_V2 response = (SessionQueueQueryResponseMessage_V2) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V2);
+      SessionQueueQueryResponseMessage_V3 response = (SessionQueueQueryResponseMessage_V3) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V3);
 
       return response.toQueueQuery();
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6ae97b22/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 2147868..cf862c5 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -671,9 +671,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          // make an exception for the management address (see HORNETQ-29)
          response = new QueueQueryResult(name, managementAddress, true, false, null, -1, -1, autoCreateQueues, true, false, false, RoutingType.MULTICAST, -1);
       } else if (autoCreateQueues) {
-         response = new QueueQueryResult(name, name, true, false, null, 0, 0, true, false, false, false, null, 0);
+         response = new QueueQueryResult(name, name, true, false, null, 0, 0, true, false, false, false, RoutingType.MULTICAST, 0);
       } else {
-         response = new QueueQueryResult(null, null, false, false, null, 0, 0, false, false, false, false, null, 0);
+         response = new QueueQueryResult(null, null, false, false, null, 0, 0, false, false, false, false, RoutingType.MULTICAST, 0);
       }
 
       return response;
@@ -2405,7 +2405,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       if (info == null) {
          if (autoCreateAddress) {
-            postOffice.addAddressInfo(defaultAddressInfo);
+            postOffice.addAddressInfo(defaultAddressInfo.setAutoCreated(true));
             info = postOffice.getAddressInfo(addressName);
          } else {
             throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressName);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6ae97b22/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
index d05628c..6384ae9 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
@@ -120,7 +120,9 @@ public class AddressInfo {
          buff.append(routingType.toString() + ",");
       }
       // delete hanging comma
-      buff.deleteCharAt(buff.length() - 1);
+      if (buff.charAt(buff.length() - 1) == ',') {
+         buff.deleteCharAt(buff.length() - 1);
+      }
       buff.append("}");
       buff.append(", autoCreated=" + autoCreated);
       buff.append("]");