cancel
Showing results for 
Search instead for 
Did you mean: 

Geting Nullpointer Exception When i click empty table

Private_Member_52584
Participant
0 Kudos

HI....

Am Fresher to WebDynpro java....... I dont know how to handle the null pointer exception Even if there are no rows in the table or if there are any,when we click on the remove button then null pointer exception shouldn't occur.How to Handle this type of problem??...

plz help me in this regard....

Edited by: Venkat5939 on Nov 26, 2010 1:39 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try it by changing the cardinality of your node that is binded with table.

Hope it will work.

Regards,

Saurabh

Answers (3)

Answers (3)

Former Member
0 Kudos

Use try Catch in the remove button event.

Put your remove code in that try block.

if you are trying to remove all the lines in the table, the use:

wdContext.nodeTable().invalidate();

if you are removeing one element at a time, use:


int index = wdContext.nodeTable().getLeadSelection();
wdContext.nodeTable().removeElemenAt(index);

Former Member
0 Kudos

Hi Venkat,

If you try to delete a row from the table using current element of the table node when the table is empty, It would throw the NullPointer exception. Also when there are N number of rows and no one was lead selected, there you will get the same exception.

Kindly modify your code with some validation logics or implement a Try Catch block to handle exceptions.

Regards

Karthik

Former Member
0 Kudos

Hi Venkat

Try to change the cardinality of node from o..n to 1..n and chekc the application