• Post Reply Bookmark Topic Watch Topic
  • New Topic

Out of bound exception  RSS feed

 
Matthew Busse
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I'm encountering an OutOfBoundsException in my program, and I can't figure out why.

Here's the failure trace:


Here's the code:

when I click on the error at at com.multiBLAST.Blast.doAll(Blast.java.193) eclipse takes me to the line String seq = (String) epitopeParamsArray.get(1).get(i); (line 18 of this code block).



When I print out the String seq, it looks like it was able to access the array of arrays correctly. But the failure trace is leading me to believe that it's not working. Any idea what is going on here?

Thanks!

Matt
 
Paul Clapham
Sheriff
Posts: 22839
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message says "You have a list with two entries -- numbered 0 and 1 -- but you are trying to access entry number 2".

The loop around where the error looks wrong to me. It appears to be iterating over the entries of epitopeParamsArray, but inside the loop your code assumes that it has at least 3 entries and you access entries numbers 1 and 2. The entries are lists. Then without checking, you try to access entry number i of those lists.
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are missing to get the size of sub "List" in "epitopeParamsArray" List... That has led to the OutOfBoundsException....
 
Matthew Busse
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ram Narayan.M wrote:You are missing to get the size of sub "List" in "epitopeParamsArray" List... That has led to the OutOfBoundsException....


Thank you!! That was it!

Matt
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!