on 12-09-2010 12:14 AM
Hi ,
I am getting Index out of bounds exception.
Please help.
Thanking You.
Regards,
Reinuka Paul.
Hi Reinuka Paul
To Avoid Index out of bounds exception try to use the code inside Try/Catch block with
int node_size = wdContext.node<Node Name>().size();
if(node_size > 0)
{
// Write your code here
}
This will resolved your issue with index out of bounds. Check NWDS Error log <Windows : Show view : Others : PDE Runtime : Error Logs > for more details
Hope it will helps
Regards, Arun Jaiswal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post the complete stacktrace and the code that causes the exception.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Reinuka,
Are you trying to access a node instance that does not exist ?
Like suppose u have a 0..n cardinality node under Context named AAA and an attribute inside it named bbb.
if u are using any code like :
wdContext.nodeAAA().getAAAElementAt(i).getbbb() ;
where 'i' is a loop iterator.
Suppose if the value of i is 13 but the size of node AAA is 5, the its likely that you will get this error.
Regards,
Sayan Ghosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To avoid index out of bound error always check whether the node has values and then proceed with the looping statement.
if(!wdcontext.nodetable().isEmpty)
{
int table_size = wdcontext.nodetable().size();
for(int i=0;i<size;i++)
{
------
}
}
Regards,
Bala Baskaran.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
this will appear if you trying to access the data of node whose size is less than the size of your parameter in the loop.
Regards,
Govindu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It seems you are iterating the context node or any string array for more than its size.
As per the message its trying to get the value of index 13 but the actual no. of elements in the context node is 5 only or String array size is 5.
Share the code for more clarity.
Regards
Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Index Out of Bound Exception Occurs when we try to access an element of beyond the storage capacity of the index. check the size of your total records with the index you are passing. Your index should be less or equals than the total size.
Regards
Suresh Bachimanchi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Paul,
Where you are getting index Out of Bound Exception? Explain bit more on when and where it is coming.
If it is coming while looping the node, then check the size of the node and do the looping.
Regards
Nizamudeen SM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.