[ https://issues.apache.org/jira/browse/VFS-724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904178#comment-16904178 ]
Gary Gregory commented on VFS-724: ---------------------------------- Size 0 sounds legal to me since it represents an empty file. Otherwise a negative size seems bogus. We welcome PRs on GitHub; -) > FileContentt#getByteArray() throw Exception > ------------------------------------------- > > Key: VFS-724 > URL: https://issues.apache.org/jira/browse/VFS-724 > Project: Commons VFS > Issue Type: Bug > Affects Versions: 2.4 > Reporter: William Rey > Priority: Major > > The current code only checks for a size bigger than 2MB but ignores when the > returned size is 0 or negative. {{sizeL}} will be typically equals to zero if > the request is made to a WebServer and the response generated live (like > PHP). Then the {{getInputStream(size)}} will fail in this case when the size > is really used by the implementation. > {code} > default byte[] getByteArray() throws IOException { > final long sizeL = getSize(); > if (sizeL > Integer.MAX_VALUE) { > throw new IllegalStateException(String.format("File content is > too large for a byte array: %,d", sizeL)); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.14#76016)