https://issues.apache.org/bugzilla/show_bug.cgi?id=47371
Summary: EL expression parser error when getter methed return
an empty string
Product: Tomcat 6
Version: unspecified
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Jasper
AssignedTo: [email protected]
ReportedBy: [email protected]
There is a jsp file called test.jsp:
<%@ page contentType="text/html; charset=UTF-8" %>
<jsp:directive.page import="java.util.Map"/>
<jsp:directive.page import="java.util.HashMap"/>
<%!public class CellAttributes{
private String cellValue;
public CellAttributes(String cellValue) {
this.cellValue = cellValue;
}
public String getCellValue() {
return cellValue;
}
} %>
<%Map<String,CellAttributes> currentRow = new HashMap<String,
CellAttributes>();
currentRow.put("a",new CellAttributes(""));
currentRow.put("b",new CellAttributes("1"));
pageContext.setAttribute("currentRow",currentRow);
%>
<Html>
<BODY>
${currentRow['a'].cellValue+currentRow['b'].cellValue}
</BODY>
</Html>
throws exception:
java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Long.parseLong(Long.java:424)
java.lang.Long.<init>(Long.java:671)
org.apache.el.lang.ELArithmetic$LongDelegate.coerce(ELArithmetic.java:186)
org.apache.el.lang.ELArithmetic.coerce(ELArithmetic.java:357)
org.apache.el.lang.ELArithmetic.add(ELArithmetic.java:235)
org.apache.el.parser.AstPlus.getValue(AstPlus.java:40)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935)
org.apache.jsp.new_jsp._jspService(new_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
but I think it should be "1"
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]