From cea2762f31747d337e8ccd06a8bfdcf0be9bccc7 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 25 Jun 2010 20:22:43 +0000 Subject: Added null checks in fillInCommonNodeArgs() and when trying to parse capacities in getLink() Also fixed an error when parsing the qpid queue policy type. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@958102 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/client/messaging/address/AddressHelper.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'java/client/src') diff --git a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java index dc7aca7d3e..50757931aa 100644 --- a/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java +++ b/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java @@ -129,7 +129,7 @@ public class AddressHelper options.setMaxSize(args.getInt(QpidQueueOptions.QPID_MAX_SIZE)); } - if (args.getInt(QpidQueueOptions.QPID_POLICY_TYPE) != null) + if (args.getString(QpidQueueOptions.QPID_POLICY_TYPE) != null) { options.setPolicyType(args.getString(QpidQueueOptions.QPID_POLICY_TYPE)); } @@ -278,7 +278,10 @@ public class AddressHelper private void fillInCommonNodeArgs(Node node,Map parent,MapAccessor argsMap) { - node.setDurable(nodeProps.getBoolean(DURABLE) == null? false : nodeProps.getBoolean(DURABLE)); + if (nodeProps != null) + { + node.setDurable(nodeProps.getBoolean(DURABLE) == null? false : nodeProps.getBoolean(DURABLE)); + } node.setAutoDelete(argsMap.getBoolean(AUTO_DELETE) == null? false : argsMap.getBoolean(AUTO_DELETE)); node.setAlternateExchange(argsMap.getString(ALT_EXCHANGE)); node.setBindings(getBindings(parent)); @@ -318,13 +321,16 @@ public class AddressHelper { MapAccessor capacityProps = new MapAccessor( (Map)((Map)address.getOptions().get(LINK)).get(CAPACITY)); - link.setConsumerCapacity(capacityProps.getInt(CAPACITY_SOURCE)); - link.setProducerCapacity(capacityProps.getInt(CAPACITY_TARGET)); + link.setConsumerCapacity(capacityProps.getInt(CAPACITY_SOURCE) == null ? + 0 : capacityProps.getInt(CAPACITY_SOURCE)); + link.setProducerCapacity(capacityProps.getInt(CAPACITY_TARGET) == null ? + 0 : capacityProps.getInt(CAPACITY_TARGET)); } else { - link.setConsumerCapacity(linkProps.getInt(CAPACITY)); - link.setProducerCapacity(linkProps.getInt(CAPACITY)); + int cap = linkProps.getInt(CAPACITY) == null ? 0 : linkProps.getInt(CAPACITY); + link.setConsumerCapacity(cap); + link.setProducerCapacity(cap); } link.setFilter(linkProps.getString(FILTER)); // so far filter type not used -- cgit v1.2.1