matrei commented on issue #16378:
URL: https://github.com/apache/grails-core/issues/16378#issuecomment-5790644834

   I checked this against the 7.x release branches: it isn't specific to 8.0.x. 
It's present on `7.0.x`, `7.1.x` and `7.2.x` as well.
   
   Both user-facing templates are identical on all four branches and still 
reference `javax.servlet.error.exception`:
   
   - `grails-forge/grails-forge-core/src/main/resources/gsp/error.gsp`
   - `grails-profiles/web/skeleton/grails-app/views/error.gsp`
   
   Grails 7 is also on Jakarta EE 10 (`jakarta.servlet-api` 6.1.0), and nothing 
in the framework sets the old `javax.*` key. `GrailsExceptionResolver` uses 
Spring's `WebUtils.ERROR_EXCEPTION_ATTRIBUTE`, which is 
`jakarta.servlet.error.exception`.
   
   The stale example apps differ a little per branch:
   
   | File | 7.0.x | 7.1.x | 7.2.x | 8.0.x |
   |---|---|---|---|---|
   | Forge + web profile `error.gsp` | ✗ | ✗ | ✗ | ✗ |
   | 
`grails-test-examples/{mail,geb,geb-gebconfig,scaffolding,hibernate5/issue450}` 
| ✗ | ✗ | ✗ | ✗ |
   | `grails-test-examples/hibernate7/issue450` | – | – | – | ✗ |
   | `grails-data-neo4j/examples/grails3-neo4j{,-hibernate}` | ✗ | ✗ | ✗ | – |
   
   So the fix should target `7.0.x` and be merged forward. It should also cover 
the two neo4j examples, which only exist on 7.x.
   
   ### Correction to the steps to reproduce
   
   An unhandled exception in a **controller** doesn't show the problem. 
`GrailsExceptionResolver` puts the exception in the `exception` model variable, 
so the first `<g:if test="${Throwable.isInstance(exception)}">` branch renders 
the details. The broken `<g:elseif>` is only reached when the container itself 
forwards to the error page, for example when a servlet filter throws.
   
   I confirmed this on `7.2.x` (Grails 7.2.4-SNAPSHOT, Spring Boot 3.5.16, 
Tomcat) with the web profile `error.gsp`, the `"500"(view:'/error')` mapping, 
in the development environment:
   
   | Request | `exception` model | `javax.servlet.error.exception` | 
`jakarta.servlet.error.exception` | Rendered page |
   |---|---|---|---|---|
   | Controller action throws | set | not set | set | Full exception details |
   | Servlet filter throws | not set | not set | set | Only "An error has 
occurred" with empty Exception/Message/Path |
   | Servlet filter throws, template changed to `jakarta.*` | not set | not set 
| set | Full exception details |
   
   Updated steps to reproduce:
   
   1. Generate a new app via Grails Forge or `grails create-app` (web profile).
   2. Register a servlet filter (e.g. through a `FilterRegistrationBean`) that 
throws an exception.
   3. Run the app in development and request a URL the filter matches.
   4. The error page shows only a generic "An error has occurred" list with 
empty values instead of the exception details.
   
   Changing both lines to `jakarta.servlet.error.exception` fixes it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to