Uploaded image for project: 'Nuxeo Java Client'
  1. Nuxeo Java Client
  2. JAVACLIENT-236

Support the download of JSON content

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.13.0
    • Fix Version/s: 3.14.0
    • Component/s: Core
    • Release Notes Summary:
      JSON blobs are now downloaded correctly.
    • Backlog priority:
      650
    • Sprint:
      nxplatform #107
    • Story Points:
      5

      Description

      Steps to reproduce:

      1. start Nuxeo LTS 2021
      2. log in as Administrator
      3. navigate to the personal workspace
      4. create a File document with a .json file and title=JSONcontent
      5. run this small program
      package org.nuxeo;
      
      import org.nuxeo.client.NuxeoClient;
      import org.nuxeo.client.NuxeoClient.Builder;
      import org.nuxeo.client.objects.Document;
      import org.nuxeo.client.objects.blob.StreamBlob;
      
      public class DownloadJsonFile {
          
          public static void main(String[] args) {
              Builder builder = new NuxeoClient.Builder();
              builder.url("http://localhost:8080/nuxeo").authentication("Administrator", "Administrator").schemas(
                      "*").connectTimeout(0).timeout(0);
              NuxeoClient client = builder.connect();
              Document jsonDoc = client.repository().fetchDocumentByPath("/default-domain/UserWorkspaces/Administrator/JSONcontent");
              
              StreamBlob streamBlob = jsonDoc.streamBlob();
              System.out.println(streamBlob.getFilename());
          }
      } 

       

      Observe it produces this error

      Exception in thread "main" org.nuxeo.client.spi.NuxeoClientException: Error during deserialization of HTTP body
      	at org.nuxeo.client.marshaller.NuxeoResponseConverter.convert(NuxeoResponseConverter.java:131)
      	at org.nuxeo.client.marshaller.NuxeoResponseConverter.convert(NuxeoResponseConverter.java:57)
      	at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
      	at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
      	at org.nuxeo.client.NuxeoClient.fetchResponse(NuxeoClient.java:310)
      	at org.nuxeo.client.objects.AbstractConnectable.fetchResponse(AbstractConnectable.java:65)
      	at org.nuxeo.client.objects.Document.streamBlob(Document.java:724)
      	at org.nuxeo.client.objects.Document.streamBlob(Document.java:717)
      	at org.nuxeo.DownloadJsonFile.main(DownloadJsonFile.java:18)
      Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.nuxeo.client.objects.blob.StreamBlob` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
       at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 2]
      	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
      	at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1904)
      	at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400)
      	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1349)
      	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1415)
      	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:351)
      	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:184)
      	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
      	at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2051)
      	at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1459)
      	at org.nuxeo.client.marshaller.NuxeoResponseConverter.convert(NuxeoResponseConverter.java:128)
      	... 8 more
      

       

      Expected behavior: the program runs without error, download the .json file and reads the filename (and its content).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: