Skip to content

Fix null handling in XMLTimeUtil - #53839

Merged
ahus1 merged 2 commits into
keycloak:mainfrom
nihalritgithub:fix-xml-time-null-input-53672
Oct 29, 2026
Merged

ahus1 merged 2 commits into
keycloak:mainfrom
nihalritgithub:fix-xml-time-null-input-53672

Conversation

@nihalritgithub

Copy link
Copy Markdown
Contributor

Closes #53672

parseAsDuration() was calling nullArgumentError() without throwing the exception, so execution continued with a null value. Also, parse() had no explicit null check.

This change makes both methods reject null inputs using the existing exception helper.

Added tests for null arguments and valid/invalid inputs. All 129 SAML Core tests passed, along with the Spotless check.

Closes keycloak#53672

Signed-off-by: Nihal Kumar Sharma <125385820+nihalritgithub@users.noreply.github.com>
@nihalritgithub
nihalritgithub requested a review from a team as a code owner October 11, 2026 11:20
Copilot AI balanced review requested due to automatic review settings October 11, 2026 11:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused implementation satisfies the issue requirements and includes appropriate regression coverage.

0 open findings

What changed in this PR

Adds explicit null validation to XMLTimeUtil and verifies parsing behavior.

Changes:

  • Throws intentional IllegalArgumentExceptions for null inputs.
  • Adds tests for null, valid, and invalid inputs.
File Description
XMLTimeUtil.java Adds null guards to both parsing methods.
XMLTimeUtilTest.java Covers parsing success and failure cases.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nihalritgithub

Copy link
Copy Markdown
Contributor Author

Hi @rmartinc, I've submitted a fix for #53672 along with regression tests. The DCO check has passed, but the CI workflows are still awaiting maintainer approval.

This would be my first contribution to Keycloak, so I'd really appreciate any feedback. Could you please take a look when you get a chance, or help direct it to the appropriate reviewer?

Thanks!

@ahus1 ahus1 self-assigned this Oct 28, 2026
Copilot AI balanced review requested due to automatic review settings October 29, 2026 11:16
@ahus1
ahus1 enabled auto-merge (squash) October 29, 2026 11:17
ahus1
ahus1 previously approved these changes Oct 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Changing the logger method signature breaks compatibility with existing custom implementations, causing AbstractMethodError when parseAsDuration() handles invalid input.

1 open issue

Review effort: Balanced

Do not reflect user provided content in exceptions

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1
ahus1 force-pushed the fix-xml-time-null-input-53672 branch from 5313072 to 698f8a7 Compare October 29, 2026 11:47
Copilot AI balanced review requested due to automatic review settings October 29, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the SAML null-input handling and duration-error changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@ahus1
ahus1 merged commit 5843d14 into keycloak:main Oct 29, 2026
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve null handling in XMLTimeUtil.parse() and parseAsDuration()

3 participants