on 10-29-2009 1:51 AM
This is the error message:
java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
at at java.util.ArrayList.RangeCheck(ArrayList.java:539)
at at java.util.ArrayList.get(ArrayList.java:356)
Below line of coding is the place where system encounter the error
node.setLeadSelection(j); //this is the place causing the error
if (!"".equals(wdContext.getCurrentElement()
.getAttributeValue((String) contextInputFields.get(c))))
{
allFieldsEmpty = false;
} else {
wdThis.raiseNoAnswersMaintained();
}
}
// if all answer fields are empty then set the question lead selection from 1...n
if (allFieldsEmpty) {
// set lead selection of dropdown listboxes from 1...n
for (int j = 0; j < contextDropDowns.size(); j++) {
IWDNode node =
wdContext.getChildNode(
(String) contextDropDowns.elementAt(j),
0);
node.setLeadSelection(j); //this is the place causing the error
}
for (int j = 0; j < contextDropDowns.size(); j++) {
IWDNode node =
wdContext.getChildNode(
(String) contextDropDowns.elementAt(j) + "Overview",
0);
node.setLeadSelection(j);
}
}
What should i do to avoid this error?
There is quite similar thread reported, but no solution given in the thread.
Appreciate any comment/suggestion.
regards,
Prakesh.
Hi prakash,
I am not getting what you are trying to do for getting the Node.
Could you please explain what is
contextDropDowns
you should directly get the node using wdcontext.node<node name>.
I think the method that you are trying is not giving the correct node to you and so index is going out of range.
Reagrds,
Sarbjeet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Prakash
The error comes if the given index is not in within the node elements. You can try adding a condition to check the size of node.
Set the lead selection inside a condtion
if(node.size() >= j) {
node.setLeadSelection(j); //this is the place causing the error
}
As following statement returns a node and it is quite possible that the node elements are less than the size value j.
IWDNode node = wdContext.getChildNode((String) contextDropDowns.elementAt(j),0);
Lemme know if it helps
Abhinav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.