cancel
Showing results for 
Search instead for 
Did you mean: 

Null pointer exception

Former Member
0 Kudos

Here I am trying to see if the date field is emptyor not. I am taking it in "usrData" and assigning "usrData" to a string "s" and checking whether c is empty or not. but it is giving null pointer error

please help

Date usrDate =(Date) wdContext.nodePerson().currentPersonElement().getAttributeValue(field);

// Get field properties of attribute under investigation

IWDAttributeInfo personAttr = wdContext.nodePerson().getNodeInfo().getAttribute(field);

// Check if date is valid

String s;

s= usrDate.toString();

if (s.length()==0) {

// If date is not valid: report error message

msgMan.reportContextAttributeMessage(

wdContext.nodePerson().currentPersonElement(),

personAttr,

IMessageSub_comp.DATA_IS_NOT_VALID,

new Object[] { field, usrDate },

true);

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to add this check too

If (usrDate != null) ........

Aviad

Answers (0)