Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340158

Summary: [validation][translation] "Unhandled exception type ..." reported when errorPage or <error-page> is defined
Product: [WebTools] WTP Source Editing Reporter: jaredapearson+eclipse
Component: jst.jspAssignee: jst.jsp <jst.jsp-inbox>
Status: NEW --- QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: andreas, ccc, st.mailinglists, thatnitind
Version: 3.2.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description jaredapearson+eclipse CLA 2011-03-16 09:57:54 EDT
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
Comment 1 Carl Anderson CLA 2011-03-16 14:43:03 EDT
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.
Comment 2 jaredapearson+eclipse CLA 2011-03-18 09:16:09 EDT
How do I identify the validator that is creating the marker?
Comment 3 Nitin Dahyabhai CLA 2011-04-04 23:57:26 EDT
It's very likely the Java Compiler that we're running on the translated JSP source.
Comment 4 Andreas Bergander CLA 2012-04-12 09:26:12 EDT
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?