Skip to content

Fix convertToInt() rejecting integers with whitespace#27

Merged
maltehuebner merged 2 commits intomainfrom
fix/trim-int-conversion
Mar 14, 2026
Merged

Fix convertToInt() rejecting integers with whitespace#27
maltehuebner merged 2 commits intomainfrom
fix/trim-int-conversion

Conversation

@maltehuebner
Copy link
Owner

Summary

  • Adds trim() in ValueAssigner::convertToInt() before the regex check, so integer values with leading/trailing whitespace (e.g. " 1711922400") are accepted instead of throwing an InvalidArgumentException
  • Adds two test cases verifying whitespace trimming for both query and parameter assignments

Context

External API consumers occasionally send parameters with whitespace, causing InvalidArgumentException: Parameter "fromDateTime" is not a valid integer: " 1711922400". See criticalmass-one/criticalmass-in#1299.

Test plan

  • New test testConvertToIntTrimsWhitespace — query int with leading whitespace
  • New test testConvertToIntTrimsWhitespaceForParameter — parameter int with surrounding whitespace
  • All 356 tests pass

Closes #24

🤖 Generated with Claude Code

maltehuebner and others added 2 commits March 14, 2026 09:44
External API consumers occasionally send integer parameters with leading
or trailing whitespace (e.g. " 1711922400"), causing an
InvalidArgumentException. Adding trim() before the regex check fixes this.

Refs #24

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that integer values with leading/trailing whitespace are
accepted for both query and parameter assignments.

Closes #24

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maltehuebner maltehuebner added bug Something isn't working AI-generated labels Mar 14, 2026
@maltehuebner maltehuebner self-assigned this Mar 14, 2026
@maltehuebner maltehuebner merged commit a54a180 into main Mar 14, 2026
4 checks passed
@maltehuebner maltehuebner deleted the fix/trim-int-conversion branch March 14, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-generated bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueAssigner: trim() fehlt in convertToInt()

1 participant