<?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 An error when preview images added in the Files tab in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327478#M14479</link>
    <description>&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;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)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem is created by an url address send to the PictureTilesRestlets:
&lt;A href="http://localhost:8080/nuxeo/restAPI/getTiles/default/a27f4a36-447f-4ce1-aff9-5a74115aa3d3/64/64/3?format=json" target="test_blank"&gt;http://localhost:8080/nuxeo/restAPI/getTiles/default/a27f4a36-447f-4ce1-aff9-5a74115aa3d3/64/64/3?format=json&lt;/A&gt;
but it expects the format (as is in restAPI-contrib.xml):
/nuxeo/restAPI/getTiles/{repoId}/{docId}/{tileWidth}/{tileHeight}/{maxTiles}?fieldPath=(subPath)&amp;amp;x=(tileX)&amp;amp;y=(tileY)&amp;amp;format=(XML|JSON)&lt;/P&gt;
&lt;P&gt;In consequence, the following code returns a null value for xpath:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;        Form form = req.getResourceRef().getQueryAsForm();
        String xpath = (String) form.getFirstValue("fieldPath");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and an adapter have a null xpath:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;            adapter = getFromCache(targetDocument, xpath);
            if (adapter == null) {
                adapter = targetDocument.getAdapter(PictureTilesAdapter.class);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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,&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="nxpreviewerror.jpg"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/1976iB228FF14AC7A1FEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="nxpreviewerror.jpg" alt="nxpreviewerror.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2017 15:27:30 GMT</pubDate>
    <dc:creator>adam_bo_</dc:creator>
    <dc:date>2017-05-29T15:27:30Z</dc:date>
    <item>
      <title>An error when preview images added in the Files tab</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327478#M14479</link>
      <description>&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;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)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem is created by an url address send to the PictureTilesRestlets:
&lt;A href="http://localhost:8080/nuxeo/restAPI/getTiles/default/a27f4a36-447f-4ce1-aff9-5a74115aa3d3/64/64/3?format=json" target="test_blank"&gt;http://localhost:8080/nuxeo/restAPI/getTiles/default/a27f4a36-447f-4ce1-aff9-5a74115aa3d3/64/64/3?format=json&lt;/A&gt;
but it expects the format (as is in restAPI-contrib.xml):
/nuxeo/restAPI/getTiles/{repoId}/{docId}/{tileWidth}/{tileHeight}/{maxTiles}?fieldPath=(subPath)&amp;amp;x=(tileX)&amp;amp;y=(tileY)&amp;amp;format=(XML|JSON)&lt;/P&gt;
&lt;P&gt;In consequence, the following code returns a null value for xpath:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;        Form form = req.getResourceRef().getQueryAsForm();
        String xpath = (String) form.getFirstValue("fieldPath");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and an adapter have a null xpath:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;            adapter = getFromCache(targetDocument, xpath);
            if (adapter == null) {
                adapter = targetDocument.getAdapter(PictureTilesAdapter.class);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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,&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="nxpreviewerror.jpg"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/1976iB228FF14AC7A1FEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="nxpreviewerror.jpg" alt="nxpreviewerror.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 15:27:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327478#M14479</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2017-05-29T15:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: An error when preview images added in the Files tab</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327479#M14480</link>
      <description>&lt;P&gt;Thanks for the report. What is it that you call "the preview functionality"? Which part of which UI are you using?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 13:25:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327479#M14480</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2017-06-21T13:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: An error when preview images added in the Files tab</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327480#M14481</link>
      <description>&lt;P&gt;I have updated the report and included a picture where is pointed the icon called by me "the preview functionality"&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:06:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327480#M14481</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2017-06-21T14:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: An error when preview images added in the Files tab</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327481#M14482</link>
      <description>&lt;P&gt;I can't reproduce. Is your image of a special type or size?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:29:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327481#M14482</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2017-06-21T14:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: An error when preview images added in the Files tab</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327482#M14483</link>
      <description>&lt;P&gt;It is a normal jpeg file. Nuxeo with the DAM addon. Steps&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 15:38:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327482#M14483</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2017-06-21T15:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: An error when preview images added in the Files tab</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327483#M14484</link>
      <description>&lt;P&gt;I have attached an example image "P3140005.JPG" that creates a problem. "WidthThreshold"=1200 and "HeightThreshold"=1200&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:56:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/an-error-when-preview-images-added-in-the-files-tab/m-p/327483#M14484</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2017-06-22T14:56:06Z</dc:date>
    </item>
  </channel>
</rss>

