Skip to Content
0
Former Member
Sep 11, 2008 at 11:29 AM

Null pointer exception

9 Views

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);

}