You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/09/01 08:19:34 UTC
svn commit: r571709 -
/myfaces/core/trunk/api/src/main/java/javax/faces/webapp/_ErrorPageWriter.java
Author: mmarinschek
Date: Fri Aug 31 23:19:33 2007
New Revision: 571709
URL: http://svn.apache.org/viewvc?rev=571709&view=rev
Log:
MYFACES-1716 (https://issues.apache.org/jira/browse/MYFACES-1716): JspException is now also handled in error-handling
Modified:
myfaces/core/trunk/api/src/main/java/javax/faces/webapp/_ErrorPageWriter.java
Modified: myfaces/core/trunk/api/src/main/java/javax/faces/webapp/_ErrorPageWriter.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/webapp/_ErrorPageWriter.java?rev=571709&r1=571708&r2=571709&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/webapp/_ErrorPageWriter.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/webapp/_ErrorPageWriter.java Fri Aug 31 23:19:33 2007
@@ -379,20 +379,28 @@
Throwable rootCause = ((ServletException) ex).getRootCause();
initCauseIfAvailable(ex,rootCause);
}
+ //handle JSP-Exceptions - equally long know for swallowing root-causes ;)
+ if(ex.getClass().getName().equals("javax.servlet.jsp.JspException")) {
+ initCausePerReflection(ex,"getRootCause");
+ }
//handle portlet-exceptions - not much better in this regard
else if(ex.getClass().getName().equals("javax.portlet.PortletException")) {
- try
- {
- Method causeGetter = ex.getClass().getMethod("getCause",new Class[]{});
- Throwable rootCause = (Throwable) causeGetter.invoke(ex,new Class[]{});
- initCauseIfAvailable(ex,rootCause);
- } catch (Exception e1) {
- //ignore if the method is not found - or cause has already been set.
- }
+ initCausePerReflection(ex,"getCause");
}
//add other exceptions which swallow to much as appropriate
prepareExceptionStack(ex.getCause());
+ }
+
+ private static void initCausePerReflection(Throwable ex, String methodName) {
+ try
+ {
+ Method causeGetter = ex.getClass().getMethod(methodName,new Class[]{});
+ Throwable rootCause = (Throwable) causeGetter.invoke(ex,new Class[]{});
+ initCauseIfAvailable(ex,rootCause);
+ } catch (Exception e1) {
+ //ignore if the method is not found - or cause has already been set.
+ }
}
public static void throwException(Exception e) throws IOException, ServletException {