From: Aron Roberts Date: Fri, 26 Apr 2013 20:19:15 +0000 (-0700) Subject: Merge branch 'CSPACE-5763' of github.com:aronr/services into CSPACE-5763 X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=b3e7eea79bc270ac398f5ce69d2401579f01adde;p=tmp%2Fjakarta-migration.git Merge branch 'CSPACE-5763' of github.com:aronr/services into CSPACE-5763 Conflicts: services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java --- b3e7eea79bc270ac398f5ce69d2401579f01adde diff --cc services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java index 0031dbdeb,2144f2976..01901f1ee --- a/services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java @@@ -188,7 -187,27 +188,27 @@@ public class ServiceBindingUtils } try { Object obj = docModel.getPropertyValue(propName); - if (obj == null) { + return DocumentUtils.propertyValueAsString(obj, docModel, propName); + return ""; + } + if (String.class.isAssignableFrom(obj.getClass())) { + return (String)obj; + } else { + // Handle cases where a property value returned from the repository + // can't be directly cast to a String. + // + // FIXME: We may want to create a new utility method to centralize + // our handling of these cases, as similar conversions might currently + // be performed in multiple classes. - ADR 2013-04-25 + if (obj instanceof GregorianCalendar) { + return GregorianCalendarDateTimeUtils.formatAsISO8601Timestamp((GregorianCalendar)obj); + } else { + logger.warn("Could not convert value of property " + propName + + " in path " + docModel.getPathAsString() + " to a String."); + logger.warn("This may be due to a new, as-yet-unhandled datatype returned from the repository"); + return ""; + } + } } catch(IndexOutOfBoundsException ioobe) { // Should not happen, but may with certain array forms if(logger.isTraceEnabled()) {