summaryrefslogtreecommitdiff
path: root/java/client
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2012-12-07 22:52:41 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2012-12-07 22:52:41 +0000
commit96215798dfefd9fe1a21e0aaa50306ef3ec9d073 (patch)
tree2e88877c64476df2fabe49c642b03461c1e4a898 /java/client
parent65b07f45fac6e826b9b924bb4003a7a03bf1f186 (diff)
downloadqpid-python-96215798dfefd9fe1a21e0aaa50306ef3ec9d073.tar.gz
QPID-4496 Added error handling to cover the cases mentioned in the JIRA.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1418539 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client')
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
index 12b174198a..dc4a4be496 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
@@ -1095,7 +1095,7 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic
return AMQMessageDelegateFactory.FACTORY_0_10;
}
- public boolean isExchangeExist(AMQDestination dest,boolean assertNode)
+ public boolean isExchangeExist(AMQDestination dest,boolean assertNode) throws AMQException
{
boolean match = true;
ExchangeQueryResult result = getQpidSession().exchangeQuery(dest.getAddressName(), Option.NONE).get();
@@ -1118,6 +1118,12 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic
dest.setExchangeClass(new AMQShortString(result.getType()));
}
}
+
+ if (assertNode)
+ {
+ if (!match) throw new AMQException("Aessert failed for address : " + dest +", Result was : " + result);
+ }
+
return match;
}
@@ -1137,9 +1143,10 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic
(result.getExclusive() == node.isExclusive()) &&
(matchProps(result.getArguments(),node.getDeclareArgs()));
}
- else if (match)
+
+ if (assertNode)
{
- // should I use the queried details to update the local data structure.
+ if (!match) throw new AMQException("Aessert failed for address : " + dest +", Result was : " + result);
}
}
catch(SessionException e)
@@ -1218,32 +1225,32 @@ public class AMQSession_0_10 extends AMQSession<BasicMessageConsumer_0_10, Basic
{
case AMQDestination.QUEUE_TYPE:
{
- if (isQueueExist(dest,assertNode))
+ if(createNode)
{
setLegacyFieldsForQueueType(dest);
+ handleQueueNodeCreation(dest,noLocal);
break;
}
- else if(createNode)
+ else if (isQueueExist(dest,assertNode))
{
setLegacyFieldsForQueueType(dest);
- handleQueueNodeCreation(dest,noLocal);
break;
- }
+ }
}
case AMQDestination.TOPIC_TYPE:
{
- if (isExchangeExist(dest,assertNode))
+ if(createNode)
{
setLegacyFiledsForTopicType(dest);
verifySubject(dest);
+ handleExchangeNodeCreation(dest);
break;
}
- else if(createNode)
+ else if (isExchangeExist(dest,assertNode))
{
setLegacyFiledsForTopicType(dest);
verifySubject(dest);
- handleExchangeNodeCreation(dest);
break;
}
}