Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Null pointer exception

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

}

Former Member
Former Member replied

Hi,

You need to add this check too

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

Aviad

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question