Skip to Content
0
Former Member
Nov 26, 2009 at 12:42 AM

Null pointer exception when trying to access value

40 Views

I am trying to accees the value while passing the column key, here the code i am using:

String value = wdThis.getObjectDataCellData(s1, "ZCMP_BNC_EUR").getContent().toString();

I am getting a null pointer exception.

How to avoid this null pointer and show a custum message to the user?

I tried but doesn't work, still getting null pointer at first line in below given, here S1 is the key value and i am passing interger value..

	String validateCell = wdThis.getObjectDataCellData(s1, "ZCMP_BNC_EUR").getContent().toString();
	if( validateCell != null && validateCell.equalsIgnoreCase(" ") ){
                       // some code
                       }
                    

Please help , got stuc very badly.

in adition to that, say example , i have node with 10 vlues based on this i get the index from 0 to 9 and I wnat to pass this as key value 0 to 9 for getObjectDataCellData S1 parameter, how can i achieve this?

Thanks

Thanks

Srini