TRAS0014I Java.lang.NumberFormat Exception
The following exception was logged java.lang.NumberFormatException: For input string: ").toString())%"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:63)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.valueOf(Integer.java:598)
at com.ibm.ws.jsp.translator.visitor.generator.GeneratorUtils.coerceToInt(GeneratorUtils.java:677)
at com.ibm.ws.jsp.translator.visitor.generator.BaseTagGenerator.convertString(BaseTagGenerator.java:450)
at com.ibm.ws.jsp.translator.visitor.generator.BaseTagGenerator.evaluateAttribute(BaseTagGenerator.java:356)
at com.ibm.ws.jsp.translator.visitor.generator.BaseTagGenerator.generateSetters(BaseTagGenerator.java:214)
at com.ibm.ws.jsp.translator.visitor.generator.CustomTagGenerator.startGeneration(CustomTagGenerator.java:323)
at com.ibm.ws.jsp.translator.visitor.generator.GenerateVisitor.startGeneration(GenerateVisitor.java:636)
at com.ibm.ws.jsp.translator.visitor.generator.GenerateVisitor.visitCustomTagStart(GenerateVisitor.java:381)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:253)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:286)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:254)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:286)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:254)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:286)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:254)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:286)
at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:125)
<fast4j:list name="PhotoIdAppList" page="<%=pageNo.intValue()%>" pageSize="<%=(session.getAttribute("pageSize") ==null) ? 5 :Integer.parseInt(session.getAttribute("pageSize").toString())%>"/>
I am getting the Exception at thsi point.. Tried to resolve it but coukd not... Its urgent
# 1
try to type cast with (String) rather then using toString().
# 2
type casting can be done as
String
Store the value in any integer variable
Then
String variable = "" + Integer.parseInt(session.getAttribute("pageSize")
<fast4j:list name="PhotoIdAppList" page="<%=pageNo.intValue()%>" pageSize="<%=(session.getAttribute("pageSize") ==null) ? 5 : string variable %>"/>
Regards,
Rengaraj.R
# 3
>TRAS0014I Java.lang.NumberFormat Exception
>(session.getAttribute("pageSize") ==null) ? 5 : Integer.parseInt(session.getAttribute("pageSize").toString())
this can only happen when String you are passing to Integer.parseInt() method does not represent an Integer.
As adviced by my fellow poster i would ask you to go by trying with Type casting the object to a String because, Object.toString() Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
So If Integer.parseInt((String)session.getAttribute("pageSize")) throws
a java.lang.ClassCastException it would be for sure that Object is not representing a String.
And If Integer.parseInt((String)session.getAttribute("pageSize")) throws a Java.lang.NumberFormat Exception then you could be sure that session.getAttribute("pageSize") Object does not hold a Integer Value.
So your next trial tag would be
<fast4j:listname="PhotoIdAppList"page="<%=pageNo.intValue()%>"pageSize="<%=(session.getAttribute("pageSize") ==null) ? 5 : Integer.parseInt((String)session.getAttribute("pageSize"))%>" />
or as adviced by my fellow poster
<%
String Arg = new String("5");
try{
Arg = (String)session.getAttribute("pageSize");
} catch(Exception exp){
log.info(exp.getMessage());
}
log.info("String Cast Succesfull");
Integer PageSize = new Integer("5");
try{
PageSize = Integer.parseInt(Arg);
} catch(Exception exp){
log.info(exp.getMessage());
}
log.info("String has been pared to integer");
%>
<fast4j:listname="PhotoIdAppList"page="<%=pageNo.intValue()%>"pageSize="<%=PageSize%>" />
REGARDS,
RaHuL
# 4
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:637)
at com.ibm._jsp._CustomerDemographicsList._jspService(_CustomerDemographicsList.java:224)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:171)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:230)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:250)
at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
This is only coming for the 1st time.. everytime i restart the server.
if i refresh the page its i can see the page but i restart the saerver again its coming back
1. Websphere Application Sever
2.Db2 Database
# 5
<fast4j:list name="PhotoIdAppList" page="<%=pageNo.intValue()%>" pageSize="<%=(session.getAttribute("pageSize") ==null) ? 5 : Integer.parseInt(session.getAttribute("pageSize").toString())%>"/>
The problem is probably caused by nested quotes.
Some servers have difficulties determining the proper start/end of the quotes when nested within custom tags.
As a solution try using single quotes to delimit the attribute values, and double quotes to delimit the strings within the expressions:
<fast4j:list name='PhotoIdAppList' page='<%=pageNo.intValue()%>' pageSize='<%=(session.getAttribute("pageSize") ==null) ? 5 : Integer.parseInt(session.getAttribute("pageSize").toString())%>'/>
Cheers,
evnafets