An error when preview images added in the Files tab
When the file document is created without a file blob and after some images are added in the Files tab, then the preview functionality does not work for them. The error following error is logged:
2017-05-29 14:24:22,906 ERROR [http-bio-192.168.31.72-8083-exec-28] [nuxeo-error-log] java.lang.NullPointerException
at org.nuxeo.ecm.platform.pictures.tiles.serializer.JSONPictureTilesSerializer.serialize(JSONPictureTilesSerializer.java:44)
at org.nuxeo.ecm.platform.pictures.tiles.restlets.PictureTilesRestlets.handleSendInfo(PictureTilesRestlets.java:194)
at org.nuxeo.ecm.platform.pictures.tiles.restlets.PictureTilesRestlets.handle(PictureTilesRestlets.java:136)
at org.nuxeo.ecm.platform.ui.web.restAPI.ThreadSafeRestletFilter.doHandle(ThreadSafeRestletFilter.java:56)
The problem is created by an url address send to the PictureTilesRestlets: http://localhost:8080/nuxeo/restAPI/getTiles/default/a27f4a36-447f-4ce1-aff9-5a74115aa3d3/64/64/3?format=json but it expects the format (as is in restAPI-contrib.xml): /nuxeo/restAPI/getTiles/{repoId}/{docId}/{tileWidth}/{tileHeight}/{maxTiles}?fieldPath=(subPath)&x=(tileX)&y=(tileY)&format=(XML|JSON)
In consequence, the following code returns a null value for xpath:
Form form = req.getResourceRef().getQueryAsForm();
String xpath = (String) form.getFirstValue("fieldPath");
and an adapter have a null xpath:
adapter = getFromCache(targetDocument, xpath);
if (adapter == null) {
adapter = targetDocument.getAdapter(PictureTilesAdapter.class);
If a file document is created with an image and after some images are added by the Files tab, then every preview shows the same main picture,
All the best