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

DataSourceProvider produces FileNotFoundException upon second call of getInputStream()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.14.Final
    • 3.0.9.Final, 3.0.13.Final
    • jaxrs
    • None

      The fix for RESTEASY-1080 introduced another bug. If the DataSourceProvider uses a temporary file and the InputStream returned by getInputStream() is read until the end, any further call to getInputStream() results in a FileNotFoundException.

      The SequenceDataSource used in the DataSourceProvider deletes the temporary file when it has been read until the end. When getInputStream() is called after the temporary file has been deleted new FileInputStream(tempFile) in getInputStream() results in a FileNotFoundException.

      The javadoc of javax.activation.DataSource.getInputStream() however states:

      ... Note that a new InputStream object must be returned each time this method is called, and the stream must be positioned at the beginning of the data.

      (http://docs.oracle.com/javase/7/docs/api/javax/activation/DataSource.html#getInputStream())

            rsigal@redhat.com Ronald Sigal
            Martin.Bonato@prime-sign.com Martin Bonato (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: