Mantis - Resin
Viewing Issue Advanced Details
1076 major always 04-26-06 19:06 05-04-06 14:42
jdane  
ferg  
normal  
closed 3.0.17  
fixed  
none    
none 3.0.19  
0001076: stack overflow when using spring NestedServletException
This is not really a resin bug so much as an unfortunate interaction between resin's servlet API implementation and the multipart/file upload handling provided by the spring framework. In fact, the problem is probably not restricted to just multipart form handling, but that was the context in which I ran into it.

Spring contains a NestedServletException, the purpose of which is summarized in the header of that class as:

/**
 * Subclass of ServletException that properly handles a root cause,
 * exposing the root cause just like NestedChecked/RuntimeException does.
 * Note that the plain ServletException doesn't expose its root cause at all,
 * neither in the exception message nor in printed stack traces!
 */

and it contains the following method:

    /**
     * Return the nested cause, or <code>null</code> if none.
     */
    public Throwable getCause() {
        // Even if you cannot set the cause of this exception other than through
        // the constructor, we check for the cause being "this" here, as the cause
        // could still be set to "this" via reflection: for example, by a remoting
        // deserializer like Hessian's.
        return (getRootCause() == this ? null : getRootCause());
    }

resin's ServletException (unlike tomcat's) calls getCause from its getRootCause, causing instant stack overflow if you try calling either on a NestedServletException.

I've reported this as a bug in the Spring Framework bug tracker, and I think the responsibility lies there. But I figured I'd also report the problem here. Perhaps someone might suggest a workaround, because at the moment I'm stumped.

Notes
(0001099)
jdane   
05-01-06 14:37   
spring's JIRA has been updated with a claim (or so I read it) that this will be fixed in spring in the next versions.

http://opensource.atlassian.com/projects/spring/browse/SPR-1961 [^]