activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Stanton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQ-719) OpenWire ActiveMQTextMessage not sharable between JMS client and dotNet client
Date Mon, 19 Jun 2006 22:09:51 GMT
    [ https://issues.apache.org/activemq/browse/AMQ-719?page=comments#action_36432 ] 

James Stanton commented on AMQ-719:
-----------------------------------

This can be fixed by changing ActiveMQTextMessage "Text" getter/setter to look like this:
 (tested with Java 1.4.2)

public string Text
        {
            get {
                if (text == null)
                {
                    // now lets read the content
                    byte[] data = this.Content;
                    if (data != null)
                    {
                        // TODO assume that the text is ASCII
                        char[] chars = new char[data.Length - sizeof(int)];
                        for (int i = 0; i < chars.Length; i++)
                        {
                            chars[i] = (char)data[i + sizeof(int)];
                        }
                        text = new String(chars);
                    }
                }
                return text;
            }
            
            set {
                this.text = value;
                byte[] data = null;
                if (text != null)
                {
                    // TODO assume that the text is ASCII
                    byte[] intData = System.BitConverter.GetBytes(text.Length);
                    data = new byte[text.Length + intData.Length];  //int at the front of
it
                    char[] chars = text.ToCharArray();

                    for (int j = 0; j < intData.Length; j++)
                    {
                        data[j] = intData[intData.Length - j - 1];  //reverse byte order,
I'm not certain why this is necessary, but it is -Jamie
                    }

                    for (int i = 0; i < chars.Length; i++)
                    {
                        data[i + intData.Length] = (byte)chars[i];
                    }
                }
                this.Content = data;
            }
        }




Hope this helps.

Jamie

> OpenWire ActiveMQTextMessage not sharable between JMS client and dotNet client
> ------------------------------------------------------------------------------
>
>          Key: AMQ-719
>          URL: https://issues.apache.org/activemq/browse/AMQ-719
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client
>     Versions: 4.0
>  Environment: ActiveMQ incubator 4.0 release - windows xp pro - jdk1.5 - dotNet2003 -
openwire dotnet client from svn head
>     Reporter: James Bradt
>      Fix For: 4.1, 4.0.2

>
>
> The payload content for a JMS message contains initial bytes for the length of the text
string.  The payload content for an dotNet openwire content does not contain this information.
 This mismatch in payload results in invalid payloads when passing jms messages between technologies.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message