[
https://issues.apache.org/jira/browse/NIFI-16073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Stieglitz updated NIFI-16073:
------------------------------------
Description:
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}
Another example is
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/RepositoryContextFactory.java
Before
was:
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}
> Apply Pattern variable in other places in the code base and make preexisting
> 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
> Priority: Minor
>
> 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}
>
> Another example is
> nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/RepositoryContextFactory.java
> Before
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)