protected override void InitializeBody()

in src/NMS.AMQP/Provider/Amqp/Message/AmqpNmsStreamMessageFacade.cs [88:118]


        protected override void InitializeBody()
        {
            if (Message.BodySection == null)
            {
                list = InitializeEmptyBody(true);
            }
            else if (Message.BodySection is AmqpSequence amqpSequence)
            {
                list = amqpSequence.List ?? InitializeEmptyBody(true);
            }
            else if (Message.BodySection is AmqpValue amqpValue)
            {
                object value = amqpValue.Value;
                if (value == null)
                {
                    list = InitializeEmptyBody(false);
                }
                else if (value is IList valueList)
                {
                    list = valueList;
                }
                else
                {
                    throw new IllegalStateException($"Unexpected amqp-value body content type: {value.GetType().Name}");
                }
            }
            else
            {
                throw new IllegalStateException($"Unexpected message body type: {Message.BodySection.GetType().Name}");
            }
        }