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
publicclassParameter {
// This constructor will cause the request to result in an error 500....publicParameter(List<String> params) {
this.params = params;
}
privateList<String> params;
// ... getter & setter
}
A request to /test?params[]=123 will fail with this Exception:
When requesting /test?params=123 everything works as expected.
When requesting /test?params[]=123 but without the constructor, everything also works as expected.
In Spring Boot <= 3.3.7 also everything works as expected.
My expectation would be that the parameter is parsed correctly despite the []. I could also live with a validation error or a BadRequest. But an Error 500 with StringOutOfBounds exception is unpleasant.
Edit: My first idea was that it was the @ConstructorProperties(“params”), but it is the constructor itself that causes the error.
The text was updated successfully, but these errors were encountered:
jerchende
changed the title
Error 500 / StringIndexOutOfBoundsException when parsing Array-Parameter and using @ConstructorProperties
Error 500 / StringIndexOutOfBoundsException when parsing Array-Parameter and using Constructor for Parameter Bean
Jan 8, 2025
Indeed @jerchende. I would appreciate if you could give Spring Framework 6.2.2-SNAPSHOT a try. You can download the latest snapshot from https://repo.spring.io/snapshot.
Since updating to Spring Boot 3.4.0 / 3.4.1
Given this TestController:
with this Parameter Bean:
A request to
/test?params[]=123
will fail with this Exception:When requesting
/test?params=123
everything works as expected.When requesting
/test?params[]=123
but without the constructor, everything also works as expected.In Spring Boot <= 3.3.7 also everything works as expected.
You can find a simple demo application here: dataBinderError500.zip
My expectation would be that the parameter is parsed correctly despite the []. I could also live with a validation error or a BadRequest. But an Error 500 with StringOutOfBounds exception is unpleasant.
Edit: My first idea was that it was the
@ConstructorProperties(“params”)
, but it is the constructor itself that causes the error.The text was updated successfully, but these errors were encountered: