You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2023/10/21 11:25:00 UTC
[jira] [Assigned] (CAMEL-19975) NIOConverter File to ByteBuffer conversion behavior is potentially non-deterministic
[ https://issues.apache.org/jira/browse/CAMEL-19975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-19975:
-----------------------------------
Assignee: Claus Ibsen
> NIOConverter File to ByteBuffer conversion behavior is potentially non-deterministic
> ------------------------------------------------------------------------------------
>
> Key: CAMEL-19975
> URL: https://issues.apache.org/jira/browse/CAMEL-19975
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: James Netherton
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.x
>
>
> Maybe a bit of an edge case, but the result of {{NIOConverter.toByteBuffer(File)}} can potentially vary depending on the size of the file used for conversion. It can be {{null}} or a {{ByteBuffer}} with partial or empty content.
> The converter does:
> {code:java}
> byte[] buf = new byte[(int) file.length()];
> {code}
> If {{file.length()}} > {{Integer.MAX_VALUE}}, then the cast from {{long}} to {{int}} can produce some unexpected results. E.g if the file size is {{Integer.MAX_VALUE + 1}}, then the result from the cast is {{-2147483648}}. If the file size is {{4294967296}} then the result from the cast is {{0}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)