Search code examples
javaxpages

XPages ODA issue with getting a date value from a field in Java


I'm using ODA (which is wonderful) in my Java code but I'm having trouble with getting a date value from a field.

If I use:

DateTime lastApprDt = doc.getItemValue("LastApproved", Date.class);

then the parser objects and suggests "change type of lastApprDt to Date"

If I change the code to:

Date lastApprDt = doc.getItemValue("LastApproved", Date.class);

then the parser is happy but when I run the code I get an error:

[ODA::WARNING] Auto-boxing requested a com.ibm.security.util.calendar.BaseCalendar$Date but is returning a org.openntf.domino.impl.DateTime in item LastApproved for document id 992

I'm confused! If doc.getItemValue("LastApproved", Date.class) returns a Date type then why do I get the error?


Solution

  • Make sure that the lastApprDt Date is of type java.util.Date (and not of type com.ibm.security.util.calendar.BaseCalendar.Date).