Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

NumberFormatException: For input string: "class" thrown when entering citations. The EL expression ${errors.class.simpleName} fails in Tomcat 9+ because when errors is a List, the EL resolver interprets .class as a list index access and tries to parse "class" as an integer.

Changes

  • Replace EL-based type checking with scriptlet instanceof String check in messages.jsp
  • Same fix applied for both errors and messages variables

Before

<c:when test="${errors.class.simpleName eq 'String'}">

After

<% Object errorsObj = request.getAttribute("errors");
   if (errorsObj == null) errorsObj = session.getAttribute("errors");
   boolean errorsIsString = errorsObj instanceof String;
   request.setAttribute("errorsIsString", errorsIsString);
%>
<c:when test="${errorsIsString}">
Original prompt

I try to enter a citation and:

Yikes!
java.lang.NumberFormatException: For input string: "class"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:668)
at java.base/java.lang.Integer.parseInt(Integer.java:786)
at javax.el.ListELResolver.coerce(ListELResolver.java:144)
at javax.el.ListELResolver.getValue(ListELResolver.java:64)
at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:123)
at org.apache.el.parser.AstValue.getValue(AstValue.java:160)
at org.apache.el.parser.AstEqual.getValue(AstEqual.java:33)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:149)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:655)
at org.apache.jsp.decorators.defaultTemplate_jsp._jspx_meth_c_005fwhen_005f0(defaultTemplate_jsp.java:1227)
at org.apache.jsp.decorators.defaultTemplate_jsp._jspx_meth_c_005fchoose_005f0(defaultTemplate_jsp.java:1198)
at org.apache.jsp.decorators.defaultTemplate_jsp._jspx_meth_c_005fif_005f1(defaultTemplate_jsp.java:1165)
at org.apache.jsp.decorators.defaultTemplate_jsp._jspService(defaultTemplate_jsp.java:439)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:349)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:300)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:619)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:496)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:444)
at com.opensymphony.module.sitemesh.filter.PageFilter.writeDecorator(PageFilter.java:173)
at com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:158)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:352)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:117)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:164)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107)
at org.springframework.security.web.authen...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Replace EL expression `${errors.class.simpleName}` with scriptlet-based
type checking to avoid NumberFormatException in modern EL resolvers.

The issue occurred because when `errors` is a List, the EL resolver
tries to interpret `.class` as a list index access, attempting to parse
"class" as an integer, which fails with NumberFormatException.

Co-authored-by: rvosa <[email protected]>
Copilot AI changed the title [WIP] Fix number format exception when entering citation Fix NumberFormatException in messages.jsp type checking Jan 13, 2026
Copilot AI requested a review from rvosa January 13, 2026 17:30
@rvosa rvosa marked this pull request as ready for review January 13, 2026 17:40
@rvosa rvosa merged commit 4bf3c7b into master Jan 13, 2026
@rvosa rvosa deleted the copilot/fix-number-format-exception branch January 13, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants