Github user michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2427#discussion_r234622813
--- Diff:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
---
@@ -803,139 +799,122 @@ public CoreMessage setDurable(boolean durable) {
@Override
public CoreMessage putBooleanProperty(final String key, final boolean
value) {
messageChanged();
- checkProperties();
- properties.putBooleanProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()), value);
+ getOrCreateProperties().putBooleanProperty(key(key), value);
return this;
}
@Override
public CoreMessage putBooleanProperty(final SimpleString key, final
boolean value) {
messageChanged();
- checkProperties();
- properties.putBooleanProperty(key, value);
+ getOrCreateProperties().putBooleanProperty(key, value);
return this;
}
@Override
public Boolean getBooleanProperty(final SimpleString key) throws
ActiveMQPropertyConversionException {
- checkProperties();
- return properties.getBooleanProperty(key);
+ return getOrCreateProperties().getBooleanProperty(key);
}
@Override
public Boolean getBooleanProperty(final String key) throws
ActiveMQPropertyConversionException {
- checkProperties();
- return
properties.getBooleanProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()));
+ return getOrCreateProperties().getBooleanProperty(key(key));
}
@Override
public CoreMessage putByteProperty(final SimpleString key, final byte
value) {
messageChanged();
- checkProperties();
- properties.putByteProperty(key, value);
+ getOrCreateProperties().putByteProperty(key, value);
return this;
}
@Override
public CoreMessage putByteProperty(final String key, final byte value) {
messageChanged();
- checkProperties();
- properties.putByteProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()), value);
+ getOrCreateProperties().putByteProperty(key(key), value);
return this;
}
@Override
public Byte getByteProperty(final SimpleString key) throws
ActiveMQPropertyConversionException {
- checkProperties();
- return properties.getByteProperty(key);
+ return getOrCreateProperties().getByteProperty(key);
}
@Override
public Byte getByteProperty(final String key) throws
ActiveMQPropertyConversionException {
- return getByteProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()));
+ return getByteProperty(key(key));
}
@Override
public CoreMessage putBytesProperty(final SimpleString key, final
byte[] value) {
messageChanged();
- checkProperties();
- properties.putBytesProperty(key, value);
+ getOrCreateProperties().putBytesProperty(key, value);
return this;
}
@Override
public CoreMessage putBytesProperty(final String key, final byte[]
value) {
messageChanged();
- checkProperties();
- properties.putBytesProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()), value);
+ getOrCreateProperties().putBytesProperty(key(key), value);
return this;
}
@Override
public byte[] getBytesProperty(final SimpleString key) throws
ActiveMQPropertyConversionException {
- checkProperties();
- return properties.getBytesProperty(key);
+ return getOrCreateProperties().getBytesProperty(key);
}
@Override
public byte[] getBytesProperty(final String key) throws
ActiveMQPropertyConversionException {
- return getBytesProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()));
+ return getBytesProperty(key(key));
}
@Override
public CoreMessage putCharProperty(SimpleString key, char value) {
messageChanged();
- checkProperties();
- properties.putCharProperty(key, value);
+ getOrCreateProperties().putCharProperty(key, value);
return this;
}
@Override
public CoreMessage putCharProperty(String key, char value) {
messageChanged();
- checkProperties();
- properties.putCharProperty(SimpleString.toSimpleString(key,
getPropertyKeysPool()), value);
+ getOrCreateProperties().putCharProperty(key(key), value);
--- End diff --
can be delegated as: putCharProperty(key(key), value)
---