Skip to content

Drop the trailing separator from WMI array values - #77

Merged
bertysentry merged 1 commit into
mainfrom
drop-trailing-array-separator
Oct 10, 2026
Merged

bertysentry merged 1 commit into
mainfrom
drop-trailing-array-separator

Conversation

@bertysentry

@bertysentry bertysentry commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

WmiStringConverter renders a WMI array as a|b|: there's a trailing separator even with a single element (a|), and an empty array gives |.

winrm-java renders the same arrays as a|b, and it can't add the trailing separator. WinRM's XML has no type information, so a one-element array is identical to a scalar. Only a CIM GetClass request (one more round-trip per class, not available on 2008 R2) would tell them apart. See MetricsHub/winrm-java#201.

MetricsHub runs the same connector queries through both libraries, so the two must produce the same string.

Change

Arrays are now rendered as:

  • a|b
  • a for a single element
  • an empty string for an empty array

The separator is still removed from each element, and a NULL is still an empty string. The new WmiStringConverterTest covers these cases.

The connectors that relied on the trailing separator are fixed in MetricsHub/community-connectors#428 and MetricsHub/enterprise-connectors#478. MetricsHub/metricshub-community#1388 makes the WinRM extension report an empty array as an empty string too.

Tests

mvn verify passes on JDK 17 (78 tests). On JDK 25, the existing Mockito-based tests fail to mock classes; that problem predates this change.

🤖 Generated with Claude Code

WmiStringConverter rendered an array as "a|b|" (and "|" for an empty array).
winrm-java renders the same WMI arrays as "a|b", and cannot do otherwise:
WinRM's XML does not tell a one-element array from a scalar. Both libraries
run the same connector queries, so they must produce the same string: arrays
are now "a|b", "a" for a single element, and an empty string when empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T19:51:10.182933Z b5d2d83 PR opened
ℹ️ 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
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant