Daniel Stieglitz created NIFI-16073:
---------------------------------------

             Summary: Apply Pattern variable other places in the code base and 
make prexisting pattern variables final
                 Key: NIFI-16073
                 URL: https://issues.apache.org/jira/browse/NIFI-16073
             Project: Apache NiFi
          Issue Type: Improvement
            Reporter: Daniel Stieglitz
            Assignee: Daniel Stieglitz


This ticket picks up where tickets NIFI-16041 and NIFI-16052 left off in that 
it aims to implement the pattern variable in other places of the code and make 
preexisting ones final. 

In many cases, the use of the pattern variable cleans up a lot of duplicate 
casts for example in 
nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/util/OutputStreamWritable
 .java the following snippet is before the pattern variable:

 
{code:java}
if (in instanceof DataInputBuffer) {
            byte[] bytes = ((DataInputBuffer) in).getData();
            int pos = ((DataInputBuffer) in).getPosition();
            int length = ((DataInputBuffer) in).getLength();
            int bytesRemaining = length - pos;{code}
 

and after the use of the pattern variable

 
{code:java}
if (in instanceof final DataInputBuffer dataInputBuffer) {
            byte[] bytes = dataInputBuffer.getData();
            int pos = dataInputBuffer.getPosition();
            int length = dataInputBuffer.getLength();{code}
 

 



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

Reply via email to