Skip to content

Commit 3f6e7ea

Browse files
committed
fix "java.lang.UnsupportedOperationException" exception
- don't mutate parameters - fails with r.script(Collections.EMPTY_MAP, body) call from https://github.com/grails/grails-core/blob/0479f60/grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/JavascriptTagLib.groovy#L135
1 parent 2372fba commit 3f6e7ea

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

grails-app/taglib/org/grails/plugin/resource/ResourceTagLib.groovy

+11-5
Original file line numberDiff line numberDiff line change
@@ -390,25 +390,31 @@ class ResourceTagLib {
390390
DispositionsUtils.doneDispositionResources(request, dispositionToRender)
391391
}
392392

393-
def script = { attributes, body ->
393+
def script = { attributesAsParam, body ->
394+
def attributes = [:] + attributesAsParam
394395
attributes.type = "script"
395396
if (!attributes.disposition) {
396397
attributes.disposition = DispositionsUtils.DISPOSITION_DEFER
397398
}
398399

399-
stash(attributes, body)
400+
doStash(attributes, body)
400401
}
401402

402-
def style = { attributes, body ->
403+
def style = { attributesAsParam, body ->
404+
def attributes = [:] + attributesAsParam
403405
attributes.type = "style"
404406
if (!attributes.disposition) {
405407
attributes.disposition = DispositionsUtils.DISPOSITION_HEAD
406408
}
407409

408-
stash(attributes, body)
410+
doStash(attributes, body)
409411
}
410-
412+
411413
def stash = { attributes, body ->
414+
doStash(attributes, body)
415+
}
416+
417+
private def doStash(attributes, body) {
412418
needsResourceLayout()
413419
StashManager.stashPageFragment(request, (String) attributes.type, (String) attributes.disposition, (String) body())
414420
}

0 commit comments

Comments
 (0)