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

Havret pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git


The following commit(s) were added to refs/heads/main by this push:
     new 15b1593  fix type annotation to sbyte
15b1593 is described below

commit 15b15932d40c83ac8fdd0760b269c871b515e50c
Author: Federico Barresi <[email protected]>
AuthorDate: Mon Apr 13 14:54:17 2026 +0200

    fix type annotation to sbyte
    
    in dotnet byte is by default an unsigned type,
    but in the amqp 1.0 spec byte is defined as signed type
    (see 1.6.7 in the amqp 1.0 spec)
    
    Co-authored-by: David Voit <[email protected]>
---
 src/NMS.AMQP/Util/AmqpDestinationHelper.cs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/NMS.AMQP/Util/AmqpDestinationHelper.cs 
b/src/NMS.AMQP/Util/AmqpDestinationHelper.cs
index 117da2e..e229343 100644
--- a/src/NMS.AMQP/Util/AmqpDestinationHelper.cs
+++ b/src/NMS.AMQP/Util/AmqpDestinationHelper.cs
@@ -206,7 +206,7 @@ namespace Apache.NMS.AMQP.Util
 
         private static void SetAnnotationFromDestination(Symbol key, 
IDestination destination, MessageAnnotations annotations)
         {
-            byte? typeValue = ToTypeAnnotation(destination);
+            var typeValue = ToTypeAnnotation(destination);
 
             if (typeValue == null)
                 annotations.Map.Remove(key);
@@ -214,24 +214,26 @@ namespace Apache.NMS.AMQP.Util
                 annotations.Map[key] = typeValue;
         }
 
-        private static byte? ToTypeAnnotation(IDestination destination)
+        private static sbyte? ToTypeAnnotation(IDestination destination)
         {
+            //in dotnet byte is by default an unsigned type, but in the amqp 
1.0 spec byte is defined as signed type (see 1.6.7 in the amqp 1.0 spec)
+
             if (destination == null)
                 return null;
 
             if (destination.IsQueue)
             {
                 if (destination.IsTemporary)
-                    return MessageSupport.JMS_DEST_TYPE_TEMP_QUEUE;
+                    return (sbyte)MessageSupport.JMS_DEST_TYPE_TEMP_QUEUE;
                 else
-                    return MessageSupport.JMS_DEST_TYPE_QUEUE;
+                    return (sbyte)MessageSupport.JMS_DEST_TYPE_QUEUE;
             }
             else if (destination.IsTopic)
             {
                 if (destination.IsTemporary)
-                    return MessageSupport.JMS_DEST_TYPE_TEMP_TOPIC;
+                    return (sbyte)MessageSupport.JMS_DEST_TYPE_TEMP_TOPIC;
                 else
-                    return MessageSupport.JMS_DEST_TYPE_TOPIC;
+                    return (sbyte)MessageSupport.JMS_DEST_TYPE_TOPIC;
             }
 
             return null;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to