You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Alex Parvulescu <al...@gmail.com> on 2011/02/23 15:04:24 UTC

Session.importXml should close the input stream?

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?



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

Re: Session.importXml should close the input stream?

Posted by Alex Parvulescu <al...@gmail.com>.
ok, done :)

https://issues.apache.org/jira/browse/JCR-2903

<https://issues.apache.org/jira/browse/JCR-2903>thanks,
alex

On Thu, Feb 24, 2011 at 3:40 PM, Stefan Guggisberg <
stefan.guggisberg@gmail.com> wrote:

> On Wed, Feb 23, 2011 at 3:04 PM, Alex Parvulescu
> <al...@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)
> >
>

Re: Session.importXml should close the input stream?

Posted by Stefan Guggisberg <st...@gmail.com>.
On Wed, Feb 23, 2011 at 3:04 PM, Alex Parvulescu
<al...@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)
>