bundles/org.apache.jasper.glassfish/src/org/apache/jasper/runtime/PageContextImpl.java
public Exception getException() {

        Throwable t = JspRuntimeLibrary.getThrowable(request);

        // Only wrap if needed
        if((t != null) && (! (t instanceof Exception))) {
            t = new JspException(t);
        }

        return (Exception) t;
    }
public Exception getException() {

        Throwable t = JspRuntimeLibrary.getThrowable(request);

        // Only wrap if needed
        if((t != null) && (! (t instanceof Exception))) {
            t = new JspException(t);
        }

        return (Exception) t;
    }
Returns the exception associated with this page context, if any.

Added wrapping for Throwables to avoid ClassCastException
(see Bugzilla 31171 for details).

@return The Exception associated with this page context, if any.