Skip to content

Commit

Permalink
fix(json data deserialization) #WPB-12153
Browse files Browse the repository at this point in the history
* Bump version to 1.7.2
  • Loading branch information
spoonman01 committed Nov 27, 2024
1 parent 21c60c5 commit c25515f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.wire</groupId>
<artifactId>xenon</artifactId>
<version>1.7.1</version>
<version>1.7.2</version>

<name>Xenon</name>
<description>Base Wire Bots Library</description>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/wire/xenon/backend/models/Payload.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ public Data deserialize(JsonParser jp, DeserializationContext ctxt) throws IOExc
JsonNode node = jp.readValueAsTree();
if (node.isObject()) {
Data data = new Data();
data.sender = node.get("sender").asText();
data.recipient = node.get("recipient").asText();
data.text = node.get("text").asText();
data.userIds = jp.getCodec().readValue(node.get("qualified_user_ids").traverse(jp.getCodec()), new TypeReference<List<QualifiedId>>() {});
data.users = jp.getCodec().readValue(node.get("users").traverse(jp.getCodec()), new TypeReference<List<User>>() {});
data.name = node.get("name").asText();
data.creator = node.get("creator").isTextual() ? UUID.fromString(node.get("creator").asText()) : null;
data.members = jp.getCodec().readValue(node.get("members").traverse(jp.getCodec()), Members.class);
data.sender = node.has("sender") ? node.get("sender").asText() : null;
data.recipient = node.has("recipient") ? node.get("recipient").asText() : null;
data.text = node.has("text") ? node.get("text").asText() : null;
data.userIds = node.has("qualified_user_ids") ? jp.getCodec().readValue(node.get("qualified_user_ids").traverse(jp.getCodec()), new TypeReference<List<QualifiedId>>() {}): null;
data.users = node.has("users") ? jp.getCodec().readValue(node.get("users").traverse(jp.getCodec()), new TypeReference<List<User>>() {}) : null;
data.name = node.has("name") ? node.get("name").asText() : null;
data.creator = node.has("creator") && node.get("creator").isTextual() ? UUID.fromString(node.get("creator").asText()) : null;
data.members = node.has("members") ? jp.getCodec().readValue(node.get("members").traverse(jp.getCodec()), Members.class) : null;
return data;
} else if (node.isTextual()) {
Data data = new Data();
Expand Down

0 comments on commit c25515f

Please sign in to comment.