Bug 915333
Summary: | Java client raises javax.jms.JMSException instead of InvalidDestinationException in BasicMessageProducer.send() method | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise MRG | Reporter: | Pavel Moravec <pmoravec> | ||||||||
Component: | qpid-java | Assignee: | Pavel Moravec <pmoravec> | ||||||||
Status: | CLOSED ERRATA | QA Contact: | Michal Toth <mtoth> | ||||||||
Severity: | low | Docs Contact: | |||||||||
Priority: | medium | ||||||||||
Version: | 2.3 | CC: | eallen, esammons, iboverma, jross, mtoth, pmoravec, sauchter, zkraus | ||||||||
Target Milestone: | 3.1 | Keywords: | Patch, TestCaseProvided | ||||||||
Target Release: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | qpid-java-0.30-2 | Doc Type: | Bug Fix | ||||||||
Doc Text: |
It was discovered that the javax.jms.JMSException raised when attempting to send a message to an invalid destination in the Java client was too generalized. This causes problems with exception handling in a Java application. The client has been improved to raise a proper InvalidDestinationException for this particular use case, which fixes the issue.
|
Story Points: | --- | ||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2015-04-14 13:46:26 UTC | Type: | Bug | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description
Pavel Moravec
2013-02-25 14:32:00 UTC
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 |