Uploaded image for project: 'Chemistry (Retired)'
  1. Chemistry (Retired)
  2. CMIS-771

deleteTree via compressed (gzipped) JSON fails with: Unexpected token END OF FILE at position 0.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • OpenCMIS 0.10.0
    • OpenCMIS 0.11.0
    • opencmis-client
    • (Apache) Web server configured to compress (gzip) responses for (Android) clients

    Description

      Since HTTP's Content-Length header returns the compressed size, it is an error to use getContentLength() to size buffers for the uncompressed data. Instead, read bytes from the response until InputStream.read() returns -1. See: http://android-developers.blogspot.de/2011/09/androids-http-clients.html

      If the Web Server decides to compress the response of the deleteTree request you will get a Content-Length of 20 for a compressed (gzipped) empty body. This makes no sense but is valid.

      org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: Parsing exception!
      at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.parse(AbstractBrowserBindingService.java:325)
      at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.parseObject(AbstractBrowserBindingService.java:289)
      at org.apache.chemistry.opencmis.client.bindings.spi.browser.ObjectServiceImpl.deleteTree(ObjectServiceImpl.java:506)
      at org.alfresco.mobile.android.api.services.impl.AbstractDocumentFolderServiceImpl.delete(AbstractDocumentFolderServiceImpl.java:684)
      at org.alfresco.mobile.android.api.services.impl.AbstractDocumentFolderServiceImpl.deleteNode(AbstractDocumentFolderServiceImpl.java:646)
      ... 2 more
      Caused by: Unexpected token END OF FILE at position 0.
      at org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParser.parse(JSONParser.java:273)
      at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.parse(AbstractBrowserBindingService.java:323)
      ... 6 more

      Attachments

        1. patch
          2 kB
          Achim Derigs

        Activity

          People

            fmui Florian Müller
            aderigs Achim Derigs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: