ARTEMIS-1086 Proper conversion of SimpleString to String

When adding boolean value keyed by SimpleString the key needs to be
converted to a String type to be valid AMQP.
This commit is contained in:
Timothy Bish 2017-03-30 16:43:24 -04:00 committed by Clebert Suconic
parent 44a946c8e3
commit 62cb9b22de
1 changed files with 7 additions and 6 deletions

View File

@ -139,9 +139,10 @@ public class AMQPMessage extends RefCountMessage {
} }
} }
private Map getApplicationPropertiesMap() { @SuppressWarnings("unchecked")
private Map<String, Object> getApplicationPropertiesMap() {
ApplicationProperties appMap = getApplicationProperties(); ApplicationProperties appMap = getApplicationProperties();
Map map = null; Map<String, Object> map = null;
if (appMap != null) { if (appMap != null) {
map = appMap.getValue(); map = appMap.getValue();
@ -216,7 +217,7 @@ public class AMQPMessage extends RefCountMessage {
private Object getSymbol(Symbol symbol) { private Object getSymbol(Symbol symbol) {
MessageAnnotations annotations = getMessageAnnotations(); MessageAnnotations annotations = getMessageAnnotations();
Map mapAnnotations = annotations != null ? annotations.getValue() : null; Map<Symbol, Object> mapAnnotations = annotations != null ? annotations.getValue() : null;
if (mapAnnotations != null) { if (mapAnnotations != null) {
return mapAnnotations.get(symbol); return mapAnnotations.get(symbol);
} }
@ -226,7 +227,7 @@ public class AMQPMessage extends RefCountMessage {
private Object removeSymbol(Symbol symbol) { private Object removeSymbol(Symbol symbol) {
MessageAnnotations annotations = getMessageAnnotations(); MessageAnnotations annotations = getMessageAnnotations();
Map mapAnnotations = annotations != null ? annotations.getValue() : null; Map<Symbol, Object> mapAnnotations = annotations != null ? annotations.getValue() : null;
if (mapAnnotations != null) { if (mapAnnotations != null) {
return mapAnnotations.remove(symbol); return mapAnnotations.remove(symbol);
} }
@ -245,7 +246,7 @@ public class AMQPMessage extends RefCountMessage {
_messageAnnotations = new MessageAnnotations(new HashMap<>()); _messageAnnotations = new MessageAnnotations(new HashMap<>());
annotations = _messageAnnotations; annotations = _messageAnnotations;
} }
Map mapAnnotations = annotations != null ? annotations.getValue() : null; Map<Symbol, Object> mapAnnotations = annotations != null ? annotations.getValue() : null;
if (mapAnnotations != null) { if (mapAnnotations != null) {
mapAnnotations.put(symbol, value); mapAnnotations.put(symbol, value);
} }
@ -700,7 +701,7 @@ public class AMQPMessage extends RefCountMessage {
@Override @Override
public org.apache.activemq.artemis.api.core.Message putBooleanProperty(SimpleString key, boolean value) { public org.apache.activemq.artemis.api.core.Message putBooleanProperty(SimpleString key, boolean value) {
getApplicationPropertiesMap().put(key, Boolean.valueOf(value)); getApplicationPropertiesMap().put(key.toString(), Boolean.valueOf(value));
return this; return this;
} }