Issues with Struct Read/Write in Milo SDK using JsonBsdParser – Null Values for LocalizedText and Arrays #1479
ravi-kothapally
started this conversation in
General
Replies: 1 comment
-
Decoders are supposed to preserve the difference between null and empty array, but even so it the result shouldn't be an NPE or uncaught exception. It seems that this is just buggy behavior in BsdParser. I'd recommend you fork and fix this in BsdParser as required. BsdParser and the JSON encoding for structs is deprecated / unmaintained in 1.0. I would consider merging a PR that fixed this against 0.6.x, though I'm not really planning to continue supporting and releasing 0.6.x versions except perhaps one more to wrap things up. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm using the UaAnsiCServer from Unified Automation for testing, and working with Milo SDK version 0.6.15, restricted to Java 11.
I'm trying to read a structured value and write it back directly using the following code:
When reading a value like this:
I get a
NullPointerException
:It seems to fail when
DisplayName
,Description
, or similar fields are empty or null. These fields are of typeLocalizedText
, and Milo tries to access.get("locale")
and.get("text")
without null checks:how to handle this?
I’m also facing a similar issue with another structure:
Node:
"ns=4;s=Demo.Static.Scalar.WorkOrder"
When trying to write this back, I get the following error:
However, if I provide
StatusComments: []
, it works fine. So the question is:Shouldn’t Milo treat
null
as an empty array when the expected type is an array?null
or{}
values when dealing withLocalizedText
and arrays?Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions