Skip to content

Commit 51fd020

Browse files
committed
Removing NullCache for resource resolution. Keeping it for url resolution. BroadleafCommerce/QA#603. This should prevent a 404 that happens in a narrow scenario from persisting through for other requests.
1 parent 164cd75 commit 51fd020

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

common/src/main/java/org/broadleafcommerce/common/web/resource/resolver/BroadleafCachingResourceResolver.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ public class BroadleafCachingResourceResolver extends CachingResourceResolver im
6262
@Value("${resource.caching.enabled:true}")
6363
protected boolean resourceCachingEnabled;
6464

65-
/**
66-
* Storing null resource resolution was added for performance reasons. An issue occurred in admin (QA#603) that as
67-
* of this writing, we have not been able to be reproduce. This property is used for defensive coding since the
68-
* section is not used for admin in normal cases. This along with additional logging in the QA environment should
69-
* help to locate the issue. If null cache was the reason then this will fix the issue for admin.
70-
*/
71-
@Value("${cache.null.resource.resolution:true}")
72-
protected boolean cacheNullResources;
73-
7465
@Autowired
7566
public BroadleafCachingResourceResolver(@Qualifier("blSpringCacheManager") CacheManager cacheManager) {
7667
super(cacheManager, DEFAULT_CACHE_NAME);
@@ -85,27 +76,7 @@ public BroadleafCachingResourceResolver(Cache cache) {
8576
protected Resource resolveResourceInternal(HttpServletRequest request, String requestPath,
8677
List<? extends Resource> locations, ResourceResolverChain chain) {
8778
if (resourceCachingEnabled) {
88-
if (cacheNullResources) {
89-
String key = RESOLVED_RESOURCE_CACHE_KEY_PREFIX_NULL + requestPath;
90-
Object nullResource = getCache().get(key, Object.class);
91-
if (nullResource != null) {
92-
if (logger.isTraceEnabled()) {
93-
logger.trace(String.format("Found null reference resource match for '%s'", requestPath));
94-
}
95-
return null;
96-
} else {
97-
Resource response = super.resolveResourceInternal(request, requestPath, locations, chain);
98-
if (response == null) {
99-
if (logger.isTraceEnabled()) {
100-
logger.trace(String.format("Putting resolved null reference resource in cache for '%s'", requestPath));
101-
}
102-
getCache().put(key, NULL_REFERENCE);
103-
}
104-
return response;
105-
}
106-
} else {
107-
return super.resolveResourceInternal(request, requestPath, locations, chain);
108-
}
79+
return super.resolveResourceInternal(request, requestPath, locations, chain);
10980
} else {
11081
return chain.resolveResource(request, requestPath, locations);
11182
}

0 commit comments

Comments
 (0)