Use enhanced switch expressions where feasible

Closes gh-28014
This commit is contained in:
a.yazychyan
2022-02-07 20:51:32 +03:00
committed by Sam Brannen
parent 42d114534b
commit c5c926726d
38 changed files with 291 additions and 493 deletions

View File

@@ -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--;
}
}

View File

@@ -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);
}
}