You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by sb...@apache.org on 2026/09/23 08:48:38 UTC
(grails-core) branch fix/error-gsp-jakarta-servlet-attribute-7.0.x created (now 216f786e27)
This is an automated email from the ASF dual-hosted git repository.
sbglasius pushed a change to branch fix/error-gsp-jakarta-servlet-attribute-7.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git
at 216f786e27 fix: use jakarta.servlet.error.exception in generated error.gsp
This branch includes the following new commits:
new 216f786e27 fix: use jakarta.servlet.error.exception in generated error.gsp
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(grails-core) 01/01: fix: use jakarta.servlet.error.exception in generated error.gsp
Posted by sb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sbglasius pushed a commit to branch fix/error-gsp-jakarta-servlet-attribute-7.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 216f786e278be7195a14f883e358d9a1a67a0e70
Author: Søren Berg Glasius <so...@glasius.dk>
AuthorDate: Wed Sep 23 10:48:25 2026 +0200
fix: use jakarta.servlet.error.exception in generated error.gsp
The Grails Forge and web profile error.gsp templates still looked up
the pre-Jakarta EE attribute javax.servlet.error.exception. Since
this branch already targets Jakarta EE (jakarta.servlet-api), the
container stores the forwarded exception under
jakarta.servlet.error.exception
(jakarta.servlet.RequestDispatcher.ERROR_EXCEPTION), so the lookup
never matched and the elseif branch that renders exception details
never fired.
Backport of e1ec2629bd1bad273820e37962bc2404b4db6ced from 8.0.x.
Fixes #16378
---
.../grails-forge-core/src/main/resources/gsp/error.gsp | 4 ++--
.../org/grails/forge/feature/view/GrailsGspSpec.groovy | 12 +++++++++++-
grails-profiles/web/skeleton/grails-app/views/error.gsp | 4 ++--
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/grails-forge/grails-forge-core/src/main/resources/gsp/error.gsp b/grails-forge/grails-forge-core/src/main/resources/gsp/error.gsp
index 4fd9620478..4789b26420 100644
--- a/grails-forge/grails-forge-core/src/main/resources/gsp/error.gsp
+++ b/grails-forge/grails-forge-core/src/main/resources/gsp/error.gsp
@@ -11,8 +11,8 @@
<g:if test="${Throwable.isInstance(exception)}">
<g:renderException exception="${exception}" detailsClass="alert alert-danger" stackClass="bg-body-secondary" snippetClass="bg-body-secondary snippet" lineErrorClass="bg-danger" />
</g:if>
- <g:elseif test="${request.getAttribute('javax.servlet.error.exception')}">
- <g:renderException exception="${request.getAttribute('javax.servlet.error.exception')}" />
+ <g:elseif test="${request.getAttribute('jakarta.servlet.error.exception')}">
+ <g:renderException exception="${request.getAttribute('jakarta.servlet.error.exception')}" />
</g:elseif>
<g:else>
<ul class="errors">
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/view/GrailsGspSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/view/GrailsGspSpec.groovy
index 609afda46d..afa3d2efcd 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/view/GrailsGspSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/view/GrailsGspSpec.groovy
@@ -87,13 +87,23 @@ class GrailsGspSpec extends ApplicationContextSpec implements CommandOutputFixtu
void "test default views are present"() {
when:
final def output = generate(ApplicationType.WEB, new Options(DevelopmentReloading.DEVTOOLS))
-
+
then:
output.containsKey("grails-app/views/index.gsp")
output.containsKey("grails-app/views/error.gsp")
output.containsKey("grails-app/views/notFound.gsp")
}
+ void "test default error page looks up the jakarta servlet error exception attribute"() {
+ when:
+ final def output = generate(ApplicationType.WEB, new Options(DevelopmentReloading.DEVTOOLS))
+ final String error = output["grails-app/views/error.gsp"]
+
+ then: "the container stores the forwarded exception under the jakarta attribute name, not the pre-Jakarta EE one"
+ error.contains("request.getAttribute('jakarta.servlet.error.exception')")
+ !error.contains("javax.servlet.error.exception")
+ }
+
@Unroll
void "test grails-gsp gradle plugins and dependencies are present for #applicationType application"() {
when:
diff --git a/grails-profiles/web/skeleton/grails-app/views/error.gsp b/grails-profiles/web/skeleton/grails-app/views/error.gsp
index 4fd9620478..4789b26420 100644
--- a/grails-profiles/web/skeleton/grails-app/views/error.gsp
+++ b/grails-profiles/web/skeleton/grails-app/views/error.gsp
@@ -11,8 +11,8 @@
<g:if test="${Throwable.isInstance(exception)}">
<g:renderException exception="${exception}" detailsClass="alert alert-danger" stackClass="bg-body-secondary" snippetClass="bg-body-secondary snippet" lineErrorClass="bg-danger" />
</g:if>
- <g:elseif test="${request.getAttribute('javax.servlet.error.exception')}">
- <g:renderException exception="${request.getAttribute('javax.servlet.error.exception')}" />
+ <g:elseif test="${request.getAttribute('jakarta.servlet.error.exception')}">
+ <g:renderException exception="${request.getAttribute('jakarta.servlet.error.exception')}" />
</g:elseif>
<g:else>
<ul class="errors">