https://bz.apache.org/bugzilla/show_bug.cgi?id=63569

--- Comment #4 from Dominik Stadler <dominik.stad...@gmx.at> ---
Information from a related discussion on the mailing list:

--------
I am using Tika to do content extraction on Visio (vsd) files,

and I am running into an ‘Unexpected RuntimeException’.

The stack trace for this is in the attached
stack-trace-withOUT-setByteArrayMaxOverride.txt file.



When I tried the suggested work around of calling
IOUtils.setByteArrayMaxOverride()
on the same file, I got the ‘Unexpected RuntimeException’ from a different part
of the code.

It appears to me that when IOUtils.setByteArrayMaxOverride() is called with
anything less than
Integer.MAX_VALUE, that calls to toByteArray() will fail in checkLength()

because the length input will be greater than BYTE_ARRAY_MAX_OVERRIDE.



Here is a snippet of the code I am using:

    private void extract(InputStream is, Path outputDir, ContentHandler h,
Metadata m , AutoDetectParser extractParser) throws SAXException,
TikaException, IOException {

        Map retVal = new HashMap();

        ParseContext c = new ParseContext();



        c.set(Parser.class, extractParser);

        EmbeddedDocumentExtractor ex = new
MY_EmbeddedDocumentExtractor(outputDir, c);

        c.set(EmbeddedDocumentExtractor.class, ex);



        // Override the POI maximum length for all record types

        // IOUtils.setByteArrayMaxOverride(100 * 1024 * 1024);

        // IOUtils.setByteArrayMaxOverride(30 * 1024 * 1024);

        extractParser.parse(is, h, m, c);



        // Reset/disable the override

        // IOUtils.setByteArrayMaxOverride(-1);

    }



As you can see from the commented out IOUtils.setByteArrayMaxOverride() calls,

I tried this with both 100 MB, and 30 MB.

A second stack trace for the secondary error (with
IOUtils.setByteArrayMaxOverride() being called)
is attached in stack-trace-with-setByteArrayMaxOverride.txt.



In each stack trace I have snipped out the calls to my code.
----------

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to