You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ahmed Elshereay <AE...@idc.com> on 2010/06/29 12:55:05 UTC

IOException when setting a Binary property

Hi All,

I am facing a strange problem when saving a file to jackrabbit!
I am passing a FileInputStream object to createBinary method of 
ValueFactory as following:

session.getValueFactory().createBinary(inputStream);

I get the following exception: 

java.io.IOException: Read error
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:199)
        at 
org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(
InternalValue.java:594)
        at org.apache.jackrabbit.core.value.InternalValue.createTemporary(
InternalValue.java:341)
        at org.apache.jackrabbit.core.value.InternalValueFactory.create(
InternalValueFactory.java:92)
        at org.apache.jackrabbit.core.value.ValueFactoryImpl.createBinary(
ValueFactoryImpl.java:74)
....

1. I checked if the given inputeStream is null, and it's not null!
2. I thought maybe the stream is already closed before to createBinary(), 
so I commented out the line where I close the stream, didn't help!
3. I called inputStream.available() before calling createBinary(), then I 
got the following error before the previous one:

12:34:03,150 INFO  [STDOUT] inputStream: java.io.FileInputStream@18288d2
12:34:03,150 ERROR [STDERR] java.io.IOException: The handle is invalid
12:34:03,166 ERROR [STDERR]     at java.io.FileInputStream.available(
Native Method)
....

What is really strange is that everything used to work fine before, don't 
know what happened to get that exception!!
I running JBoss 5.1.0, Spring 3.0.2.RELEASE, and jackrabbit 2.1.0.

Please, can anyone help me to solve this problem?

Thank you in advance. 

Re: IOException when setting a Binary property

Posted by Ahmed Elshereay <AE...@idc.com>.
Hey everybody,

I found out the problem, I was using the stream before to createBinary 
from it.
Anyway everything is working fine now. Thanks

Re: IOException when setting a Binary property

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Jun 29, 2010 at 12:55, Ahmed Elshereay <AE...@idc.com> wrote:
>
> java.io.IOException: Read error
>        at java.io.FileInputStream.readBytes(Native Method)
> ..
> 12:34:03,150 ERROR [STDERR] java.io.IOException: The handle is invalid

Hmm, looks like some file-system level issue.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com