Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overrides javax.servlet.http.HttpServlet.doGet and doPost

 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or that one of the fields is too big?
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
throw new ServletException( e );
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic