← Back to Pull requests

[bug] Deserialize nonempty XML with generic TypeReference #4435

Merged
hutiefang76 merged 2 files (85 lines) on Oct 08, 2026 02:41 UTC
View on GitHub
hutiefang76 hutiefang76 commented on Oct 07, 2026 08:29 UTC
Author

What's changed?

XmlUtil.fromXml(String, TypeReference<T>) returns early when the XML string is nonempty. Valid generic XML input therefore never reaches Jackson; null input instead reaches the parser and can throw.

Correct the inverted empty-input guard. Add map, list, nested generic, null/empty/malformed input and Class-overload control tests. This repairs a public utility; no current production caller of this overload was found.

Fixes #4433.

Validation: JDK 26 targeting Java 25: XmlUtilTest, 5 tests passed using Maven verify with default checkstyle/enforcer. The original implementation produced 3 failures and 1 error. Coverage reporting was skipped because no JaCoCo execution file was produced.

mvn -pl hertzbeat-common-core,hertzbeat-collector/hertzbeat-collector-basic -am -Dtest=XmlUtilTest,SshCollectImplTest -Dsurefire.failIfNoSpecifiedTests=false verify

Checklist

  • I have read the Contributing Guide.

  • I have written the necessary comments.

  • I added regression tests and the affected test classes passed.
  • Add or update API

    No new endpoint or API signature.

    AI assistance: implementation and initial review used DeepSeek; Codex coordinated final review and local verification.

    Diff: 85 lines (+84 / -1) across 2 files Reviewer: Duansg Review duration: 1091m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.31) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 85 lines diff across 2 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.00 · 1 substantive comment(s)
    0.00
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.350
    Diff Size diff_size
    0.266
    Real PR Conversation Timeline
    2 items
    Duansg Duansg approved these changes on Oct 08, 2026 02:38 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    hutiefang76 hutiefang76
    Labels
    risk: low confidence: 44.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 31.1% (LOW) · Higher = larger blast radius
    31.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.8% · Lower = rushed or shallow review
    44.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.2% · Safe to merge
    17.2%