-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlainText Serializer incorrectly unmarshalls deeply nested clusters/arrays that contain multiple ] or } characters #10
Comments
Here with compiled tests, including a test for this issue, issue #5, and the tests that shipped with v1.2.0 @francois-normandin, I've decided to upload my changes to the VI here since there may still be issues with these deeply nested data types and the data manipulation library. Let me know if you prefer a pull request instead. |
Thanks @IlyaVino |
Marvelous, @IlyaVino |
Released 1.2.1 (will be sent to vipm.io shortly) https://github.com/LabVIEW-Open-Source/Serializer/releases/tag/1.2.1 |
Great! Thanks again for all the help with these issues. |
This is a bug I referenced at the end of #5
This bug exists for deeply nested clusters and arrays such as:
which generate plain text strings:
[{"asdf",[{[1.0,2.0],"asdf"},{[3.0,4.0],"ghjk"}]},{"ghjk",[{[1.0,2.0],"asdf"},{[3.0,4.0],"ghjk"}]}]
{[{[1.0,2.0],"asdf"},{[3.0,4.0],"ghjk"}]}
Whenever PlainTextToVariant encounters a nested ] or }, it may switch the data type it is parsing from "cluster" or "array" to "unknown". This should only happen for the outermost ] or } so that the contents can be parsed recursively.
For example, the second cluster's contents are initially parsed under the "array" flag based on the second [ character but when encountering the first ] character after 2.0, the parsing incorrectly switches to "unknown". Instead, the flag should only be changed when encountering the outermost ] character at the end so that the full contents of the array inside the [ ... ] is parsed recursively.
My suggested fix is to add a counter that keeps track of the bracket depth. For example:
This counter needs to be added for all cases involved in parsing nested data types, i.e. under the cluster ("{" .. "{~") and array ("[" .. "[~") case. Any subcase that has "[" or "{" needs an increment and any subcase that has "]" or "}" needs a decrement and check to see if the counter is at zero.
I'll clean up my changes to the vi a bit and compile some tests shortly.
The text was updated successfully, but these errors were encountered: