[ https://issues.apache.org/jira/browse/VFS-724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904203#comment-16904203 ]
William Rey commented on VFS-724: --------------------------------- PR#68 (https://github.com/apache/commons-vfs/pull/68) submitted. > 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 > Time Spent: 10m > Remaining Estimate: 0h > > 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)