Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fixed JS mapping header serialization to string for array headers #2043

Merged

Conversation

thjaeckle
Copy link
Member

@thjaeckle thjaeckle commented Oct 14, 2024

This fixes an issue about JavaScript mapping in Ditto connections which use Json arrays as value inside headers.

Right now, this leads to e.g. the following follow-up exception (trying to parse requested-acks header as array):

The value 'org.mozilla.javascript.NativeArray@e90b588' of the header 'requested-acks' is not a valid JSON array. Verify that the value of the header 'requested-acks' is a valid 'JSON array' and try again.

So arrays were not correctly serialized, but their toString() on NativeArray (from Rhino library) was invoked, which just displays the default toString() implementation.

This fix will transform the Rhino NativeObject and NativeArray to ditto-json JsonObject and JsonArray and will use the buit-in formatAsString() for header values.

@thjaeckle thjaeckle added the bug label Oct 14, 2024
@thjaeckle thjaeckle added this to the 3.6.1 milestone Oct 14, 2024
@thjaeckle thjaeckle self-assigned this Oct 14, 2024
@thjaeckle
Copy link
Member Author

@alstanchev could you have a look, please?

Copy link
Contributor

@alstanchev alstanchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@thjaeckle thjaeckle merged commit f33323b into eclipse-ditto:master Oct 14, 2024
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants