Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-3387

Backards imcompatibilitiy with version 5.3 and previous with the http protocol due chage on charset encoding

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 5.4.0, 5.4.2, 5.5.0
    • Fix Version/s: None
    • Component/s: Transport
    • Labels:
      None
    • Regression:
      Regression

      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 :

         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.

        Attachments

        1. TextWireFormat.java
          3 kB
          Marcel Casado
        2. HttpClientTransport.java
          9 kB
          Marcel Casado

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marcelcasado Marcel Casado
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: