You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Primitive array form fields throw ClassCastException during encoding #3607
When a form field value is a primitive array, form encoding tests isArray() and then casts the value to Object[]. For int[] and other primitive arrays, that cast throws ClassCastException.
Expected body: ids=1&ids=2, following the existing reference-array behavior. Actual: ClassCastException in UrlencodedFormContentProcessor. With multipart/form-data, ManyParametersWriter.isApplicable fails on the same cast before writer selection can complete.
The same input appears through primitive-array fields in form POJOs. It is distinct from #3586's top-level POJO classification and #3436's escaping of collection values.
A bounded fix reads array elements through java.lang.reflect.Array. URL-encoded values continue to follow CollectionFormat; multipart numeric and boolean arrays become repeated scalar parts. Multipart byte[] must retain its existing single binary part through ByteArrayWriter. No change to Character multipart support or streaming APIs is proposed.
Regression coverage exercises FormEncoder itself, all eight primitive array kinds for URL encoding, multipart repeated values, and exact binary byte[] preservation.
AI assistance: DeepSeek assisted investigation, implementation and regression tests; Codex coordinated verification.
Validation: with the original source, the focused regression tests fail on primitive-array ClassCastException; all 24 focused tests pass with the patch.
Activity
Handle primitive array form values without reference-array casts