cancel
Showing results for 
Search instead for 
Did you mean: 

Nuxeo 5.6 to 5.8 => RUN SCRIPT - REGRESSION on set list of blob - is it still an Array of Blob ???

milonette_
Star Collaborator
Star Collaborator

Hello,

I got a multi-value blob document property that was perfectly set by a run script such as :

if (WorkflowVariables["newFile"] != null){
java.util.Collections.addAll(Context["listBlob"], Document.getProperty("xpathofme:listBlobsOfMe"));
Context["listBlob"].add( WorkflowVariables["newFile"]  );
//THIS CODE FAILED IN 5.8
Document.doc.setPropertyValue("xpathofme:listBlobsOfMe", Context["listBlob"].toArray());
}

New exception in 5.8 :

Caused by: org.nuxeo.ecm.core.api.model.PropertyConversionException: Property Conversion failed from class java.util.ArrayList to interface org.nuxeo.ecm.core.api.Blob
    at org.nuxeo.ecm.core.api.model.impl.primitives.BlobProperty.normalize(BlobProperty.java:75)
    at org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(AbstractProperty.java:329)
    at org.nuxeo.ecm.core.api.model.impl.ComplexProperty.setValue(ComplexProperty.java:206)
    at org.nuxeo.ecm.core.api.model.impl.osm.ComplexMemberProperty.setValue(ComplexMemberProperty.java:69)
    at org.nuxeo.ecm.core.api.model.impl.ListProperty.setValue(ListProperty.java:253)
    at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.setPropertyValue(DocumentModelImpl.java:1498) 

NOTHING changed in Nuxeo Studio... we just increase version from 5.6 to 5.8 and this list is STILL a blob-list. Do you know why the code doesn't works anymore ?

Thanks

2 REPLIES 2

Florent_Guillau
World-Class Innovator
World-Class Innovator

Document.getProperty("xpathofme:listBlobsOfMe") now consistently returns an array for array-like values, whereas in Nuxeo 5.6 it may have returned a list.

So your first addAll adds to Context["listBlob"] a single element which is an array, instead of adding all the elements of the array. You should rework that part.

BTW you don't need the .toArray() in the last statement, Nuxeo will work fine if you pass either an array or a list to setPropertyValue and will normalize the value passed.

Hello,

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.