[hornetq-commits] JBoss hornetq SVN: r11845 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/integration/jms/server/management and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Dec 5 19:16:25 EST 2011
Author: clebert.suconic at jboss.com
Date: 2011-12-05 19:16:24 -0500 (Mon, 05 Dec 2011)
New Revision: 11845
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
Log:
JBPAPP-7504 - duplicate JNDI should throw an exception
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-12-05 23:34:09 UTC (rev 11844)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-12-06 00:16:24 UTC (rev 11845)
@@ -1407,7 +1407,10 @@
{
if (registry != null)
{
- registry.unbind(jndiName);
+ if (registry.lookup(jndiName) != null)
+ {
+ throw new NamingException(jndiName + " already has an object bound");
+ }
registry.bind(jndiName, objectToBind);
}
return true;
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2011-12-05 23:34:09 UTC (rev 11844)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2011-12-06 00:16:24 UTC (rev 11845)
@@ -28,6 +28,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -428,6 +429,24 @@
Assert.assertEquals(expiryAddress, queueControl.getExpiryAddress());
}
+ public void testDuplicateJNDI() throws Exception
+ {
+ String someQueue = RandomUtil.randomString();
+ String someOtherQueue = RandomUtil.randomString();
+ serverManager.createQueue(false, someQueue, null, true, someQueue, "/duplicate");
+ boolean exception = false;
+ try
+ {
+ serverManager.createQueue(false, someOtherQueue, null, true, someOtherQueue, "/duplicate");
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+
+ assertTrue(exception);
+ }
+
public void testExpireMessage() throws Exception
{
JMSQueueControl queueControl = createManagementControl();
More information about the hornetq-commits
mailing list