|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2011 the original author or authors. |
| 2 | + * Copyright 2002-2012 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
34 | 34 | import javax.jms.MessageProducer;
|
35 | 35 | import javax.jms.QueueSession;
|
36 | 36 | import javax.jms.Session;
|
| 37 | +import javax.jms.TemporaryQueue; |
| 38 | +import javax.jms.TemporaryTopic; |
37 | 39 | import javax.jms.Topic;
|
38 | 40 | import javax.jms.TopicSession;
|
39 | 41 |
|
@@ -323,16 +325,18 @@ else if (isCacheConsumers()) {
|
323 | 325 | // let raw JMS invocation throw an exception if Destination (i.e. args[0]) is null
|
324 | 326 | if ((methodName.equals("createConsumer") || methodName.equals("createReceiver") ||
|
325 | 327 | methodName.equals("createSubscriber"))) {
|
326 |
| - if (args[0] != null) { |
327 |
| - return getCachedConsumer((Destination) args[0], |
| 328 | + Destination dest = (Destination) args[0]; |
| 329 | + if (dest != null && !(dest instanceof TemporaryQueue || dest instanceof TemporaryTopic)) { |
| 330 | + return getCachedConsumer(dest, |
328 | 331 | (args.length > 1 ? (String) args[1] : null),
|
329 | 332 | (args.length > 2 && (Boolean) args[2]),
|
330 | 333 | null);
|
331 | 334 | }
|
332 | 335 | }
|
333 | 336 | else if (methodName.equals("createDurableSubscriber")) {
|
334 |
| - if (args[0] != null) { |
335 |
| - return getCachedConsumer((Destination) args[0], |
| 337 | + Destination dest = (Destination) args[0]; |
| 338 | + if (dest != null) { |
| 339 | + return getCachedConsumer(dest, |
336 | 340 | (args.length > 2 ? (String) args[2] : null),
|
337 | 341 | (args.length > 3 && (Boolean) args[3]),
|
338 | 342 | (String) args[1]);
|
|
0 commit comments