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!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---