1

I have a weird issue regarding buffering inputStream of pdf and odt files. They are not so big, just 5 - 15 pages, but it always ends up like this

java.io.IOException: Stream closed
    at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:134)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
    at java.io.FilterInputStream.read(FilterInputStream.java:90)

You can see the source code here. I'm asking here, because it doesn't seem to be Apache Tika issue, but rather JVM issue.

EDITED: Sorry guys for such a stupid question, it was 4am :-) The problem was that 4 from 5 tests failed so I anticipated that classloader found those resources, but it didn't. There was a typo "file / files" ... Stil don't understand why one of them passed

2 Answers 2

2

Sorry to ask an obvious question, but are the resource files that you're trying to load accessible in the test's classpath?

String resourceLocation = "file/Designandrealizationofanintranetportal.pdf";
Sign up to request clarification or add additional context in comments.

Comments

2

It is highly unlikely to be a JVM / Java class library problem. It will either be your testcase or Tika that is at fault.

The exception occurs when something tries to read from a Stream that has already been closed. And the standard stream classes don't close themselves spontaneously.


If I was going to figure out what the real problem was, I'd run one of the testcases using a debugger, set a breakpoint on the BufferedInputStream.close() method, and try to figure out where, and why it was being called.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.