<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Property Conversion failed in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/property-conversion-failed/m-p/321068#M8069</link>
    <description>&lt;P&gt;Hi Surya,&lt;/P&gt;
&lt;P&gt;I believe your JS Date object is not recognized as an instance of Java Calendar.&lt;/P&gt;
&lt;P&gt;The exception is being thrown here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Override
public Serializable normalize(Object value) throws PropertyConversionException {
if (isNormalized(value)) {
return (Serializable) value;
}
if (value.getClass() == Date.class) {
Calendar cal = Calendar.getInstance();
cal.setTime((Date) value);
return cal;
}
if (value instanceof String) {
String string = (String) value;
if (string.length() == 0) {
return null;
}
return (Calendar) field.getType().decode(value.toString());
}
throw new PropertyConversionException(value.getClass(), Calendar.class);
}

@Override
public boolean isNormalized(Object value) {
return value == null || value instanceof Calendar;
}


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;source: &lt;A href="https://github.com/nuxeo/nuxeo/blob/434093e97825bf7e02578efd428e71f588704f20/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/model/impl/primitives/DateProperty.java" target="test_blank"&gt;https://github.com/nuxeo/nuxeo/blob/434093e97825bf7e02578efd428e71f588704f20/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/model/impl/primitives/DateProperty.java&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;-Yousuf&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2016 17:19:15 GMT</pubDate>
    <dc:creator>Yousuf_Nejati</dc:creator>
    <dc:date>2016-05-31T17:19:15Z</dc:date>
    <item>
      <title>Property Conversion failed</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/property-conversion-failed/m-p/321067#M8068</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Not able to set property of type Datetime in Nuxeo using Automation Scripting (JavaScript). Below is the code snippet:&lt;/P&gt;
&lt;P&gt;function run(input, params) {&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;var d2 = new Date();
d2.setFullYear(d2.getFullYear()+7);

Document.SetProperty(input,{
	/*required:true - type: string*/
	'xpath':"doc:start_date",
	/*required:false - type: boolean*/
	'save':true,
	/*required:false - type: serializable*/
	'value':d2
});
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;}
Below error is occured in Nuxeo, Please suggest how to do property convert:&lt;/P&gt;
&lt;P&gt;Caused by: org.nuxeo.ecm.core.api.model.PropertyConversionException: Property Conversion failed from class org.nuxeo.ecm.automation.core.util.DataModelProperties to class java.util.Calendar
at org.nuxeo.ecm.core.api.model.impl.primitives.DateProperty.normalize(DateProperty.java:66)
at org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(AbstractProperty.java:311)
at org.nuxeo.ecm.automation.core.operations.document.SetDocumentProperty.run(SetDocumentProperty.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 08:29:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/property-conversion-failed/m-p/321067#M8068</guid>
      <dc:creator>surya_nagaraj</dc:creator>
      <dc:date>2016-05-31T08:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Property Conversion failed</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/property-conversion-failed/m-p/321068#M8069</link>
      <description>&lt;P&gt;Hi Surya,&lt;/P&gt;
&lt;P&gt;I believe your JS Date object is not recognized as an instance of Java Calendar.&lt;/P&gt;
&lt;P&gt;The exception is being thrown here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Override
public Serializable normalize(Object value) throws PropertyConversionException {
if (isNormalized(value)) {
return (Serializable) value;
}
if (value.getClass() == Date.class) {
Calendar cal = Calendar.getInstance();
cal.setTime((Date) value);
return cal;
}
if (value instanceof String) {
String string = (String) value;
if (string.length() == 0) {
return null;
}
return (Calendar) field.getType().decode(value.toString());
}
throw new PropertyConversionException(value.getClass(), Calendar.class);
}

@Override
public boolean isNormalized(Object value) {
return value == null || value instanceof Calendar;
}


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;source: &lt;A href="https://github.com/nuxeo/nuxeo/blob/434093e97825bf7e02578efd428e71f588704f20/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/model/impl/primitives/DateProperty.java" target="test_blank"&gt;https://github.com/nuxeo/nuxeo/blob/434093e97825bf7e02578efd428e71f588704f20/nuxeo-core/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/model/impl/primitives/DateProperty.java&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;-Yousuf&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 17:19:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/property-conversion-failed/m-p/321068#M8069</guid>
      <dc:creator>Yousuf_Nejati</dc:creator>
      <dc:date>2016-05-31T17:19:15Z</dc:date>
    </item>
  </channel>
</rss>

