Skip to content

Use XStream parser for UDP parameter extraction#45

Merged
matchews merged 1 commit into
haywardomnilogiclocalfrom
codex/update-parseintparameter-to-use-xstream-parser
Sep 10, 2025
Merged

Use XStream parser for UDP parameter extraction#45
matchews merged 1 commit into
haywardomnilogiclocalfrom
codex/update-parseintparameter-to-use-xstream-parser

Conversation

@matchews

Copy link
Copy Markdown
Owner

Summary

  • parse UDP parameter blocks via XStream instead of manual string search
  • define XStream mappings for message and parameter elements

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

@matchews matchews merged commit 28cc1a4 into haywardomnilogiclocal Sep 10, 2025
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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".

Comment on lines +50 to +56
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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 👍 / 👎.

@matchews matchews deleted the codex/update-parseintparameter-to-use-xstream-parser branch September 11, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant