Skip to content

DocumentParser Exception on Empty Documents #91

@gdgib-roche

Description

@gdgib-roche

The while loop on DocumentParser.java:480 doesn't correctly handle 0-length input documents. It will eventually cause an java.lang.ArrayIndexOutOfBoundsException in System.arrayCopy() a few levels down due to the return value from read(...) being -1. In truth any document where documentLength % 16384 == 0 will have this problem right now.

A if (charsRead < 0) break; statement after the read on line 481 will fix this.

If you need a test case you can simply run Parser.builder().build().parseReader(new StringReader(""));

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions