Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-837

Client methods that return an InputStream return it in a closed state using ApacheHttpClient4Engine

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • 3.0-beta-4
    • 3.0-beta-5
    • None
    • None
    • Hide

      1. Create a client method that returns an InputStream.
      2. Call the method and try to use the stream.

      Show
      1. Create a client method that returns an InputStream. 2. Call the method and try to use the stream.

      Any client method that returns an InputStream using the ApacheHttpClient4Engine gets the InputStream closed before it can be used. This is done by ClientInvocationBuilder.extractResult, which closes the response in its finally block (and of course closing the response must close the stream in order to work).

      Note that BodyEntityExtractor.extractEntity checks for an InputStream result after it calls ClientInvocationBuilder.extractResult, but by then it's too late: ClientInvocationBuilder.extractResult has already done its dirty deed.

      As a solution perhaps ClientInvocationBuilder.extractResult should be changed to not close the response, and instead other methods in ClientInvocationBuilder that call extractResult like delete, post, put, etc. should be changed to close the response in finally blocks of their own.

              patriot1burke@gmail.com Bill Burke (Inactive)
              dgileadi David Gileadi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: