qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lqu...@apache.org
Subject [01/12] qpid-broker-j git commit: QPID-7531: [Java Broker, AMQP 1.0] Defensive guard against NPE
Date Thu, 28 Sep 2017 13:35:58 GMT
Repository: qpid-broker-j
Updated Branches:
  refs/heads/master d8613a623 -> 1b6034267


QPID-7531: [Java Broker, AMQP 1.0] Defensive guard against NPE


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/1b603426
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/1b603426
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/1b603426

Branch: refs/heads/master
Commit: 1b60342670f158e1d9e2c8350934f47184d9c99e
Parents: a352423
Author: Lorenz Quack <lquack@apache.org>
Authored: Mon Sep 25 12:09:10 2017 +0100
Committer: Lorenz Quack <lquack@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100

----------------------------------------------------------------------
 .../qpid/server/protocol/v1_0/ConsumerTarget_1_0.java  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/1b603426/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
index a032d53..5c8cfd2 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
@@ -23,9 +23,7 @@ package org.apache.qpid.server.protocol.v1_0;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,7 +37,6 @@ import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.MessageInstance;
 import org.apache.qpid.server.message.MessageInstanceConsumer;
 import org.apache.qpid.server.message.ServerMessage;
-import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.plugin.MessageConverter;
 import org.apache.qpid.server.protocol.MessageConverterRegistry;
@@ -66,6 +63,7 @@ import org.apache.qpid.server.transport.ProtocolEngine;
 import org.apache.qpid.server.txn.AutoCommitTransaction;
 import org.apache.qpid.server.txn.ServerTransaction;
 import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.server.util.StateChangeListener;
 
 class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
@@ -145,6 +143,14 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
         {
             converter =
                     (MessageConverter<? super ServerMessage, Message_1_0>) MessageConverterRegistry.getConverter(serverMessage.getClass(),
Message_1_0.class);
+            if (converter == null)
+            {
+                throw new ServerScopedRuntimeException(String.format(
+                        "Could not find message converter from '%s' to '%s'."
+                        + " This is unexpected since we should not try to send if the converter
is not present.",
+                        serverMessage.getClass(),
+                        Message_1_0.class));
+            }
             message = converter.convert(serverMessage, _linkEndpoint.getAddressSpace());
         }
 
@@ -497,7 +503,6 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0>
                     }
                 });
             }
-
             else if(outcome instanceof Modified)
             {
                 txn.addPostTransactionAction(new ServerTransaction.Action()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message