You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Timothy A. Bish (Jira)" <ji...@apache.org> on 2024/04/11 18:38:00 UTC
[jira] [Closed] (ARTEMIS-1899) AMQPMessage.getIntProperty() throws "UnsignedInteger cannot be cast to java.lang.Integer"
[ https://issues.apache.org/jira/browse/ARTEMIS-1899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy A. Bish closed ARTEMIS-1899.
------------------------------------
Resolution: Not A Problem
The methods are doing just what they say they do in their names, getting Integer or Long values, not UnsignedInteger or UnsignedLong values, that can be done via getObjectProperty as the issue already points out. The other option is to go to the proton message itself and get the application properties directly.
> AMQPMessage.getIntProperty() throws "UnsignedInteger cannot be cast to java.lang.Integer"
> -----------------------------------------------------------------------------------------
>
> Key: ARTEMIS-1899
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1899
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: AMQP
> Affects Versions: 2.6.0
> Reporter: Johan Stenberg
> Priority: Minor
>
> While testing a custom Artemis plugin with a RHEA based AMQP client I encountered the following exception in the server:
> {noformat}
> 23:56:57.993 WARN [y-threads)] ?(:) org.apache.qpid.proton.amqp.UnsignedInteger cannot be cast to java.lang.Integer
> java.lang.ClassCastException: org.apache.qpid.proton.amqp.UnsignedInteger cannot be cast to java.lang.Integer
> at org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage.getIntProperty(AMQPMessage.java:987) ~[artemis-amqp-protocol-2.6.0.jar:?]
> {noformat}
> On the client I am setting a message property with an int value and try to access this int value in the custom plugin on the server via AMQPMessage.getIntProperty.
> The problem lies in the fact that the AMQPMessage.getIntProperty method simply tries to cast the property to Integer and does not perform the same conversion as done by [getObjectProperty|https://github.com/apache/activemq-artemis/blob/master/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java#L1030]. Same is true for AMQPMessage.getLongProperty.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)