Browse Source

Polishing

pull/32357/head
Juergen Hoeller 2 years ago
parent
commit
d8d4fa0e24
  1. 3
      spring-context/src/main/java/org/springframework/scheduling/support/BitsCronField.java
  2. 24
      spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

3
spring-context/src/main/java/org/springframework/scheduling/support/BitsCronField.java

@ -29,11 +29,12 @@ import org.springframework.util.StringUtils; @@ -29,11 +29,12 @@ import org.springframework.util.StringUtils;
* Created using the {@code parse*} methods.
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @since 5.3
*/
final class BitsCronField extends CronField {
public static BitsCronField ZERO_NANOS = forZeroNanos();
public static final BitsCronField ZERO_NANOS = forZeroNanos();
private static final long MASK = 0xFFFFFFFFFFFFFFFFL;

24
spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -367,6 +367,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat @@ -367,6 +367,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
this.observationConvention = observationConvention;
}
// GET
@Override
@ -847,13 +848,14 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat @@ -847,13 +848,14 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
request = createRequest(url, method);
}
catch (IOException ex) {
ResourceAccessException exception = createResourceAccessException(url, method, ex);
throw exception;
throw createResourceAccessException(url, method, ex);
}
ClientRequestObservationContext observationContext = new ClientRequestObservationContext(request);
observationContext.setUriTemplate(uriTemplate);
Observation observation = ClientHttpObservationDocumentation.HTTP_CLIENT_EXCHANGES.observation(this.observationConvention,
DEFAULT_OBSERVATION_CONVENTION, () -> observationContext, this.observationRegistry).start();
Observation observation = ClientHttpObservationDocumentation.HTTP_CLIENT_EXCHANGES.observation(
this.observationConvention, DEFAULT_OBSERVATION_CONVENTION,
() -> observationContext, this.observationRegistry).start();
ClientHttpResponse response = null;
try (Observation.Scope scope = observation.openScope()){
if (requestCallback != null) {
@ -865,13 +867,13 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat @@ -865,13 +867,13 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
return (responseExtractor != null ? responseExtractor.extractData(response) : null);
}
catch (IOException ex) {
ResourceAccessException exception = createResourceAccessException(url, method, ex);
observation.error(exception);
throw exception;
ResourceAccessException accessEx = createResourceAccessException(url, method, ex);
observation.error(accessEx);
throw accessEx;
}
catch (Throwable exc) {
observation.error(exc);
throw exc;
catch (Throwable ex) {
observation.error(ex);
throw ex;
}
finally {
if (response != null) {

Loading…
Cancel
Save