DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22226>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22226

Tomcat throws JasperException instead of NumberFormatException when parameter can't 
convert to bean property

           Summary: Tomcat throws JasperException instead of
                    NumberFormatException when parameter can't convert to
                    bean property
           Product: Tomcat 4
           Version: 4.1.24
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Tomcat throws a JasperException instead of NumberFormatException when an input 
parameter 
can't be properly converted to a bean property.   This makes it impossible to write an 
application 
portably, since it has to catch a Tomcat-specific exception.

My JSP:

--------
<jsp:useBean id="bean" class="test.TestBean">
  <jsp:setProperty name="bean" property="height"/>
</jsp:useBean>

<html>
<head><title>Bean Test</title></head>

<body>
<p>The height is <jsp:getProperty name="bean" property="height"/>.</p>
</body>

</html>

----------
My bean:

----------
package test;

public class TestBean {
   private int height;
   
   public void setHeight (int h) {height=h;}
   public int getHeight() {return height;}
}
--------

To test: invoke it with "?height=foo" .  You'll get:

org.apache.jasper.JasperException: For input string: "foo"
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:274)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:220)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
...

root cause 

org.apache.jasper.JasperException: For input string: "foo"
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.convert(JspRuntimeLibrary.java:185)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:268)
        at 
org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:220)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        ...

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to