You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "William Rey (JIRA)" <ji...@apache.org> on 2019/08/09 20:50:00 UTC
[jira] [Created] (VFS-724) FileContentt#getByteArray() throw
Exception
William Rey created VFS-724:
-------------------------------
Summary: 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
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)