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
According to 28214, HttpStatus.valueOf(int) should instantiate a DefaultHttpStatusCode in case the value passed in doesn't match any of the enum values. Instead, it throws an IllegalArgumentException.
Also, DefaultHttpStatusCode is final and package private, and HttpStatus is sealed. What this amounts to is that whoever wants to create HttpStatusCode instances that correspond to non-standard values needs to create a factory inside the package org.springframework.http.
The text was updated successfully, but these errors were encountered:
According to #28214, HttpStatus.valueOf(int) should instantiate a DefaultHttpStatusCode in case the value passed in doesn't match any of the enum values. Instead, it throws an IllegalArgumentException.
I believe #28214 refers to HttpStatusCode#valueOf, which indeed implements the behavior described here. HttpStatus#valueOf has a different behavior which is properly documented in its Javadoc.
Also, DefaultHttpStatusCode is final and package private, and HttpStatus is sealed. What this amounts to is that whoever wants to create HttpStatusCode instances that correspond to non-standard values needs to create a factory inside the package org.springframework.http
Or you can use HttpStatusCode#valueOf as designed.
This is as ugly and stupid as can be.
This type of comment is not helping. This is a place for bug reports and contructive feedback, feel free to vent some place else. You can review our code of conduct.
This type of comment is not helping. This is a place for bug reports and contructive feedback, feel free to vent some place else. You can review our code of conduct.
Affects: all 3.x.y versions, as far as I can tell
According to 28214,
HttpStatus.valueOf(int)
should instantiate aDefaultHttpStatusCode
in case the value passed in doesn't match any of the enum values. Instead, it throws anIllegalArgumentException
.Also,
DefaultHttpStatusCode
is final and package private, andHttpStatus
is sealed. What this amounts to is that whoever wants to createHttpStatusCode
instances that correspond to non-standard values needs to create a factory inside the packageorg.springframework.http
.The text was updated successfully, but these errors were encountered: