Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error creating GroovyPagesException if nested exception has no stack trace #27

Open
kgeis opened this issue Jun 7, 2018 · 0 comments
Open

Comments

@kgeis
Copy link

kgeis commented Jun 7, 2018

GroovyPageView#createGroovyPageException(..) expects the exception that it is building around to have a stack trace. It is possible for an exception not to have a stack trace. This causes a problem in the following code:

        StackTraceElement[] stackTrace = exception.getStackTrace();
        String className = stackTrace[0].getClassName();

Stack trace:

java.lang.ArrayIndexOutOfBoundsException: 0
        at org.grails.web.servlet.view.GroovyPageView.createGroovyPageException(GroovyPageView.java:118)
        at org.grails.web.servlet.view.GroovyPageView.handleException(GroovyPageView.java:112)
        at org.grails.web.servlet.view.GroovyPageView.renderTemplate(GroovyPageView.java:80)
        at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
        at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
        at org.grails.web.sitemesh.GrailsLayoutView.renderInnerView(GrailsLayoutView.java:150)
        at org.grails.web.sitemesh.GrailsLayoutView.obtainContent(GrailsLayoutView.java:128)
        at org.grails.web.sitemesh.GrailsLayoutView.renderTemplate(GrailsLayoutView.java:63)
        at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
        at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286)
        at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
...

Steps to Reproduce

This is not an easily reproducible bug.

Expected Behaviour

I expect to see the original error in my log files or on an error page.

Actual Behaviour

The log files contain a stack trace from the process of creating a nesting exception, losing the context of the underlying problem.

Environment Information

  • Operating System: Centos 6.9
  • Grails Version: 3.2.1
  • JDK Version: Oracle 1.8.0_171
  • Container Version (If Applicable): n/a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant