jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: Session.importXml should close the input stream?
Date Thu, 24 Feb 2011 14:40:40 GMT
On Wed, Feb 23, 2011 at 3:04 PM, Alex Parvulescu
<alex.parvulescu@gmail.com> wrote:
> Hello,
>
> I was going through the Hops examples and I noticed something that I don't
> understand in Hop 3.
> The Session.importXml api [1] says that the input stream will be closed by
> the session: "The passed InputStream is closed before this method returns
> either normally or because of an exception."
> Which does not seem to be the case for the example.
> I also looked at org.apache.jackrabbit.jcr2spi.SessionImpl which does not
> appear to close the input stream.
>
> Is there something I'm missing here? Who is in charge of closing the input
> stream in the end?

JSR 170 (-> JCR 1.0) did not specify who's responsible for closing
an InputStream instance passed to an api method.

jackrabbit < 2.0 did not close the passed streams, the api consumer
was responsible for closing the stream after the api method returned.

JSR 283 (-> JCR 2.0) finally specified that that the following methods
will close the passed InputStream before returning control to the caller:

    Node.setProperty(String, InputStream)
    Property.setValue(InputStream)
    ValueFactory.createValue(InputStream)
    ValueFactory.createBinary(InputStream)
    Session.importXML(String, InputStream, int)
    Workspace.importXML(String, InputStream, int)

jackrabbit apparently does not yet comply with the
new JCR 2.0 stream handling contract.

do you mind filing a jira issue?

thanks
stefan


>
>
>
> [1] http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#importXML(java.lang.String,
> java.io.InputStream, int)
>

Mime
View raw message