on 11-15-2007 2:37 PM
Hi forum
I am getting array out of bound exception in the following code:
int intLNodeSize=0;
intLNodeSize=wdContext.nodeVn_DelUserParameters().size();
wdComponentAPI.getMessageManager().reportSuccess("node size"+intLNodeSize);
if(intLNodeSize==1)
{
wdComponentAPI.getMessageManager().reportSuccess("in i=1");
//wdContext.currentVn_DelUser_FlagParameterElement().setVa_DelUser_CheckedFlag(WDVisibility.VISIBLE);
wdContext.nodeVn_Checked().getVn_CheckedElementAt(0).setVa_DelUser_CheckedFlag(true);
}
if(intLNodeSize>1)
{
wdComponentAPI.getMessageManager().reportSuccess("in i>1");
for(int i=0;i<intLNodeSize;i++)
{
wdComponentAPI.getMessageManager().reportSuccess("in for loop"+wdContext.nodeVn_DelUserParameters().getVn_DelUserParametersElementAt(i).getVa_DelUser_MainRecordFlag());
if(wdContext.nodeVn_DelUserParameters().getVn_DelUserParametersElementAt(i).getVa_DelUser_MainRecordFlag()==false)
{
//wdContext.currentVn_DelUser_FlagParameterElement().setVa_DelUser_CheckedFlag(WDVisibility.NONE);
wdContext.nodeVn_Checked().getVn_CheckedElementAt(i).setVa_DelUser_CheckedFlag(false);
}
else
{
//wdContext.currentVn_DelUser_FlagParameterElement().setVa_DelUser_CheckedFlag(WDVisibility.VISIBLE);
wdContext.nodeVn_Checked().getVn_CheckedElementAt(i).setVa_DelUser_CheckedFlag(true);
}
}
}
Its goin in the for loop once only when the node size=2.
I am getting the following exception : Index: 0, Size: 0 : Index: 0, Size: 0 : java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Thanks & Regards
Jaspreet Kaur
Hi,
You are looping around nodeVn_DelUserParameters() node and you are gettting the element of this node nodeVn_Checked() in your else condition. This node might have less elements than nodeVn_DelUserParameters().
This might be the problem. Try commenting the below line and check it once ...
wdContext.nodeVn_Checked().getVn_CheckedElementAt(i).setVa_DelUser_CheckedFlag(true);
You are also accessing the element of the same node in if clause too.
Regards,
Murtuza
Message was edited by:
Murtuza Kharodawala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.