• Post Reply Bookmark Topic Watch Topic
  • New Topic

Integer automatically assumed from a long string of numbers in a URL parameter?

 
Kean Erickson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess this is a Tomcat error, but going to http://localhost/test.jsp?id=1848348943849328492834923894 gets me:


java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:417)
at java.lang.Integer.parseInt(Integer.java:499)
at org.apache.jsp.TestStuff.lolwut_jsp._jspService(lolwut_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
etc.

even if I declare in the file:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

So (tomcat?) is assuming my long string of numbers is an integer.. but I want it to be a string.. how can I get around this?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kean Erickson wrote:So (tomcat?) is assuming my long string of numbers is an integer

Nope. To the servlet container all request params are strings. The error is coming from your JSP -- something in it is making the assumption.
 
Kean Erickson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Kean Erickson wrote:So (tomcat?) is assuming my long string of numbers is an integer

Nope. To the servlet container all request params are strings. The error is coming from your JSP -- something in it is making the assumption.


This issue disappeared on restarting the server the nth time.. I didn't even change anything in the file. Bizarre. Thanks though.
 
Kean Erickson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhhh... there was a watch in my IDE that was throwing it, not the JSP. My bad.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!