activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-770) AMQP: Incorrect or inefficient transformation of AMQP Messages
Date Thu, 06 Oct 2016 03:35:20 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15550753#comment-15550753
] 

ASF GitHub Bot commented on ARTEMIS-770:
----------------------------------------

Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/820#discussion_r82112176
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSObjectMessage.java
---
    @@ -16,55 +16,48 @@
      */
     package org.apache.activemq.artemis.protocol.amqp.converter.jms;
     
    +import java.io.Serializable;
    +
     import javax.jms.JMSException;
     import javax.jms.ObjectMessage;
    -import java.io.ByteArrayInputStream;
    -import java.io.ByteArrayOutputStream;
    -import java.io.ObjectOutputStream;
    -import java.io.Serializable;
     
     import org.apache.activemq.artemis.api.core.Message;
     import org.apache.activemq.artemis.core.message.impl.MessageInternal;
    -import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader;
    +import org.apache.qpid.proton.amqp.Binary;
     
     public class ServerJMSObjectMessage extends ServerJMSMessage implements ObjectMessage
{
     
    -   private static final String DEFAULT_WHITELIST;
    -   private static final String DEFAULT_BLACKLIST;
    -
    -   static {
    -      DEFAULT_WHITELIST = System.getProperty(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY,
"java.lang,java.math,javax.security,java.util,org.apache.activemq,org.apache.qpid.proton.amqp");
    -
    -      DEFAULT_BLACKLIST = System.getProperty(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY,
null);
    -   }
    +   public static final byte TYPE = Message.OBJECT_TYPE;
     
    -   public static final byte TYPE = Message.STREAM_TYPE;
    -
    -   private Serializable object;
    +   private Binary payload;
     
        public ServerJMSObjectMessage(MessageInternal message, int deliveryCount) {
           super(message, deliveryCount);
        }
     
        @Override
        public void setObject(Serializable object) throws JMSException {
    -      this.object = object;
    +      throw new UnsupportedOperationException("Cannot set Object on this internal message");
        }
     
        @Override
        public Serializable getObject() throws JMSException {
    -      return object;
    +      throw new UnsupportedOperationException("Cannot set Object on this internal message");
    +   }
    +
    +   public void setSerializedForm(Binary payload) {
    +      this.payload = payload;
    +   }
    +
    +   public Binary getSerializedForm() {
    +      return payload;
        }
     
        @Override
        public void encode() throws Exception {
           super.encode();
    -      ByteArrayOutputStream out = new ByteArrayOutputStream();
    -      ObjectOutputStream ous = new ObjectOutputStream(out);
    -      ous.writeObject(object);
    -      byte[] src = out.toByteArray();
    -      getInnerMessage().getBodyBuffer().writeInt(src.length);
    -      getInnerMessage().getBodyBuffer().writeBytes(src);
    +      getInnerMessage().getBodyBuffer().writeInt(payload.getLength());
    --- End diff --
    
    yay!!!!! @tabish121  very nice!


> AMQP: Incorrect or inefficient transformation of AMQP Messages 
> ---------------------------------------------------------------
>
>                 Key: ARTEMIS-770
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-770
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: AMQP
>    Affects Versions: 1.4.0
>            Reporter: Timothy Bish
>
> The AMQP Message Transformations done in the protocol module can at times produces incorrect
conversion are append additional data not present in the original AMQP message.
> Some noted issues
> * The Message Format value is not preserved from the original delivery.
> * Message Headers are added to outbound messages where the original message did not have
any which adds unnecessary overhead.
> * Message Properties can be added to outbound messages where the original did not have
any which adds unnecessary overhead and is illegal as the properties section is immutable
in AMQP.
> * Additional Application Properties are applied to outbound messages which are meant
to be immutable.
> * Some internal properties from the core message are applied to the Message Annotations
unnecessarily adding overhead to the outbound message.
> * The outbound message can contain a body that differs from the inbound version in some
cases
> * Object serialization / deserialization is done on types from the incoming message that
are wrapped in an AmqpValue instead of falling back to native encoding to preserve the original
Message body value.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message