cancel
Showing results for 
Search instead for 
Did you mean: 

Error : java.lang.ArrayIndexOutOfBoundsException: -1

0 Kudos

Hi ,

I am trying to set values to model object field as below

Zsproposal zsProposal=new Zsproposal();

if (wdContext.nodeUsersNode().getLeadSelection()!= -1)

{

zsProposal.setZz_Requested_By(wdContext.currentUsersNodeElement().getUserId());

}

here,

Zsproposal - structure of a BAPI

Zz_Requested_By - a field in Zsproposal

On executing the applcaition. it throws the following error

Exception cause in method executeXXXModel() method : null

Exception message in method executeXXXModel() method : -1

Exception in method executeXXXModel() method : java.lang.ArrayIndexOutOfBoundsException: -1

Could anyone help me to find where the problem is?

Regards,

Manchari

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

This issue is resolved by invalidating method

p330068
Active Contributor
0 Kudos

Hi Manchari,

Please use like the below code and use the message manager to report the message after the satement to see where exatly the problem is.


Zsproposal zsProposal=new Zsproposal();

if(wdContext.nodeUsersNode().size > 0)
{
         if (wdContext.nodeUsersNode().getLeadSelection()!= -1)
         {
                      zsProposal.setZz_Requested_By(wdContext.currentUsersNodeElement().getUserId());
          }

}

Hope it will helps

Regards, Arun Jaiswal

Former Member
0 Kudos

Hi,

the exception is because if u try to access a value which is not there in the Array or list.

in this case try to m,ake the coordninality fo node : userdetails to 1-n and then check .

Regards,

Govindu

TusharShinde
Active Participant
0 Kudos
 
Zsproposal zsProposal=new Zsproposal();

if (wdContext.nodeUsersNode().getLeadSelection()!= -1)
{
        zsProposal.setZz_Requested_By(wdContext.currentUsersNodeElement().getUserId());
}

Try to put print statement and check whether UserId() contains any value or not...

Whether you want to put Current Login Portal ID or you already have the list of users in a node UsersNode.

 
wdComponentAPI.getMessageManager().reportWarning(""+wdContext.currentUsersNodeElement().getUserId());