Showing results for 
Search instead for 
Did you mean: 

java.lang.IndexOutOfBoundsException: Index: 5, Size: 0

Former Member
0 Kudos

table A -

emailid date-in sender recipient

Table B

attachementid attachmentname

i have problem with another issue

i have a master (table) detail (text and textview)

table is bind to nodetable (model)

detail is bind to nodedetail (model)

everytime when i run the i clicked the row,

i want the details to show out....

if i replace with this

IPrivateMailInboundView.IEmailInCommandBeanElement element=wdContext.nodeEmailInCommandBean().getEmailInCommandBeanElementAt(i);


it works ok will change the table row column [date-in] to "abc"

but my intention is to change the detail table attachement-name

public void onActionrowSelected( wdEvent )
    //@@begin onActionrowSelected(ServerEvent)
	int n=wdContext.nodeTablesEmailIn().size();
	int leadSelected=wdContext.nodeTablesEmailIn().getLeadSelection();
	for(int i=n-1;i>=0;--i){
		if(wdContext.nodeTablesEmailIn().isMultiSelected(i) || leadSelected==i){
			IPrivateMailInboundView.IEmailInDetailsCommandBeanElement elem=wdContext.nodeEmailInDetailsCommandBean().getEmailInDetailsCommandBeanElementAt(i);

#1#java.lang.IndexOutOfBoundsException: Index: 5, Size: 0

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi ,

can u try like this

check the intial value of the node then only u can enter the loop

and in the for loop n>0




for(i=n-1;n>0;i-- )





Former Member
0 Kudos


Seems that you have trivial coding error if first line of "IF" statement:

IPrivateMailInboundView.IEmailInDetailsCommandBeanElement elem 
  =  wdContext.nodeEmailInDetailsCommandBean)

You are using index <b>i</b> to access inner node, while this is index of outer node.

Also you do not access nested node elements correctly.

So try this:

1. Make sure your nested node for details is non-singleton and has cardinality 1..1

2. Write your code as following:

public void onActionrowSelected( wdEvent )
  //@@begin onActionrowSelected(ServerEvent)
  final IPrivateMailInboundView.ITablesEmailInNode node = wdContext.nodeTablesEmailIn();
  int n = node.size();
  int leadSelected = node.getLeadSelection();
  for(int i=n-1;i>=0;--i) {
    if  ( node.isMultiSelected(i) || leadSelected==i ) {
      final IPrivateMailInboundView.ITablesEmailInElement elEmail = 
        node.getTablesEmailInElementAt( i ); 
      IPrivateMailInboundView.IEmailInDetailsCommandBeanElement elDetails 
        = elEmail.nodeEmailInDetailsCommandBean().getEmailInDetailsCommandBeanElementAt(0);

Valery Silaev

SaM Solutions

Former Member
0 Kudos

Hi yzme,

If you mean to say that it may happen that there are 'no details' (i.e. The context node "nodeEmailInDetailsCommandBean" may not contain any data init ) for a selected <u>email id</u> in the table populated by node TablesEmailIn, then you can catch the ArrayOutOfBounds exception for that piece of code and then display a message regarding that.

This can be done as:



..... your code

} catch (ArrayIndexOutOfBoundsException e) {


wdComponentAPI.getMessageManager().reportWarning("No Details found");




Former Member
0 Kudos


The context node "nodeEmailInDetailsCommandBean" may not contain any data init.

In your code "n" refers to nodeTablesEmailIn but in the loop your are trying to access another node. So check this once.

ArrayIndexOutOfBounds exception coming bcose you are trying to access nodeElement which is not there !!!

Regards, Anilkumar

Former Member
0 Kudos

you have identify what i have identify..

yet ...the problem is i don't know how to handle this

onleadselect...probably..i need to use the to loop...

but when i click on the row,i need my details - attachment name to show detail table.....

what do you think i should do

The context node "nodeEmailInDetailsCommandBean" may not contain any data init


In your code "n" refers to nodeTablesEmailIn but in the loop your are trying to access another node. So check this once