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,

nxpreviewerror.jpg

All the best

0 votes

0 answers

1744 views

ANSWER

Thanks for the report. What is it that you call "the preview functionality"? Which part of which UI are you using?
06/21/2017

I have updated the report and included a picture where is pointed the icon called by me "the preview functionality"
06/21/2017

I can't reproduce. Is your image of a special type or size?
06/21/2017

It is a normal jpeg file. Nuxeo with the DAM addon. Steps: 1. create a file document (without attaching any file), 2. in the new document go to the Files tab and add the image, 3. try to preview the image.
06/21/2017

I have attached an example image "P3140005.JPG" that creates a problem. "WidthThreshold"=1200 and "HeightThreshold"=1200
06/22/2017