Search in sources :

Example 11 with ActiveMQPropertyConversionException

use of org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException in project activemq-artemis by apache.

the class ActiveMQMapMessage method setObject.

@Override
public void setObject(final String name, final Object value) throws JMSException {
    checkName(name);
    try {
        TypedProperties.setObjectProperty(new SimpleString(name), value, map);
    } catch (ActiveMQPropertyConversionException e) {
        throw new MessageFormatException(e.getMessage());
    }
    invalid = true;
}
Also used : MessageFormatException(javax.jms.MessageFormatException) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ActiveMQPropertyConversionException(org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException)

Example 12 with ActiveMQPropertyConversionException

use of org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException in project activemq-artemis by apache.

the class ServerJMSMapMessage method setObject.

@Override
public void setObject(final String name, final Object value) throws JMSException {
    try {
        // primitives and String
        Object val = value;
        if (value instanceof UnsignedInteger) {
            val = ((UnsignedInteger) value).intValue();
        } else if (value instanceof UnsignedShort) {
            val = ((UnsignedShort) value).shortValue();
        } else if (value instanceof UnsignedByte) {
            val = ((UnsignedByte) value).byteValue();
        } else if (value instanceof UnsignedLong) {
            val = ((UnsignedLong) value).longValue();
        }
        TypedProperties.setObjectProperty(new SimpleString(name), val, map);
    } catch (ActiveMQPropertyConversionException e) {
        throw new MessageFormatException(e.getMessage());
    }
}
Also used : MessageFormatException(javax.jms.MessageFormatException) UnsignedLong(org.apache.qpid.proton.amqp.UnsignedLong) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) UnsignedInteger(org.apache.qpid.proton.amqp.UnsignedInteger) UnsignedByte(org.apache.qpid.proton.amqp.UnsignedByte) ActiveMQPropertyConversionException(org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException) UnsignedShort(org.apache.qpid.proton.amqp.UnsignedShort)

Aggregations

ActiveMQPropertyConversionException (org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException)12 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)12 Test (org.junit.Test)8 JMSRuntimeException (javax.jms.JMSRuntimeException)2 MessageFormatException (javax.jms.MessageFormatException)2 MessageFormatRuntimeException (javax.jms.MessageFormatRuntimeException)2 HashSet (java.util.HashSet)1 UnsignedByte (org.apache.qpid.proton.amqp.UnsignedByte)1 UnsignedInteger (org.apache.qpid.proton.amqp.UnsignedInteger)1 UnsignedLong (org.apache.qpid.proton.amqp.UnsignedLong)1 UnsignedShort (org.apache.qpid.proton.amqp.UnsignedShort)1