I get a DataNotCompatibleException when I'm retrieving a column value that is already an instance of java.util.Date (because of the setPreferJavaDates). I don't believe it's correct behavior.
Example:
#!java
DominoViewEntry e = nav.getFirstDocument();
entry.setPreferJavaDates(true);
entry.getColumnValue("myDate", java.util.Date);
I think this method should foresee a possible "instance of Date" value and if so, return it without modifications.
#!java
public static Date toDate(Object value) throws DataNotCompatibleException {
if (value == null)
return null;
if (value instanceof Vector && (((Vector<?>) value).isEmpty()))
return null;
if (value instanceof Vector) {
value = ((Vector<?>) value).get(0);
}
if (value instanceof Long) {
return new Date(((Long) value).longValue());
} else if (value instanceof String) {
// TODO finish
DateFormat df = new SimpleDateFormat();
String str = (String) value;
if (str.length() < 1)
return null;
try {
return df.parse(str);
} catch (ParseException e) {
throw new DataNotCompatibleException("Cannot create a Date from String value " + (String) value);
}
} else if (value instanceof lotus.domino.DateTime) {
return DominoUtils.toJavaDateSafe((lotus.domino.DateTime) value);
} else {
throw new DataNotCompatibleException("Cannot create a Date from a " + value.getClass().getName());
}
}
I get a DataNotCompatibleException when I'm retrieving a column value that is already an instance of java.util.Date (because of the setPreferJavaDates). I don't believe it's correct behavior.
Example:
I think this method should foresee a possible "instance of Date" value and if so, return it without modifications.