JavaRanch » Java Forums »
Java »
Servlets
| Author |
overrides javax.servlet.http.HttpServlet.doGet and doPost
|
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
Hello in my eclipse IDE there are a couple of green triangles on lines 4 and 14 saying the following:
overrides javax.servlet.http.HttpServlet.doGet (line 4)
overrides javax.servlet.http.HttpServlet.doPost (line 14)
What should I do, I am also receiving an error on the server, an error 500 indicating the following:
javax.servlet.ServletException: String index out of range: 11
bcc.lib.BaseBccServlet.doPost(BaseBccServlet.java:106)
bcc.lib.BaseBccServlet.doGet(BaseBccServlet.java:54)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
servlet code as follows:
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
The errors have nothing to do with the green triangles, which are just informative.
This is the important part of the error:
javax.servlet.ServletException: String index out of range: 11
bcc.lib.BaseBccServlet.doPost(BaseBccServlet.java:106)
What do you think it's telling you?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
It occurs when you have
the "<" character without a matching ">" character in your text.
(Which you may have if you are writing math equations or programming
examples) There is a problem parsing this type of input in some text
fields at the moment.
???
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
No. What's at line 106 in bcc.lib.BaseBccServlet?
That's where the exception is occurring according to:
bcc.lib.BaseBccServlet.doPost(BaseBccServlet.java:106)
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
|
or that one of the fields is too big?
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
|
throw new ServletException( e );
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
At this point, we'll need to see the entire stack trace and entire servlet source (so that the line numbers in the code tag match up with the actual line numbers).
In particular, we need to see the root cause.
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
all I have is the server log from today, it says this:
and here is the code for the servlet:
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
Here's the interesting part:
java.lang.StringIndexOutOfBoundsException: String index out of range: 11
at java.lang.String.substring(String.java:1765)
at bcc.pages.documentManagement.DMTemplateLoader.doAction(DMTemplateLoader.java:4877)
What does it tell us?
Yeah, it does seem to go back into whatever template system you're using (I assume a template loader means you're using some sort of proprietary templates).
What it boils down to is that the String.substring() method is being called with indexes that are beyond the bounds of the string and it's throwing an exception. You'll need to backtrack it from there to find out why bad indexes are being passed.
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
How would I go about:
You'll need to backtrack it from there to find out why bad indexes are being passed.
Thanks,
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Use a debugger. FInd out what the bas indices are, and look at the code to find out how they are being set to bad values.
|
 |
 |
|
|
subject: overrides javax.servlet.http.HttpServlet.doGet and doPost
|
|
|
|