Fixed a logical error that can cause a NPE

This commit is contained in:
Oleg Kalnichevski 2023-06-18 17:11:22 +02:00
parent 6f1fd6d26b
commit 48253e8027
2 changed files with 2 additions and 4 deletions

View File

@ -673,8 +673,7 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
final boolean staleIfErrorEnabled = responseCachingPolicy.isStaleIfErrorEnabled(responseCacheControl, entry);
if (cacheRevalidator != null
&& !staleResponseNotAllowed(requestCacheControl, responseCacheControl, entry, now)
&& validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now)
|| staleIfErrorEnabled) {
&& (validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now) || staleIfErrorEnabled)) {
LOG.debug("Serving stale with asynchronous revalidation");
try {
final SimpleHttpResponse cacheResponse = generateCachedResponse(responseCacheControl, request, context, entry, now);

View File

@ -281,8 +281,7 @@ class CachingExec extends CachingExecBase implements ExecChainHandler {
try {
if (cacheRevalidator != null
&& !staleResponseNotAllowed(requestCacheControl, responseCacheControl, entry, now)
&& validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now)
|| staleIfErrorEnabled) {
&& (validityPolicy.mayReturnStaleWhileRevalidating(responseCacheControl, entry, now) || staleIfErrorEnabled)) {
LOG.debug("Serving stale with asynchronous revalidation");
final String exchangeId = ExecSupport.getNextExchangeId();
context.setExchangeId(exchangeId);