Use enhanced switch expressions where feasible
Closes gh-28014
This commit is contained in:
@@ -154,18 +154,10 @@ final class Jackson2Tokenizer {
|
||||
|
||||
private void updateDepth(JsonToken token) {
|
||||
switch (token) {
|
||||
case START_OBJECT:
|
||||
this.objectDepth++;
|
||||
break;
|
||||
case END_OBJECT:
|
||||
this.objectDepth--;
|
||||
break;
|
||||
case START_ARRAY:
|
||||
this.arrayDepth++;
|
||||
break;
|
||||
case END_ARRAY:
|
||||
this.arrayDepth--;
|
||||
break;
|
||||
case START_OBJECT -> this.objectDepth++;
|
||||
case END_OBJECT -> this.objectDepth--;
|
||||
case START_ARRAY -> this.arrayDepth++;
|
||||
case END_ARRAY -> this.arrayDepth--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,12 +164,9 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
|
||||
String message = getErrorMessage(statusCode.value(), statusText, body, charset);
|
||||
|
||||
switch (statusCode.series()) {
|
||||
case CLIENT_ERROR:
|
||||
throw HttpClientErrorException.create(message, statusCode, statusText, headers, body, charset);
|
||||
case SERVER_ERROR:
|
||||
throw HttpServerErrorException.create(message, statusCode, statusText, headers, body, charset);
|
||||
default:
|
||||
throw new UnknownHttpStatusCodeException(message, statusCode.value(), statusText, headers, body, charset);
|
||||
case CLIENT_ERROR -> throw HttpClientErrorException.create(message, statusCode, statusText, headers, body, charset);
|
||||
case SERVER_ERROR -> throw HttpServerErrorException.create(message, statusCode, statusText, headers, body, charset);
|
||||
default -> throw new UnknownHttpStatusCodeException(message, statusCode.value(), statusText, headers, body, charset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user