Use XStream parser for UDP parameter extraction#45
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| private static final XStream XSTREAM = new XStream(new StaxDriver()); | ||
|
|
||
| static { | ||
| XSTREAM.allowTypes(new Class[] { Message.class, Parameter.class }); | ||
| XSTREAM.setClassLoader(UdpClient.class.getClassLoader()); | ||
| XSTREAM.ignoreUnknownElements(); | ||
| XSTREAM.processAnnotations(Message.class); |
There was a problem hiding this comment.
[P1] Register XStream annotations for Parameter elements
The new parseIntParameter relies on XStream to map <Parameter name="…">…</Parameter> blocks to the inner Parameter class, but the static initializer only calls XSTREAM.processAnnotations(Message.class). Because the annotations on the Parameter class (especially @XStreamAsAttribute and @XStreamValue) are never processed, deserialized Parameter instances keep both name and value as null. As a result, every lookup falls through and the method always returns 0, leaving expectedBlocks at 0 and causing send() to time out once blocks arrive. The initializer should also process the Parameter annotations (or enable autodetection) so that parameters are actually parsed.
Useful? React with 👍 / 👎.
Summary
Testing
mvn -q -pl bundles/org.openhab.binding.haywardomnilogiclocal -am -Dtest=UdpClientTest test(fails: Non-resolvable parent POM org.openhab:openhab-super-pom)https://chatgpt.com/codex/tasks/task_e_68c189a534908323a0c1eceb752ca438