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

Pierre Villard updated NIFI-7419:
---------------------------------
    Resolution: Feedback Received
        Status: Resolved  (was: Patch Available)

Apache NiFi 1.x is no longer maintained and no new release is planned on the 
1.x release line. Marking as resolved as part of a cleanup operation. Please 
open a new one with an updated description if this is still relevant for NiFi 
2.x.

> ToStringBuilder.setDefaultStyle() is a singleton value and should not be 
> called multiple times
> ----------------------------------------------------------------------------------------------
>
>                 Key: NIFI-7419
>                 URL: https://issues.apache.org/jira/browse/NIFI-7419
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.11.4
>            Reporter: Thomas Bürli
>            Priority: Minor
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> According to the documentation of ToStringBuilder the method 
> setDefaultStyle() should only be called once since it sets a Singleton value.
> {quote}This method sets a singleton default value, typically for the whole 
> JVM. Changing this default should generally only be done during application 
> startup. It is recommended to pass a ToStringStyle to the constructor instead 
> of changing this global default.
> This method is not intended for use from multiple threads. Internally, a 
> volatile variable is used to provide the guarantee that the latest value set 
> is the value returned from getDefaultStyle().
> [API Docs 
> ToStringBuilder|https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/builder/ToStringBuilder.html#setDefaultStyle-org.apache.commons.lang3.builder.ToStringStyle-]
> {quote}
> I stumbled upon your code having it set in 4 classes
> * 
> nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/KeyDerivationFunction.java
> * 
> nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/repository/RepositoryType.java
> * 
> nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/EncryptionMethod.java
> * 
> nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/crypto/HashAlgorithm.java
> [Github Search 
> Result|https://github.com/apache/nifi/search?q=setDefaultStyle&unscoped_q=setDefaultStyle]
> This could have a side effects or performance impacts but since it's only in 
> the toString method I don't think it has an impact.



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

Reply via email to