mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-09 03:25:28 +00:00
Fixed a logical error that can cause a NPE
This commit is contained in:
parent
6f1fd6d26b
commit
48253e8027
@ -673,8 +673,7 @@ private void handleCacheHit(
|
|||||||
final boolean staleIfErrorEnabled = responseCachingPolicy.isStaleIfErrorEnabled(responseCacheControl, entry);
|
final boolean staleIfErrorEnabled = responseCachingPolicy.isStaleIfErrorEnabled(responseCacheControl, entry);
|
||||||
if (cacheRevalidator != null
|
if (cacheRevalidator != null
|
||||||
&& !staleResponseNotAllowed(requestCacheControl, responseCacheControl, entry, now)
|
&& !staleResponseNotAllowed(requestCacheControl, responseCacheControl, entry, now)
|
||||||
&& validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now)
|
&& (validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now) || staleIfErrorEnabled)) {
|
||||||
|| staleIfErrorEnabled) {
|
|
||||||
LOG.debug("Serving stale with asynchronous revalidation");
|
LOG.debug("Serving stale with asynchronous revalidation");
|
||||||
try {
|
try {
|
||||||
final SimpleHttpResponse cacheResponse = generateCachedResponse(responseCacheControl, request, context, entry, now);
|
final SimpleHttpResponse cacheResponse = generateCachedResponse(responseCacheControl, request, context, entry, now);
|
||||||
|
@ -281,8 +281,7 @@ private ClassicHttpResponse handleCacheHit(
|
|||||||
try {
|
try {
|
||||||
if (cacheRevalidator != null
|
if (cacheRevalidator != null
|
||||||
&& !staleResponseNotAllowed(requestCacheControl, responseCacheControl, entry, now)
|
&& !staleResponseNotAllowed(requestCacheControl, responseCacheControl, entry, now)
|
||||||
&& validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now)
|
&& (validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now) || staleIfErrorEnabled)) {
|
||||||
|| staleIfErrorEnabled) {
|
|
||||||
LOG.debug("Serving stale with asynchronous revalidation");
|
LOG.debug("Serving stale with asynchronous revalidation");
|
||||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||||
context.setExchangeId(exchangeId);
|
context.setExchangeId(exchangeId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user