summaryrefslogtreecommitdiff
path: root/java/common/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2007-05-07 09:28:15 +0000
committerMartin Ritchie <ritchiem@apache.org>2007-05-07 09:28:15 +0000
commit1d30de9905c3d66174429cd0ab5109e3e8961301 (patch)
tree763048c450e7bd15f71e55936e7f8950e99c23e2 /java/common/src
parentcd7355864aa6a517fdfc56746b960a4054693f15 (diff)
downloadqpid-python-1d30de9905c3d66174429cd0ab5109e3e8961301.tar.gz
QPID-466 Updated FieldTable to ensure no Decimal value is set that is larger than can be transmitted over AMQP.
That is a max scale value of Byte.MAX_VALUE and value of up to Integer.MAX_VALUE. Additional tests to ensure this is the case. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@535809 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpid/framing/FieldTable.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java b/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
index 5597919024..631a3ae149 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
@@ -552,6 +552,16 @@ public class FieldTable
public Object setDecimal(AMQShortString string, BigDecimal decimal)
{
+ if (decimal.longValue() > Integer.MAX_VALUE)
+ {
+ throw new UnsupportedOperationException("AMQP doesnot support decimals larger than " + Integer.MAX_VALUE);
+ }
+
+ if (decimal.scale() > Byte.MAX_VALUE)
+ {
+ throw new UnsupportedOperationException("AMQP doesnot support decimal scales larger than " + Byte.MAX_VALUE);
+ }
+
return setProperty(string, AMQType.DECIMAL.asTypedValue(decimal));
}