activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMQ-3387) Backards imcompatibilitiy with version 5.3 and previous with the http protocol due chage on charset encoding
Date Mon, 11 Jul 2011 15:28:00 GMT

     [ https://issues.apache.org/jira/browse/AMQ-3387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Timothy Bish updated AMQ-3387:
------------------------------

    Description: 
Changes in charset encoding from java modified UTF-8 to standard UTF-8 in class org.apache.activemq.transport.util.TextWireFormat
makes clients and broker using different versions not compatible when using http transport
protocol. Like a client 5.3 and broker 5.5 can not interchange messages in http transport
protocol or the other way around. Backards compatibility support could be easily provided
with :

{code}

   public Object unmarshal(DataInput in) throws IOException {

    	String value;
    	try {
    		int length = in.readInt();
    		byte[] utf8 = new byte[length];
    		in.readFully(utf8);
    		value = new String(utf8, "UTF-8");
    		return unmarshalText(value);
    	} catch(Exception ex) {
    		DataByteArrayInputStream dbais = (DataByteArrayInputStream) in;
    		dbais.restart(0);
    		value = dbais.readUTF();
    		return unmarshalText(value); 
    	}    
    }


    and in HttpClientTransport calling unmarshal with a DataByteArrayInputStream:

    DataByteArrayInputStream stream = new DataByteArrayInputStream(httpMethod.getResponseBody());
    Object command = (Object)getTextWireFormat().unmarshal(stream);

{code}

    With this changes was able to connect legacy clients 5.3 to new 5.5 brokers.


  was:
Changes in charset encoding from java modified UTF-8 to standard UTF-8 in class org.apache.activemq.transport.util.TextWireFormat
makes clients and broker using different versions not compatible when using http transport
protocol. Like a client 5.3 and broker 5.5 can not interchange messages in http transport
protocol or the other way around. Backards compatibility support could be easily provided
with :

   public Object unmarshal(DataInput in) throws IOException {

    	String value;
    	try {
    		int length = in.readInt();
    		byte[] utf8 = new byte[length];
    		in.readFully(utf8);
    		value = new String(utf8, "UTF-8");
    		return unmarshalText(value);
    	} catch(Exception ex) {
    		DataByteArrayInputStream dbais = (DataByteArrayInputStream) in;
    		dbais.restart(0);
    		value = dbais.readUTF();
    		return unmarshalText(value); 
    	}    
    }


    and in HttpClientTransport calling unmarshal with a DataByteArrayInputStream:

    DataByteArrayInputStream stream = new DataByteArrayInputStream(httpMethod.getResponseBody());
    Object command = (Object)getTextWireFormat().unmarshal(stream);


    With this changes was able to connect legacy clients 5.3 to new 5.5 brokers.



> Backards imcompatibilitiy with version 5.3 and previous with the http protocol due chage
on charset encoding
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3387
>                 URL: https://issues.apache.org/jira/browse/AMQ-3387
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Transport
>    Affects Versions: 5.4.0, 5.4.2, 5.5.0
>            Reporter: Marcel Casado
>         Attachments: HttpClientTransport.java, TextWireFormat.java
>
>
> Changes in charset encoding from java modified UTF-8 to standard UTF-8 in class org.apache.activemq.transport.util.TextWireFormat
makes clients and broker using different versions not compatible when using http transport
protocol. Like a client 5.3 and broker 5.5 can not interchange messages in http transport
protocol or the other way around. Backards compatibility support could be easily provided
with :
> {code}
>    public Object unmarshal(DataInput in) throws IOException {
>     	String value;
>     	try {
>     		int length = in.readInt();
>     		byte[] utf8 = new byte[length];
>     		in.readFully(utf8);
>     		value = new String(utf8, "UTF-8");
>     		return unmarshalText(value);
>     	} catch(Exception ex) {
>     		DataByteArrayInputStream dbais = (DataByteArrayInputStream) in;
>     		dbais.restart(0);
>     		value = dbais.readUTF();
>     		return unmarshalText(value); 
>     	}    
>     }
>     and in HttpClientTransport calling unmarshal with a DataByteArrayInputStream:
>     DataByteArrayInputStream stream = new DataByteArrayInputStream(httpMethod.getResponseBody());
>     Object command = (Object)getTextWireFormat().unmarshal(stream);
> {code}
>     With this changes was able to connect legacy clients 5.3 to new 5.5 brokers.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message