i am stuck in a simple piece of code, for which i have spent the last 2hrs and i seriously dont know what is wrong with this.
this is the setter method for an indexed property that i am using. sinci i dont know how the size required i am checking if the index is >= the size and in that case i am increasing the size() by idx + 1.
public void setName(int idx, String value) {
System.err.println("----------------");
System.err.println("In the setName method");
System.err.println("Idx: " + idx + ", Value: " + value);
System.err.println("----------------");
if (idx >= name.size()) {
this.name.ensureCapacity((idx + 1));
}this.name.add(idx,value);
}
in a seperate problem, only idx (in the right order 0,1,2,3,4) works fine.
this particular method works fine for idx = 2 and anything bigger than that gives errror.
aused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
at java.util.ArrayList.add(ArrayList.java:367)
at com.hedging.admin.productmanagement.StateForm.setStartValue(StateForm.java:91)
... 43 more
i would be reaslly thankful in someone could suggest me something.
--
Rajat Pandit | [EMAIL PROTECTED] +91 612 3117606 [ Developer and Part Time Human Being]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

