Bug 731399

Summary: Error message on assert fails shall be more specific
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-javaAssignee: messaging-bugs <messaging-bugs>
Status: NEW --- QA Contact: Messaging QE <messaging-qe-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 2.0CC: jross
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Matousek 2011-08-17 14:14:15 UTC
Description of problem:

When assertion used in address string fails, following error message is always displayed:
org.apache.qpid.AMQException: The name XXX supplied in the address doesn't resolve to an exchange or a queue

I thing the message shall be more specific.
It would be better to indicate that in some way the assertion failed.
It is not necessary to include precise details, but the error at present makes it look like the queue or exchange does not exist.

Even if it was: "The name XXX supplied in the address doesn't resolve to an exchange or a queue with the specified properties"

Please see additional info for details.

Version-Release number of selected component (if applicable):
qpid-java-0.10-6

How reproducible:
100%

Steps to Reproduce:
1. qpid-config add queue q
2. drain "q;{assert:always, node:{durable:True}}"
3. following exception is received:
org.apache.qpid.AMQException: The name 'q' supplied in the address doesn't resolve to an exchange or a queue
  
Actual results:
Too general error message is displayed.

Expected results:
The error message shall indicates in some way that the assertion fails.

Additional info:

C++ client:

# qpid-config add queue q

# $cppapi/drain "q;{assert:always, node:{durable:True}}"
Queue not durable: q

# $cppapi/drain "q;{assert:always, node:{x-declare: {exclusive:True}}}"
Queue not exclusive: q

JAVA client:

# qpid-config add queue q
# java -cp $CLASSPATH org.apache.qpid.example.Drain "q;{assert:always, node:{durable:True}}"
{}
Exception in thread "main" javax.jms.JMSException: Error registering consumer: org.apache.qpid.AMQException: The name 'q' supplied in the address doesn't resolve to an exchange or a queue
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2052)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:1995)
	at org.apache.qpid.client.AMQConnectionDelegate_0_10.executeRetrySupport(AMQConnectionDelegate_0_10.java:314)
	at org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:622)
	at org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102)
	at org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:1993)
	at org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:965)
	at org.apache.qpid.example.Drain.<init>(Drain.java:70)
	at org.apache.qpid.example.Drain.main(Drain.java:103)
Caused by: org.apache.qpid.AMQException: The name 'q' supplied in the address doesn't resolve to an exchange or a queue
	at org.apache.qpid.client.AMQSession_0_10.handleAddressBasedDestination(AMQSession_0_10.java:1237)
	at org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2836)
	at org.apache.qpid.client.AMQSession.access$500(AMQSession.java:120)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2029)
	... 8 more

# java -cp $CLASSPATH org.apache.qpid.example.Drain "q;{assert:always, node:{x-declare: {exclusive:True}}}"
{}
Exception in thread "main" javax.jms.JMSException: Error registering consumer: org.apache.qpid.AMQException: The name 'q' supplied in the address doesn't resolve to an exchange or a queue
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2052)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:1995)
	at org.apache.qpid.client.AMQConnectionDelegate_0_10.executeRetrySupport(AMQConnectionDelegate_0_10.java:314)
	at org.apache.qpid.client.AMQConnection.executeRetrySupport(AMQConnection.java:622)
	at org.apache.qpid.client.failover.FailoverRetrySupport.execute(FailoverRetrySupport.java:102)
	at org.apache.qpid.client.AMQSession.createConsumerImpl(AMQSession.java:1993)
	at org.apache.qpid.client.AMQSession.createConsumer(AMQSession.java:965)
	at org.apache.qpid.example.Drain.<init>(Drain.java:70)
	at org.apache.qpid.example.Drain.main(Drain.java:103)
Caused by: org.apache.qpid.AMQException: The name 'q' supplied in the address doesn't resolve to an exchange or a queue
	at org.apache.qpid.client.AMQSession_0_10.handleAddressBasedDestination(AMQSession_0_10.java:1237)
	at org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2836)
	at org.apache.qpid.client.AMQSession.access$500(AMQSession.java:120)
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2029)
	... 8 more

Comment 1 Frantisek Reznicek 2014-03-05 08:10:32 UTC
Defect nominated for Open Source Contest Spring 2014.

Qpid resp. MRG/M References:
  http://qpid.apache.org
  http://qpid.apache.org/components/qpid-jms/index.html
  Messaging Programming Reference, Messaging Installation and Configuration Guide at
    https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_MRG/
  http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol
  http://rajith.2rlabs.com/2007/09/06/amqp-in-10-mins-part1-introduction/

Goals:
  1] propose patch that fixes the above described issue
  2] propose testing scenario down-to individual steps
  3] implement / automate testing scenario as part of already existing upstream qpid-java unit test framework


In case you struggle feel free to:
 * join IRC channel #qpid on http://freenode.net/ and ask
 * ask in Bugzilla using comment field
 * ask on mailing list, see https://qpid.apache.org/discussion.html page for details