-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
java/kotlin: Send empty struct instead of empty string (#1786)
Fixes regression introduced in #1783
- Loading branch information
Showing
15 changed files
with
190 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"payload":"","transformationsParams":{"rawPayload":"{\"key1\":\"val\",\"key2\":\"val\",\"key\":\"val\"}"}} | ||
{"payload":{},"transformationsParams":{"rawPayload":"{\"key1\":\"val\",\"key2\":\"val\",\"key\":\"val\"}"}} |
2 changes: 1 addition & 1 deletion
2
java/lib/src/test/resources/__files/ExpectedMsgCreateBody2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"eventType":"event.type","payload":"","transformationsParams":{"rawPayload":"{\"key\":\"val\",\"key1\":[\"list\"]}"}} | ||
{"eventType":"event.type","payload":{},"transformationsParams":{"rawPayload":"{\"key\":\"val\",\"key1\":[\"list\"]}"}} |
2 changes: 1 addition & 1 deletion
2
java/lib/src/test/resources/__files/ExpectedMsgCreateBodyWithHeaders.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"eventType":"event.type","payload":"","transformationsParams":{"rawPayload":"{\"key\":\"val\",\"key1\":[\"list\"]}","headers":{"header-key":"header-val"}}} | ||
{"eventType":"event.type","payload":{},"transformationsParams":{"rawPayload":"{\"key\":\"val\",\"key1\":[\"list\"]}","headers":{"header-key":"header-val"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
if (messageIn.getTransformationsParams() != null) { | ||
if (messageIn.getTransformationsParams().get("rawPayload") == null) { | ||
MessageInInternal msgInInternal = new MessageInInternal(messageIn); | ||
if (msgInInternal.transformationsParams != null) { | ||
if (msgInInternal.transformationsParams.get("rawPayload") == null) { | ||
// transformationsParams may be immutable | ||
HashMap<String, Object> trParams = new HashMap<>(messageIn.getTransformationsParams()); | ||
trParams.put("rawPayload",messageIn.getPayload()); | ||
messageIn.setTransformationsParams(trParams); | ||
HashMap<String, Object> trParams = | ||
new HashMap<>(msgInInternal.transformationsParams); | ||
trParams.put("rawPayload", msgInInternal.payload); | ||
msgInInternal.transformationsParams = trParams; | ||
} | ||
} else { | ||
HashMap<String, Object> trParam = new HashMap<>(); | ||
trParam.put("rawPayload", messageIn.getPayload()); | ||
messageIn.setTransformationsParams(trParam); | ||
trParam.put("rawPayload", msgInInternal.payload); | ||
msgInInternal.transformationsParams = trParam; | ||
} | ||
messageIn.setPayload(""); | ||
msgInInternal.payload = new HashMap<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
if (messageIn.transformationsParams != null) { | ||
var msgInInternal = | ||
MessageInInternal( | ||
messageIn.application, | ||
messageIn.channels, | ||
messageIn.eventId, | ||
messageIn.eventType, | ||
mapOf(), | ||
messageIn.payloadRetentionHours, | ||
messageIn.payloadRetentionPeriod, | ||
messageIn.tags, | ||
messageIn.transformationsParams, | ||
) | ||
if (msgInInternal.transformationsParams != null) { | ||
// only set rawPayload if not already set | ||
if (messageIn.transformationsParams!!["rawPayload"] == null) { | ||
var trParams = (messageIn.transformationsParams as Map<String, Any>).toMutableMap(); | ||
if (msgInInternal.transformationsParams!!["rawPayload"] == null) { | ||
var trParams = | ||
(msgInInternal.transformationsParams as Map<String, Any>).toMutableMap() | ||
trParams["rawPayload"] = messageIn.payload | ||
messageIn.transformationsParams = trParams.toMap() | ||
msgInInternal.transformationsParams = trParams.toMap() | ||
} | ||
} else { | ||
val trParams = mapOf("rawPayload" to messageIn.payload) | ||
messageIn.transformationsParams = trParams | ||
msgInInternal.transformationsParams = trParams | ||
} | ||
messageIn.payload = "" |
Oops, something went wrong.