Skip to content

Commit 8f0a255

Browse files
committed
store null scaffold value representation
1 parent 8ee0f54 commit 8f0a255

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

grails-scaffolding/src/main/groovy/grails/plugin/scaffolding/ScaffoldingViewResolver.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class ScaffoldingViewResolver extends GroovyPageViewResolver implements Resource
8585
this.templateOverridePluginDescriptor = templateOverridePluginDescriptor
8686
}
8787

88+
private static final Object NULL_SCAFFOLD_VALUE = new Object()
89+
8890
ResourceLoader resourceLoader
8991
protected Map<String, View> generatedViewCache = new ConcurrentHashMap<>()
9092
protected Map<Class, Object> scaffoldValueCache = new ConcurrentHashMap<>()
@@ -209,7 +211,8 @@ class ScaffoldingViewResolver extends GroovyPageViewResolver implements Resource
209211
// Cache the scaffold value to avoid repeated reflection
210212
Class controllerClazz = controllerClass.clazz
211213
if (scaffoldValueCache.containsKey(controllerClazz)) {
212-
return scaffoldValueCache.get(controllerClazz)
214+
Object cached = scaffoldValueCache.get(controllerClazz)
215+
return cached == NULL_SCAFFOLD_VALUE? null : cached
213216
}
214217

215218
def scaffoldValue = controllerClass.getPropertyValue('scaffold')
@@ -222,7 +225,7 @@ class ScaffoldingViewResolver extends GroovyPageViewResolver implements Resource
222225
}
223226

224227
// Cache the result (even if null, to avoid repeated lookups)
225-
scaffoldValueCache.put(controllerClazz, scaffoldValue)
228+
scaffoldValueCache.put(controllerClazz, scaffoldValue == null? NULL_SCAFFOLD_VALUE : scaffoldValue)
226229
return scaffoldValue
227230
}
228231

0 commit comments

Comments
 (0)