[ 
https://issues.apache.org/jira/browse/NIFI-16142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Stieglitz updated NIFI-16142:
------------------------------------
    Description: 
In a handful of places a long is read from a byte array using bit-wise 
operators assuming BigEndian, which is hard to read. In addition there are some 
unnecessary casts when using this method. Although  all casts were kept in PR 
#[11440|[https://github.com/apache/nifi/pull/11440]] that was only for 
consistency so one wouldn't have to wonder why some lines of casts and others 
do not, but ideally unnecessary ones should not be included. 

There are other alternative using the the Java API e.g. java.nio.ByteBuffer 
(which uses by default BigEndian) or java.lang.invoke.VarHandle.

This ticket aims to replace the bit-wise operators approach with the use of one 
of the Java alternatives.

  was:
In a handful of places a long is read from a byte array using bit-wise 
operators which is hard to read. In addition there are some unnecessary casts 
when using this method. Although  all casts were kept in PR 
#[11440|[https://github.com/apache/nifi/pull/11440]] that was only for 
consistency so one wouldn't have to wonder why some lines of casts and others 
do not, but ideally unnecessary ones should not be included. 

There are other alternative using the the Java API e.g. java.nio.ByteBuffer or 
java.lang.invoke.VarHandle.

This ticket aims to replace the bit-wise operators approach with the use of one 
of the Java alternatives.


> Replace the use of bitwise operators to read a long from a byte array with 
> ByteBuffer
> -------------------------------------------------------------------------------------
>
>                 Key: NIFI-16142
>                 URL: https://issues.apache.org/jira/browse/NIFI-16142
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Daniel Stieglitz
>            Assignee: Daniel Stieglitz
>            Priority: Minor
>
> In a handful of places a long is read from a byte array using bit-wise 
> operators assuming BigEndian, which is hard to read. In addition there are 
> some unnecessary casts when using this method. Although  all casts were kept 
> in PR #[11440|[https://github.com/apache/nifi/pull/11440]] that was only for 
> consistency so one wouldn't have to wonder why some lines of casts and others 
> do not, but ideally unnecessary ones should not be included. 
> There are other alternative using the the Java API e.g. java.nio.ByteBuffer 
> (which uses by default BigEndian) or java.lang.invoke.VarHandle.
> This ticket aims to replace the bit-wise operators approach with the use of 
> one of the Java alternatives.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to