Description of problem: Trying to send a message to a temporary address that does not further exists raises javax.jms.JMSException while InvalidDestinationException should be raised instead. Version-Release number of selected component (if applicable): qpid-java-*-0.18-7 How reproducible: 100% Steps to Reproduce: Run attached JUnit test Actual results: JUnit version 4.10 .log4j:WARN No appenders could be found for logger (org.apache.qpid.jndi.PropertiesFileInitialContextFactory). log4j:WARN Please initialize the log4j system properly. javax.jms.JMSException: Session for temporary destination has been closed at org.apache.qpid.client.BasicMessageProducer.checkTemporaryDestination(BasicMessageProducer.java:550) at org.apache.qpid.client.BasicMessageProducer.sendImpl(BasicMessageProducer.java:493) at org.apache.qpid.client.BasicMessageProducer.send(BasicMessageProducer.java:309) at InvalidDestinationTest.sendToTempQueueWhenItDoesNotExist(InvalidDestinationTest.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:24) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at org.junit.runner.JUnitCore.run(JUnitCore.java:136) at org.junit.runner.JUnitCore.run(JUnitCore.java:117) at org.junit.runner.JUnitCore.runMain(JUnitCore.java:98) at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:53) at org.junit.runner.JUnitCore.main(JUnitCore.java:45) E Time: 0.509 There was 1 failure: 1) sendToTempQueueWhenItDoesNotExist(InvalidDestinationTest) java.lang.AssertionError: Unexpected exception type at org.junit.Assert.fail(Assert.java:93) at InvalidDestinationTest.sendToTempQueueWhenItDoesNotExist(InvalidDestinationTest.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:24) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at org.junit.runner.JUnitCore.run(JUnitCore.java:136) at org.junit.runner.JUnitCore.run(JUnitCore.java:117) at org.junit.runner.JUnitCore.runMain(JUnitCore.java:98) at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:53) at org.junit.runner.JUnitCore.main(JUnitCore.java:45) FAILURES!!! Tests run: 1, Failures: 1 Expected results: Test passes. Additional info:
Created attachment 702368 [details] reproducer (JUnit test)
Created attachment 702400 [details] Trivial patch Trivial patch based on qpid-java-* 0.18-2 version.
Fixed upstream at http://svn.apache.org/r1506095
Created attachment 781984 [details] Reproducer (stand-alone) Stand-alone reproducer that raises javax.jms.JMSException instead of InvalidDestinationException. The stack trace shows that BasicMessageProducer.checkTemporaryDestination() is the source of the exception. Note: Pavel's patch modified the checkTemporaryDestination() method, but the upstream fix at http://svn.apache.org/r1506095 doesn't. It modifies validateDestination(). Output from this reproducer: javax.jms.JMSException: Session for temporary destination has been closed at org.apache.qpid.client.BasicMessageProducer.checkTemporaryDestination(BasicMessageProducer.java:539) at org.apache.qpid.client.BasicMessageProducer.sendImpl(BasicMessageProducer.java:482) at org.apache.qpid.client.BasicMessageProducer.send(BasicMessageProducer.java:298) at org.apache.qpid.example.InvalidDestination.runTest(InvalidDestination.java:83) at org.apache.qpid.example.InvalidDestination.main(InvalidDestination.java:50) Fail - Unexpected exception type class javax.jms.JMSException
Returning to ASSIGNED since the old exception is still being raised from checkTemporaryDestination() as reported in the original bz description. See comment 4 Tested on rhel 6.4 qpid-java-client-0.22-5.el6.noarch qpid-java-common-0.22-5.el6.noarch qpid-java-example-0.22-5.el6.noarch
(In reply to Ernie from comment #5) > Returning to ASSIGNED since the old exception is still being raised from > checkTemporaryDestination() as reported in the original bz description. > See comment 4 > > Tested on rhel 6.4 > qpid-java-client-0.22-5.el6.noarch > qpid-java-common-0.22-5.el6.noarch > qpid-java-example-0.22-5.el6.noarch /me checking source code and execution path of the reproducer. The reproducer does not invoke validateDestination method where the patch has been applied. Moreover, even adding a call of the method to the execution path of the reproducer does not change the behaviour. As both tests: if (!(destination instanceof AMQDestination)) if(!amqDestination.isExchangeExistsChecked()) are evaluated to false and thus no exception can be raised. IMHO my patch changing exceptions in checkTemporaryDestination from JMSException to InvalidDestinationException is correct. As if temporary destination check fails, "invalid destination" exception should be raised in any case. Rajith's fix makes sense as well, but it does not fix this BZ. I re-verified my patch on qpid-java 0.22-5 and it works fine.
This is handled properly in the new client.
Confirming it is not fixed in qpid-java-client-0.22-6. Having a look on it now.
Fixed in upstream in r1613984.
Reproduced on rhel6i using qpid-cpp-server 0.22-51 qpid-java-client-0.22-8.el6.noarch Wrong exception has been thrown as "expected". Verified on both rhel6 qpid-java-common-0.30-5.el6.noarch qpid-java-example-0.30-5.el6.noarch qpid-java-client-0.30-5.el6.noarch & rhel7 qpid-java-common-0.30-6.el7.noarch qpid-java-example-0.30-6.el7.noarch qpid-java-client-0.30-6.el7.noarch using provided standalone reproducer with expected Exception thrown. "Success - InvalidDestinationException exception type received"
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2015-0805.html