}\r
try {\r
Object obj = docModel.getPropertyValue(propName);\r
- if (obj == null) {\r
+ return DocumentUtils.propertyValueAsString(obj, docModel, propName);\r
+ return "";\r
+ }\r
+ if (String.class.isAssignableFrom(obj.getClass())) {\r
+ return (String)obj;\r
+ } else {\r
+ // Handle cases where a property value returned from the repository\r
+ // can't be directly cast to a String.\r
+ //\r
+ // FIXME: We may want to create a new utility method to centralize\r
+ // our handling of these cases, as similar conversions might currently\r
+ // be performed in multiple classes. - ADR 2013-04-25\r
+ if (obj instanceof GregorianCalendar) {\r
+ return GregorianCalendarDateTimeUtils.formatAsISO8601Timestamp((GregorianCalendar)obj);\r
+ } else {\r
+ logger.warn("Could not convert value of property " + propName\r
+ + " in path " + docModel.getPathAsString() + " to a String.");\r
+ logger.warn("This may be due to a new, as-yet-unhandled datatype returned from the repository");\r
+ return "";\r
+ }\r
+ }\r
} catch(IndexOutOfBoundsException ioobe) {\r
// Should not happen, but may with certain array forms\r
if(logger.isTraceEnabled()) {\r