diff options
author | Robert Godfrey <rgodfrey@apache.org> | 2014-08-25 15:35:10 +0000 |
---|---|---|
committer | Robert Godfrey <rgodfrey@apache.org> | 2014-08-25 15:35:10 +0000 |
commit | 522a81e02faf3e66e25161655927acf8454aa05e (patch) | |
tree | bc8d2256d815c6b4c599813705b0dc253c3a8c9a /qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java | |
parent | f9592e0d891b2eca8b91e06e6da0f8cd6c15f24c (diff) | |
download | qpid-python-522a81e02faf3e66e25161655927acf8454aa05e.tar.gz |
Merging from trunk r1619093:1620329 in the Java tree
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.30@1620350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java')
-rw-r--r-- | qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java index b7b56db15c..15e804e6f5 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java @@ -89,7 +89,15 @@ abstract class AttributeValueConverter<T> } else if(value instanceof String) { - return Long.valueOf(AbstractConfiguredObject.interpolate(object, (String) value)); + String interpolated = AbstractConfiguredObject.interpolate(object, (String) value); + try + { + return Long.valueOf(interpolated); + } + catch(NumberFormatException e) + { + throw new IllegalArgumentException("Cannot convert string '" + interpolated + "'",e); + } } else if(value == null) { @@ -117,7 +125,15 @@ abstract class AttributeValueConverter<T> } else if(value instanceof String) { - return Integer.valueOf(AbstractConfiguredObject.interpolate(object, (String) value)); + String interpolated = AbstractConfiguredObject.interpolate(object, (String) value); + try + { + return Integer.valueOf(interpolated); + } + catch(NumberFormatException e) + { + throw new IllegalArgumentException("Cannot convert string '" + interpolated + "'",e); + } } else if(value == null) { @@ -145,7 +161,15 @@ abstract class AttributeValueConverter<T> } else if(value instanceof String) { - return Short.valueOf(AbstractConfiguredObject.interpolate(object, (String) value)); + String interpolated = AbstractConfiguredObject.interpolate(object, (String) value); + try + { + return Short.valueOf(interpolated); + } + catch(NumberFormatException e) + { + throw new IllegalArgumentException("Cannot convert string '" + interpolated + "'",e); + } } else if(value == null) { |