Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Out of bound exception

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 27276
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 247
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic