This is an automated email from the ASF dual-hosted git repository.

tabish121 pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git


The following commit(s) were added to refs/heads/1.x by this push:
     new 49d2a823 QPIDJMS-624 Also support non-byte type-annotations
49d2a823 is described below

commit 49d2a823ee3e869170ce5d59e809709abd0a9c51
Author: David Voit <[email protected]>
AuthorDate: Mon Aug 3 20:11:53 2026 +0200

    QPIDJMS-624 Also support non-byte type-annotations
    
    NMS AMQP is using "byte" which are unsigned in dotnet.
    Yes, this is non-std compatible, but not handling these values
    is also non-std compatible.
    It's a MUST to sent data as signed byte.
    But it's also a MUST to read other numeric values in the
    type-annotations fields in the binding spec.
    
    (cherry picked from commit 452589ad695aed9b8b6d3fd1e510748e81cbb5f9)
---
 .../amqp/message/AmqpDestinationHelper.java        |  6 ++---
 .../amqp/message/AmqpDestinationHelperTest.java    | 29 ++++++++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
index 3f6dc2cc..7e904c4f 100644
--- 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
+++ 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelper.java
@@ -277,9 +277,9 @@ public class AmqpDestinationHelper {
         if (typeAnnotation == null) {
             // Doesn't exist, or null.
             return UNKNOWN_TYPE;
-        } else if (typeAnnotation instanceof Byte) {
-            // Return the value found.
-            return (Byte) typeAnnotation;
+        } else if (typeAnnotation instanceof Number) {
+            // Return the found value as a byte.
+            return ((Number)typeAnnotation).byteValue();
         } else {
             // Handle legacy strings.
             String typeString = String.valueOf(typeAnnotation);
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
index 1534eb4e..dc241222 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpDestinationHelperTest.java
@@ -44,6 +44,7 @@ import org.apache.qpid.jms.JmsTemporaryQueue;
 import org.apache.qpid.jms.JmsTemporaryTopic;
 import org.apache.qpid.jms.JmsTopic;
 import org.apache.qpid.jms.provider.amqp.AmqpConnection;
+import org.apache.qpid.proton.amqp.UnsignedByte;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
@@ -688,6 +689,34 @@ public class AmqpDestinationHelperTest {
         assertEquals(testAddress, destination.getAddress());
     }
 
+    @Test
+    public void testGetJmsReplToWithTempQueueUnsignedByteTypeAnnotation() 
throws Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn(UnsignedByte.valueOf(TEMP_QUEUE_TYPE));
+
+        JmsDestination destination = 
AmqpDestinationHelper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getAddress());
+    }
+
+    @Test
+    public void testGetJmsReplToWithTempQueueLongTypeAnnotation() throws 
Exception {
+        String testAddress = "testAddress";
+        AmqpJmsMessageFacade message = 
Mockito.mock(AmqpJmsMessageFacade.class);
+        Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
+        
Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn((long)
 TEMP_QUEUE_TYPE);
+
+        JmsDestination destination = 
AmqpDestinationHelper.getJmsReplyTo(message, null);
+        assertNotNull(destination);
+        assertTrue(destination.isQueue());
+        assertTrue(destination.isTemporary());
+        assertEquals(testAddress, destination.getAddress());
+    }
+
     
//========================================================================//
     //--------------- Test setToAddressFromDestination method 
----------------//
     
//========================================================================//


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to