-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: IndexOutOfBoundsException
PostPosted: Thu Aug 25, 2005 12:39 pm 
Newbie

Joined: Tue Aug 23, 2005 12:46 pm
Posts: 5
Hi All,

We recently upgraded to Hibernate 3.0 from 2.0. I am getting the following error message. My code worked fine in Hibernate 2.0.

java.lang.IndexOutOfBoundsException: Index: 17, Size: 16
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)


Here is the code that is causing the above error.

When the lastIndex is 19, then I am getting the above error.

int subHeaderIndex = 14;
int lastIndex = this.getComponentCount();
for (int ii = subHeaderIndex; ii < lastIndex; ii++) {
this.remove(ii);
}

Please help me if anybody knows anything about this.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2005 5:18 pm 
Newbie

Joined: Sun Aug 28, 2005 2:13 pm
Posts: 9
if you remove an element from the list, the indices from all following elements change. try

Code:
this.remove(subHeaderIndex);


instead of

Code:
this.remove(ii);


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.