Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4618

DataSourceProvider is not closing inputstream acquired from DataSource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7
    • 2.5.7, 2.6.4, 2.7.1
    • JAX-RS
    • None
    • Windows

    • Unknown

    Description

      When a REST method returns a DataSource, e.g.:

      @GET
      public DataSource getFile() { ...

      ...the CXF JAX-RS framework obtains an inputstream from the datasource but does close the stream after use. This is noticeable on windows environments for the case of a provided FileDataSource, since the underlying file cannot be deleted while this file handle remains open.

      I've tracked down the problem to the writeTo() method of org.apache.cxf.jaxrs.provider.DataSourceProvider and will attach a proposed patch.

      Attachments

        1. DataSourceProvider.java.patch
          0.5 kB
          Steve Hodecker

        Activity

          People

            dkulp Daniel Kulp
            shodecker Steve Hodecker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: