I'm just wondering why using == to check equality of HttpStatus.BAD_REQUEST is not working:
HttpStatus httpStatusCode ...;
if (httpStatusCode == HttpStatus.BAD_REQUEST) {}
I got it working by using equals method:
if (httpStatusCode.equals(HttpStatus.BAD_REQUEST)) {}
But, HttpStatus.OK is working as in:
if (httpStatusCode == HttpStatus.OK) {}
I discovered it when I had this code:
if (httpStatusCode == HttpStatus.OK) {
...
} else if (httpStatusCode == HttpStatus.BAD_REQUEST ) {
...
} else {
...
}
Assumming httpStatusCode is HttpStatus.BAD_REQUEST, instead of going through else if block, it went to else block. But, when I changed == to .equals(), it worked.
I'm using Spring Web 4.3.6.RELEASE. Is there any explanation on this? Thank you