You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "G.Nagarajan" <gn...@dkf.de> on 2001/09/18 14:26:26 UTC

RE: ServletException that I don't understand...

Hi,
The error is in this line
 int lineNr = Integer.parseInt(nr);

It means that nr is not containing a valid integer.

to find out the value in nr, you can give something like

System.out.println("value of nr is : "+nr);
 int lineNr = Integer.parseInt(nr);

likewise you can give System.out statements wherever necessary and
find out where the value is not getting assigned properly.

Regards,
Nagarajan.


-----Original Message-----
From: Jim Cheesman [mailto:jchees@msl.es]
Sent: Friday, July 27, 2001 5:32 PM
To: tomcat-user@jakarta.apache.org
Subject: ServletException that I don't understand...


I'm getting the following exception when trying to load a jsp:

ServletException yadda yadda wrapping:

java.lang.NumberFormatException: E at
java.lang.Integer.parseInt(Integer.java:414) at
java.lang.Integer.parseInt(Integer.java:463) at
org.apache.jasper.compiler.Compiler.getJspLineErrors(Compiler.java:321) at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:280) at
org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:526) at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:175)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:187)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:456)


This seems to be an error in my jsp, and where the jasper Compiler is
parsing the line number from the javac output it's failing somehow...

<code>
       int beginColon = line.indexOf(':', 2);// Drive letter on Windows !!
       int endColon = line.indexOf(':', beginColon + 1);

       if (beginColon < 0 || endColon < 0) {
         errorMsg.append(line);
         errorMsg.append('\n');
         continue;
       }

       String nr = line.substring(beginColon + 1, endColon);
       int lineNr = Integer.parseInt(nr);
</code>

I'm not sure that the indexOf, beginColon construction is the stablest I've
seen...


Has anyone else run up against this? Any solution?


Jim



--

                           *   Jim Cheesman   *
             Trabajo:
jchees@msl.es - (34)(91) 724 9200 x 2360
   The shortest distance between
two points is how far apart they are.