You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2017/09/28 13:36:00 UTC
[03/12] qpid-broker-j git commit: QPID-7531: [Java Broker,
AMQP 1.0] Prevent possible NullPointerException in dynamic source
creation
QPID-7531: [Java Broker, AMQP 1.0] Prevent possible NullPointerException in dynamic source creation
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/16caf690
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/16caf690
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/16caf690
Branch: refs/heads/master
Commit: 16caf69050feb337e8d42b014fc1d85d9c735f5b
Parents: 56cf7b8
Author: Lorenz Quack <lq...@apache.org>
Authored: Fri Sep 22 16:27:55 2017 +0100
Committer: Lorenz Quack <lq...@apache.org>
Committed: Thu Sep 28 14:30:17 2017 +0100
----------------------------------------------------------------------
.../qpid/server/protocol/v1_0/Session_1_0.java | 24 +++++++++++---------
1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/16caf690/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
index 2c44be0..801810e 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
@@ -696,8 +696,15 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
if (Boolean.TRUE.equals(source.getDynamic()))
{
- MessageSource tempQueue = createDynamicSource(link, source.getDynamicNodeProperties());
- source.setAddress(tempQueue.getName()); // todo : temporary topic
+ MessageSource tempSource = createDynamicSource(link, source.getDynamicNodeProperties());
+ if(tempSource != null)
+ {
+ source.setAddress(_primaryDomain + tempSource.getName());
+ }
+ else
+ {
+ throw new AmqpErrorException(AmqpError.INTERNAL_ERROR, "Cannot create dynamic source");
+ }
}
String address = source.getAddress();
@@ -763,10 +770,10 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
return exchangeDestination;
}
- private MessageSource createDynamicSource(final Link_1_0<?, ?> link,
- Map properties)
+ private MessageSource createDynamicSource(final Link_1_0<?, ?> link, Map properties) throws AmqpErrorException
{
- final String queueName = _primaryDomain + "TempQueue" + UUID.randomUUID().toString();
+ // TODO temporary topics?
+ final String queueName = "TempQueue" + UUID.randomUUID().toString();
try
{
Map<String, Object> attributes = convertDynamicNodePropertiesToAttributes(link, properties, queueName);
@@ -776,12 +783,7 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget
}
catch (AccessControlException e)
{
- Error error = new Error();
- error.setCondition(AmqpError.UNAUTHORIZED_ACCESS);
- error.setDescription(e.getMessage());
-
- _connection.close(error);
- return null;
+ throw new AmqpErrorException(AmqpError.UNAUTHORIZED_ACCESS, e.getMessage());
}
catch (AbstractConfiguredObject.DuplicateNameException e)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org