jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: Pulling binary data from a property
Date Thu, 12 Oct 2006 10:52:48 GMT
hi shane,

On 10/11/06, Shane Preater <shane.preater@googlemail.com> wrote:
> Hi Stefan,
> Thanks for the help. I will put further questions to the user list. Sorry
> about that.
>
> I am using the RMI implementation to aquire a repository instance so this
> maybe my problem.
>
> The repository is acquired through JNDI and then I simply acquire the
> correct node using session.getRootNode(); then node.getNode("myNode");
>
> Hopefully this will help narrow the problem down.

this is probably a bug in the RMI stream handling code. please
create a jira issue and include all relevant information.

thanks
stefan

> Shane.
>
>
> On 11/10/06, Stefan Guggisberg <stefan.guggisberg@gmail.com> wrote:
> >
> > hi shane,
> >
> > On 10/11/06, Shane Preater <shane.preater@googlemail.com> wrote:
> > > Hi,
> > >
> > > I have a property on a node called 'blobData' this property has been
> > loaded
> > > using the following snippet:
> > >
> > > ValueFactory factory = session.getValueFactory();
> > > Value value = factory.createValue(new ByteArrayInputStream(data));
> > > node.setProperty(propertyName, value);
> > >
> > > Then obviously further on a call to session.save(); is used to persist
> > this.
> > >
> > > I am now trying to get this binary information back from the property
> > using:
> > >
> > > InputStream inputStream = node.getProperty(property)
> > >                             .getStream();
> > > int readInt = 0;
> > > while ((readInt = inputStream.read()) >= 0) {
> > >   outputStream.write(readInt);
> > >  }
> > > return outputStream.toByteArray();
> > >
> > > However this always returns an empty byte array as the first call to
> > > inputStream.read() returns -1 indicating the end of the stream.
> > >
> > > Could someone point me in the direction of my error.
> >
> > your code looks fine so far. if you are directly accessing a local
> > jackrabbit
> > instance i guess the error must be in that part of the code that you
> > didn't
> > provide. if you're accessing a remote jackrabbit instance through RMI
> > there could be an issue wrt stream handling in the RMI implementation.
> >
> > in any case it would be good if you could provide a complete code sample.
> >
> > btw: the users list would be more appropriate for such questions.
> >
> > cheers
> > stefan
> >
> >
> >
> >
> > >
> > > Thanks,
> > > Shane.
> > >
> > >
> >
>
>

Mime
View raw message