This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes  java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark " java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)" Watch " java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)" New topic
Author

java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

Noopur Kore
Ranch Hand

Joined: Aug 18, 2012
Posts: 77

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at proservlet.Servlet1.doPost(Servlet1.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
java.lang.NumberFormatException: For input string: "- Year -"



How do I solve this error?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

According to the error message, you are trying to parse a string which contains "- Year -" as if it is an integer.

You ofcourse get an exception because there is no way to interpret "- Year -" as a valid number.

You have to check if the string contains a number, or catch the exception and do whatever needs to be done for your application when the string doesn't contain a valid number.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
Noopur Kore wrote:java.lang.NumberFormatException: For input string: "- Year -"



How do I solve this error?

The code that is setting the value for the parameter is setting it to "- Year -" instead of the actual year, so that is what you need to fix.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
 
Similar Threads
InvocationTargetException: For input string [DONE]
java.lang.NumberFormatException: For input string:
JDBC in JSP not working
JasperException: For input string: ""
Servlet.service() for servlet jsp threw exception