You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Sascha Rodekamp (JIRA)" <ji...@apache.org> on 2011/05/03 11:25:03 UTC
[jira] [Created] (TIKA-653) Can't detected MimeType from
FileInputStream
Can't detected MimeType from FileInputStream
--------------------------------------------
Key: TIKA-653
URL: https://issues.apache.org/jira/browse/TIKA-653
Project: Tika
Issue Type: Bug
Affects Versions: 0.9
Reporter: Sascha Rodekamp
Hi,
i have a problem with the detection of the mime type from an file input stream.
It always throws an IO Exception. I tried to wrap the FileInputStream in a BufferedInputStream because the BIS but it doesn't help. Here the Stack Trace:
{code}
Exception: java.io.IOException
Message: Read error
---- stack trace ---------------------------------------------------------------
java.io.IOException: Read error
java.io.FileInputStream.readBytes(Native Method)
java.io.FileInputStream.read(FileInputStream.java:199)
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
java.io.BufferedInputStream.read(BufferedInputStream.java:317)
java.io.FilterInputStream.read(FilterInputStream.java:90)
org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
org.apache.tika.Tika.detect(Tika.java:132)
org.apache.tika.Tika.detect(Tika.java:155)
{code}
It works great with a ByteArrayInputStream.
MyCode to get the MimeType from the InputStream is:
{code}
if (!is.markSupported()) {
is = new BufferedInputStream(is);
}
Tika tika = new Tika();
try {
return tika.detect(is);
}
.....
{code}
Is this a bug in the library or my fault?
any help would be great:)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (TIKA-653) Can't detected MimeType from
FileInputStream
Posted by "Sascha Rodekamp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028195#comment-13028195 ]
Sascha Rodekamp commented on TIKA-653:
--------------------------------------
Hm, hi Nick,
i got the same error when using the TikaInputStream
{code}
Exception: java.io.IOException
Message: Read error
---- stack trace ---------------------------------------------------------------
java.io.IOException: Read error
java.io.FileInputStream.readBytes(Native Method)
java.io.FileInputStream.read(FileInputStream.java:199)
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
java.io.BufferedInputStream.read(BufferedInputStream.java:317)
org.apache.tika.io.ProxyInputStream.read(ProxyInputStream.java:99)
org.apache.tika.io.TikaInputStream.read(TikaInputStream.java:481)
org.apache.tika.io.TikaInputStream.read(TikaInputStream.java:487)
org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
org.apache.tika.Tika.detect(Tika.java:132)
org.apache.tika.Tika.detect(Tika.java:155)
{code}
> Can't detected MimeType from FileInputStream
> --------------------------------------------
>
> Key: TIKA-653
> URL: https://issues.apache.org/jira/browse/TIKA-653
> Project: Tika
> Issue Type: Bug
> Affects Versions: 0.9
> Reporter: Sascha Rodekamp
>
> Hi,
> i have a problem with the detection of the mime type from an file input stream.
> It always throws an IO Exception. I tried to wrap the FileInputStream in a BufferedInputStream because the BIS but it doesn't help. Here the Stack Trace:
> {code}
> Exception: java.io.IOException
> Message: Read error
> ---- stack trace ---------------------------------------------------------------
> java.io.IOException: Read error
> java.io.FileInputStream.readBytes(Native Method)
> java.io.FileInputStream.read(FileInputStream.java:199)
> java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> java.io.FilterInputStream.read(FilterInputStream.java:90)
> org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
> org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
> org.apache.tika.Tika.detect(Tika.java:132)
> org.apache.tika.Tika.detect(Tika.java:155)
> {code}
> It works great with a ByteArrayInputStream.
> MyCode to get the MimeType from the InputStream is:
> {code}
> if (!is.markSupported()) {
> is = new BufferedInputStream(is);
> }
> Tika tika = new Tika();
> try {
> return tika.detect(is);
> }
> .....
> {code}
> Is this a bug in the library or my fault?
> any help would be great:)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (TIKA-653) Can't detected MimeType from
FileInputStream
Posted by "Nick Burch (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028143#comment-13028143 ]
Nick Burch commented on TIKA-653:
---------------------------------
If you have a File object, then using a TikaInputStream might well be a better bet for you
However, the exception you're getting does look like a problem with the file/os, rather than Tika...
> Can't detected MimeType from FileInputStream
> --------------------------------------------
>
> Key: TIKA-653
> URL: https://issues.apache.org/jira/browse/TIKA-653
> Project: Tika
> Issue Type: Bug
> Affects Versions: 0.9
> Reporter: Sascha Rodekamp
>
> Hi,
> i have a problem with the detection of the mime type from an file input stream.
> It always throws an IO Exception. I tried to wrap the FileInputStream in a BufferedInputStream because the BIS but it doesn't help. Here the Stack Trace:
> {code}
> Exception: java.io.IOException
> Message: Read error
> ---- stack trace ---------------------------------------------------------------
> java.io.IOException: Read error
> java.io.FileInputStream.readBytes(Native Method)
> java.io.FileInputStream.read(FileInputStream.java:199)
> java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> java.io.FilterInputStream.read(FilterInputStream.java:90)
> org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
> org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
> org.apache.tika.Tika.detect(Tika.java:132)
> org.apache.tika.Tika.detect(Tika.java:155)
> {code}
> It works great with a ByteArrayInputStream.
> MyCode to get the MimeType from the InputStream is:
> {code}
> if (!is.markSupported()) {
> is = new BufferedInputStream(is);
> }
> Tika tika = new Tika();
> try {
> return tika.detect(is);
> }
> .....
> {code}
> Is this a bug in the library or my fault?
> any help would be great:)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (TIKA-653) Can't detected MimeType from
FileInputStream
Posted by "Ken Krugler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028223#comment-13028223 ]
Ken Krugler commented on TIKA-653:
----------------------------------
Hi Sascha,
One side comment - it's usually best to post questions about possible bugs to the list first. Then, if the result of investigation indicates a bug, you can file an issue in Jira.
E.g. for this particular problem, I imagine the next step would be for you to provide the file so others could try to process it on their machines. This would rule out a problem with your particular environment.
Regards,
-- Ken
> Can't detected MimeType from FileInputStream
> --------------------------------------------
>
> Key: TIKA-653
> URL: https://issues.apache.org/jira/browse/TIKA-653
> Project: Tika
> Issue Type: Bug
> Affects Versions: 0.9
> Reporter: Sascha Rodekamp
>
> Hi,
> i have a problem with the detection of the mime type from an file input stream.
> It always throws an IO Exception. I tried to wrap the FileInputStream in a BufferedInputStream because the BIS but it doesn't help. Here the Stack Trace:
> {code}
> Exception: java.io.IOException
> Message: Read error
> ---- stack trace ---------------------------------------------------------------
> java.io.IOException: Read error
> java.io.FileInputStream.readBytes(Native Method)
> java.io.FileInputStream.read(FileInputStream.java:199)
> java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> java.io.FilterInputStream.read(FilterInputStream.java:90)
> org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
> org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
> org.apache.tika.Tika.detect(Tika.java:132)
> org.apache.tika.Tika.detect(Tika.java:155)
> {code}
> It works great with a ByteArrayInputStream.
> MyCode to get the MimeType from the InputStream is:
> {code}
> if (!is.markSupported()) {
> is = new BufferedInputStream(is);
> }
> Tika tika = new Tika();
> try {
> return tika.detect(is);
> }
> .....
> {code}
> Is this a bug in the library or my fault?
> any help would be great:)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (TIKA-653) Can't detected MimeType from
FileInputStream
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TIKA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting resolved TIKA-653.
--------------------------------
Resolution: Cannot Reproduce
Assignee: Jukka Zitting
I can't reproduce this. Can you create a simple JUnit test case that shows this problem?
> Can't detected MimeType from FileInputStream
> --------------------------------------------
>
> Key: TIKA-653
> URL: https://issues.apache.org/jira/browse/TIKA-653
> Project: Tika
> Issue Type: Bug
> Affects Versions: 0.9
> Reporter: Sascha Rodekamp
> Assignee: Jukka Zitting
>
> Hi,
> i have a problem with the detection of the mime type from an file input stream.
> It always throws an IO Exception. I tried to wrap the FileInputStream in a BufferedInputStream because the BIS but it doesn't help. Here the Stack Trace:
> {code}
> Exception: java.io.IOException
> Message: Read error
> ---- stack trace ---------------------------------------------------------------
> java.io.IOException: Read error
> java.io.FileInputStream.readBytes(Native Method)
> java.io.FileInputStream.read(FileInputStream.java:199)
> java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> java.io.FilterInputStream.read(FilterInputStream.java:90)
> org.apache.tika.mime.MimeTypes.readMagicHeader(MimeTypes.java:300)
> org.apache.tika.mime.MimeTypes.detect(MimeTypes.java:535)
> org.apache.tika.Tika.detect(Tika.java:132)
> org.apache.tika.Tika.detect(Tika.java:155)
> {code}
> It works great with a ByteArrayInputStream.
> MyCode to get the MimeType from the InputStream is:
> {code}
> if (!is.markSupported()) {
> is = new BufferedInputStream(is);
> }
> Tika tika = new Tika();
> try {
> return tika.detect(is);
> }
> .....
> {code}
> Is this a bug in the library or my fault?
> any help would be great:)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira