summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2010-09-18 21:19:18 +0000
committerRobert Gemmell <robbie@apache.org>2010-09-18 21:19:18 +0000
commitd737e450bfcbd0f85db0117f4110a5f42ec85a28 (patch)
tree7f4606d69d4f547e8de33c49e4a1e3f760edbb16 /qpid/java
parent5f6bbf73c297988661dabe959b1ed343637a3944 (diff)
downloadqpid-python-d737e450bfcbd0f85db0117f4110a5f42ec85a28.tar.gz
QPID-2868: guard against non-existent destinations when moving/copying
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@998547 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
index 112f682fdc..6fece81e88 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
@@ -1106,11 +1106,14 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener
public void moveMessagesToAnotherQueue(final long fromMessageId,
final long toMessageId,
String queueName,
- ServerTransaction txn)
+ ServerTransaction txn) throws IllegalArgumentException
{
final AMQQueue toQueue = getVirtualHost().getQueueRegistry().getQueue(new AMQShortString(queueName));
-
+ if (toQueue == null)
+ {
+ throw new IllegalArgumentException("Queue '" + queueName + "' is not registered with the virtualhost.");
+ }
List<QueueEntry> entries = getMessagesOnTheQueue(new QueueEntryFilter()
{
@@ -1178,9 +1181,13 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener
public void copyMessagesToAnotherQueue(final long fromMessageId,
final long toMessageId,
String queueName,
- final ServerTransaction txn)
+ final ServerTransaction txn) throws IllegalArgumentException
{
final AMQQueue toQueue = getVirtualHost().getQueueRegistry().getQueue(new AMQShortString(queueName));
+ if (toQueue == null)
+ {
+ throw new IllegalArgumentException("Queue '" + queueName + "' is not registered with the virtualhost.");
+ }
List<QueueEntry> entries = getMessagesOnTheQueue(new QueueEntryFilter()
{