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


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"]  );
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(
    at org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(
    at org.nuxeo.ecm.core.api.model.impl.ComplexProperty.setValue(
    at org.nuxeo.ecm.core.api.model.impl.osm.ComplexMemberProperty.setValue(
    at org.nuxeo.ecm.core.api.model.impl.ListProperty.setValue(
    at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.setPropertyValue( 

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 ?


0 votes

1 answers



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.

0 votes


thanks you very much for answering.

After trying to understand what to do, I finally got the solution for this problem in nuxeo 5.8 ->

if (test){

java.util.ArrayList listBlob2 = new java.util.ArrayList(); listBlob2.add( WorkflowVariables["newFile"] );

for(int i=0; i < Document.getProperty("xpathofme:listBlobsOfMe").size(); i++){ listBlob2.add( Document.getProperty("xpathofme:listBlobsOfMe").get(i) ); }

Document.doc.setPropertyValue("xpathofme:listBlobsOfMe", listBlob2 ); }