Community
Participate
Working Groups
Build Identifier: 20110301-1815 When an EL function is defined as throwing an exception, an validation marker is shown as "Unhandled exception type..." even though the <error-page> declaration is in the web.xml. Reproducible: Always Steps to Reproduce: 1. Create a JSP EL function that throws an exception Functions.java public class Functions { public static int add(Object o1, Object o2) throws MyException { return Integer.parseInt(o1.toString()) + Integer.parseInt(o2.toString()); } } MyException.java public class MyException extends Exception { ... } Functions.tld <function> <name>add</name> <function-class>Functions.java</function-class> <function-signature>int add(Object,Object)</function-signature> </function> 2. Add the taglib function to the page page1.jsp <%@taglib uri="functions.tld" prefix="myfuncs"%> 3. Use the function in the JSP page page1.jsp ${myfuncs:add(1,1)} 4. Define an error page in the page directive <%@page errorPage="/error.jsp" %> 5. Validate the page The marker "Unhandled exception type MyException" will appear for the page. This exception should be handled by the errorPage attribute in the page or the <error-page> in the web.xml
I am sending this over to SourceEditing, but... simply put, whatever validator is showing the "Unhandled exception type ..." is where the correction needs to be handled. The first thing that needs to be done is to identify that validator.
How do I identify the validator that is creating the marker?
It's very likely the Java Compiler that we're running on the translated JSP source.
This problem is present in 3.3.1 as well. The error marker disappears when disabling the 'JSP syntax validator'. There are more ways of handling exceptions that should be considered when validating the JSP page besides in the page directive. For instance, if the page is a fragment that is always imported in a parent page with a try/catch. Or web.xml could be configured to handle exceptions. If it is too complicated to considered theses scenarios, it would be nice if it was possible to change the level of this marker to error/warning/ignore like many other validation markers. Would that be possible?