NPE guard for null response; fixes gh-1224

This commit is contained in:
Marcin Grzejszczak
2019-02-28 15:28:42 +01:00
parent fead7a35cc
commit f044c07f67
6 changed files with 8 additions and 10 deletions

View File

@@ -249,6 +249,9 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor {
protected void handle(HttpClientResponse httpClientResponse,
Throwable throwable) {
if (httpClientResponse == null) {
return;
}
AtomicReference reference = httpClientResponse.currentContext()
.getOrDefault(AtomicReference.class, null);
if (reference == null || reference.get() == null) {

View File

@@ -77,8 +77,7 @@ class Issue546TestsApp {
@RestController
class Controller {
private static final Log log = LogFactory
.getLog(Controller.class);
private static final Log log = LogFactory.getLog(Controller.class);
private final AsyncRestTemplate traceAsyncRestTemplate;

View File

@@ -69,8 +69,7 @@ public class WebClientExceptionTests {
@ClassRule
public static final SpringClassRule SCR = new SpringClassRule();
private static final Log log = LogFactory
.getLog(WebClientExceptionTests.class);
private static final Log log = LogFactory.getLog(WebClientExceptionTests.class);
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();

View File

@@ -74,8 +74,7 @@ import static org.assertj.core.api.BDDAssertions.then;
@DirtiesContext
public class TraceZuulIntegrationTests {
private static final Log log = LogFactory
.getLog(TraceZuulIntegrationTests.class);
private static final Log log = LogFactory.getLog(TraceZuulIntegrationTests.class);
@Autowired
Tracing tracing;

View File

@@ -30,8 +30,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
*/
public abstract class AbstractIntegrationTest {
protected static final Log log = LogFactory
.getLog(AbstractIntegrationTest.class);
protected static final Log log = LogFactory.getLog(AbstractIntegrationTest.class);
protected static final int POLL_INTERVAL = 1;

View File

@@ -48,8 +48,7 @@ import org.springframework.util.StringUtils;
public class DefaultEndpointLocator implements EndpointLocator,
ApplicationListener<ServletWebServerInitializedEvent> {
private static final Log log = LogFactory
.getLog(DefaultEndpointLocator.class);
private static final Log log = LogFactory.getLog(DefaultEndpointLocator.class);
private static final String IP_ADDRESS_PROP_NAME = "spring.cloud.client.ipAddress";