Author: clebert.suconic(a)jboss.com
Date: 2011-11-21 10:00:10 -0500 (Mon, 21 Nov 2011)
New Revision: 11728
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
Log:
Stomp to throw exception on inexistent destination = HORNETQ-799
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2011-11-21
14:56:37 UTC (rev 11727)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2011-11-21
15:00:10 UTC (rev 11728)
@@ -61,6 +61,8 @@
// Attributes ----------------------------------------------------
private final HornetQServer server;
+
+ private final SimpleString managementAddress;
private final Executor executor;
@@ -106,6 +108,7 @@
public StompProtocolManager(final HornetQServer server, final List<Interceptor>
interceptors)
{
this.server = server;
+ this.managementAddress = server.getConfiguration().getManagementAddress();
this.executor = server.getExecutorFactory().getExecutor();
}
@@ -341,6 +344,8 @@
}
subscriptionID = "subscription/" + destination;
}
+
+ validateDestination(new SimpleString(destination));
StompSession stompSession = getSession(connection);
stompSession.setNoLocal(noLocal);
if (stompSession.containsSubscription(subscriptionID))
@@ -583,10 +588,15 @@
*/
private void validateDestination(SimpleString address) throws Exception,
HornetQException
{
- Bindings binding = server.getPostOffice().lookupBindingsForAddress(address);
- if (binding == null || binding.getBindings().size() == 0)
+ if (!address.equals(managementAddress))
{
- throw new HornetQException(HornetQException.ADDRESS_DOES_NOT_EXIST,
"Address " + address + " has not been deployed");
+ Bindings binding = server.getPostOffice().lookupBindingsForAddress(address);
+ if (binding == null || binding.getBindings().size() == 0)
+ {
+ throw new HornetQException(HornetQException.ADDRESS_DOES_NOT_EXIST,
"Address " + address +
+ "
has not been deployed");
+ }
+
}
}
Show replies by date