You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2005/12/14 17:57:00 UTC

[jira] Erstellt: (JCR-293) Property.setValue(InputStream) closes stream

Property.setValue(InputStream) closes stream
--------------------------------------------

         Key: JCR-293
         URL: http://issues.apache.org/jira/browse/JCR-293
     Project: Jackrabbit
        Type: Bug
  Components: core  
 Environment: SVN Rev. 356803
    Reporter: Felix Meschberger
    Priority: Minor


Currently the Property.setValue(InputStream) - actually all methods setting a property value from an InputStream - method closes the stream when it has completely been read. While this might be a nice-to-have in some situations, it is IMHO not standard behaviour for stream consumers to close the stream when done.

My special use case is unpacking the contents of a ZIP file (ZIPInputStream). After streaming the contents of the first ZIP file entry into a property, the ZIPInputStream is closed by Jackrabbit and the rest of the file cannot be read.

Workaround: Instead of giving the original InputStream to the method, create a FileInputStream wrapper overwriting the close method to do nothing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-293) Property.setValue(InputStream) closes stream

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-293?page=comments#action_12360433 ] 

Jukka Zitting commented on JCR-293:
-----------------------------------

+1 to not close the stream in Property.setValue(InputStream)

I don't really use binary properties so I haven't run into this issue, but my natural instinct would be to write code like this:

    InputStream stream = ...;
    try {
        property.setValue(stream);
    } finally {
        stream.close();
    }


> Property.setValue(InputStream) closes stream
> --------------------------------------------
>
>          Key: JCR-293
>          URL: http://issues.apache.org/jira/browse/JCR-293
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>  Environment: SVN Rev. 356803
>     Reporter: Felix Meschberger
>     Priority: Minor

>
> Currently the Property.setValue(InputStream) - actually all methods setting a property value from an InputStream - method closes the stream when it has completely been read. While this might be a nice-to-have in some situations, it is IMHO not standard behaviour for stream consumers to close the stream when done.
> My special use case is unpacking the contents of a ZIP file (ZIPInputStream). After streaming the contents of the first ZIP file entry into a property, the ZIPInputStream is closed by Jackrabbit and the rest of the file cannot be read.
> Workaround: Instead of giving the original InputStream to the method, create a FileInputStream wrapper overwriting the close method to do nothing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (JCR-293) Property.setValue(InputStream) closes stream

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-293?page=all ]

Stefan Guggisberg reassigned JCR-293:
-------------------------------------

    Assign To: Stefan Guggisberg

> Property.setValue(InputStream) closes stream
> --------------------------------------------
>
>          Key: JCR-293
>          URL: http://issues.apache.org/jira/browse/JCR-293
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>  Environment: SVN Rev. 356803
>     Reporter: Felix Meschberger
>     Assignee: Stefan Guggisberg
>     Priority: Minor

>
> Currently the Property.setValue(InputStream) - actually all methods setting a property value from an InputStream - method closes the stream when it has completely been read. While this might be a nice-to-have in some situations, it is IMHO not standard behaviour for stream consumers to close the stream when done.
> My special use case is unpacking the contents of a ZIP file (ZIPInputStream). After streaming the contents of the first ZIP file entry into a property, the ZIPInputStream is closed by Jackrabbit and the rest of the file cannot be read.
> Workaround: Instead of giving the original InputStream to the method, create a FileInputStream wrapper overwriting the close method to do nothing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (JCR-293) Property.setValue(InputStream) closes stream

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-293?page=all ]
     
Stefan Guggisberg closed JCR-293:
---------------------------------

    Fix Version: 1.0
     Resolution: Fixed

fixed in svn r357013

> Property.setValue(InputStream) closes stream
> --------------------------------------------
>
>          Key: JCR-293
>          URL: http://issues.apache.org/jira/browse/JCR-293
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>  Environment: SVN Rev. 356803
>     Reporter: Felix Meschberger
>     Assignee: Stefan Guggisberg
>     Priority: Minor
>      Fix For: 1.0

>
> Currently the Property.setValue(InputStream) - actually all methods setting a property value from an InputStream - method closes the stream when it has completely been read. While this might be a nice-to-have in some situations, it is IMHO not standard behaviour for stream consumers to close the stream when done.
> My special use case is unpacking the contents of a ZIP file (ZIPInputStream). After streaming the contents of the first ZIP file entry into a property, the ZIPInputStream is closed by Jackrabbit and the rest of the file cannot be read.
> Workaround: Instead of giving the original InputStream to the method, create a FileInputStream wrapper overwriting the close method to do nothing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira