Skip to content

Commit e310f68

Browse files
committed
chore: minor cleanup after 0.7.1 release (remove redundant logger dependency)
1 parent 0560e6d commit e310f68

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

customer-service-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public class CustomerApiClientConfig {
112112
return builder -> builder.defaultStatusHandler(
113113
HttpStatusCode::isError,
114114
(request, response) -> {
115-
ProblemDetail pd = ProblemDetailSupport.extract(om, response, log);
115+
ProblemDetail pd = ProblemDetailSupport.extract(om, response);
116116
throw new ClientProblemException(pd, response.getStatusCode().value());
117117
});
118118
}

customer-service-client/src/main/java/io/github/bsayli/openapi/client/adapter/config/CustomerApiClientConfig.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
1212
import org.apache.hc.client5.http.impl.classic.HttpClients;
1313
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
14-
import org.slf4j.Logger;
15-
import org.slf4j.LoggerFactory;
1614
import org.springframework.beans.factory.annotation.Value;
1715
import org.springframework.boot.web.client.RestClientCustomizer;
1816
import org.springframework.context.annotation.Bean;
@@ -23,16 +21,15 @@
2321

2422
@Configuration
2523
public class CustomerApiClientConfig {
26-
27-
private static final Logger log = LoggerFactory.getLogger(CustomerApiClientConfig.class);
24+
2825

2926
@Bean
3027
RestClientCustomizer problemDetailStatusHandler(ObjectMapper om) {
3128
return builder ->
3229
builder.defaultStatusHandler(
3330
HttpStatusCode::isError,
3431
(request, response) -> {
35-
ProblemDetail pd = ProblemDetailSupport.extract(om, response, log);
32+
ProblemDetail pd = ProblemDetailSupport.extract(om, response);
3633
throw new ClientProblemException(pd, response.getStatusCode().value());
3734
});
3835
}

customer-service-client/src/main/java/io/github/bsayli/openapi/client/adapter/support/ProblemDetailSupport.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@
66
import java.io.InputStream;
77
import java.util.Optional;
88
import org.slf4j.Logger;
9+
import org.slf4j.LoggerFactory;
910
import org.springframework.http.HttpStatusCode;
1011
import org.springframework.http.MediaType;
1112
import org.springframework.http.client.ClientHttpResponse;
1213

1314
public final class ProblemDetailSupport {
1415

16+
private static final Logger log = LoggerFactory.getLogger(ProblemDetailSupport.class);
17+
1518
private ProblemDetailSupport() {}
1619

17-
public static ProblemDetail extract(ObjectMapper om, ClientHttpResponse response, Logger log) {
20+
public static ProblemDetail extract(ObjectMapper om, ClientHttpResponse response) {
1821
ProblemDetail pd;
1922
MediaType contentType =
20-
Optional.ofNullable(response.getHeaders().getContentType()).orElse(MediaType.ALL);
23+
Optional.ofNullable(response.getHeaders().getContentType()).orElse(MediaType.ALL);
2124
HttpStatusCode status;
2225

2326
try {
@@ -36,10 +39,10 @@ public static ProblemDetail extract(ObjectMapper om, ClientHttpResponse response
3639
}
3740
} catch (IOException e) {
3841
log.warn(
39-
"Unable to deserialize ProblemDetail (status={}, contentType={}); using generic fallback",
40-
status,
41-
contentType,
42-
e);
42+
"Unable to deserialize ProblemDetail (status={}, contentType={}); using generic fallback",
43+
status,
44+
contentType,
45+
e);
4346
pd = fallback(status, "Unparseable problem response");
4447
} catch (Exception e) {
4548
log.warn("Unexpected error while parsing ProblemDetail", e);
@@ -56,4 +59,4 @@ private static ProblemDetail fallback(HttpStatusCode status, String detail) {
5659
pd.setDetail(detail);
5760
return pd;
5861
}
59-
}
62+
}

docs/adoption/client-side-adoption.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public class YourApiClientConfig {
277277
return builder -> builder.defaultStatusHandler(
278278
HttpStatusCode::isError,
279279
(request, response) -> {
280-
ProblemDetail pd = ProblemDetailSupport.extract(om, response, log);
280+
ProblemDetail pd = ProblemDetailSupport.extract(om, response);
281281
throw new ClientProblemException(pd, response.getStatusCode().value());
282282
});
283283
}

0 commit comments

Comments
 (0)