QPID-6046 : [Java Broker] [AMQP 1.0] when creating an outgoing link from the address amq.fanout (or any fanout exchange) bind the temporary queue to the exchange witht the queue name

git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1620629 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
index def7552..660575e 100644
--- a/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
+++ b/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
@@ -323,6 +323,19 @@
                 {
                     exchange.addBinding(exchangeDestination.getInitialRoutingAddress(),queue,null);
                 }
+                if(binding == null
+                   && exchangeDestination.getInitialRoutingAddress() != null
+                   && exchange.getType().equals(ExchangeDefaults.FANOUT_EXCHANGE_CLASS))
+                {
+                    exchange.addBinding(queue.getName(), queue, null);
+                }
+                else if(binding == null
+                     && exchangeDestination.getInitialRoutingAddress() != null
+                     && exchange.getType().equals(ExchangeDefaults.TOPIC_EXCHANGE_CLASS))
+                {
+                    exchange.addBinding("#", queue, null);
+                }
+
                 source.setDistributionMode(StdDistMode.COPY);
 
                 qd = new QueueDestination(queue);