Skip to content

Commit

Permalink
[ARTEMIS-1947] Session metadata in session management operation
Browse files Browse the repository at this point in the history
Fill the session's metadata in JSON properties instead of serializing it
as an opaque String.

JIRA: https://issues.apache.org/jira/browse/ARTEMIS-1947
(cherry picked from commit fd9aad2)
  • Loading branch information
jmesnil authored and clebertsuconic committed Aug 6, 2018
1 parent 1eebe46 commit d369a96
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -1882,10 +1882,12 @@ public void buildSessionJSON(JsonArrayBuilder array, ServerSession sess) {
obj.add("principal", sess.getValidatedUser());
}

String metadata = sess.getMetaData() == null ? null : sess.getMetaData().toString();
if (metadata != null) {
// remove leading and trailing curly brackets
obj.add("metadata", metadata.substring(1, metadata.length() - 1));
if (sess.getMetaData() != null) {
final JsonObjectBuilder metadata = JsonLoader.createObjectBuilder();
for (Entry<String, String> entry : sess.getMetaData().entrySet()) {
metadata.add(entry.getKey(), entry.getValue());
}
obj.add("metadata", metadata);
}

array.add(obj);
Expand Down

0 comments on commit d369a96

Please sign in to comment.