[ 
https://issues.apache.org/jira/browse/NIFI-14135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17911204#comment-17911204
 ] 

Daniel Stieglitz edited comment on NIFI-14135 at 1/8/25 6:52 PM:
-----------------------------------------------------------------

I discovered this rule only covers a very basic case of 
{code:java}
Charset.forName{code}
I do not see the following cases being flagged yet they are flagged in Intellij.
 # Base64.getDecoder().decode("someString"), "UTF-8")
 # URLEncoder.encode("someString", "UTF-8")
 # "someString".getBytes("UTF-8")
 # new String(someByteArray, "UTF-8")
 # intanceOfByteArrayOutputStream.toString("UTF-8")

The following issue [3212|https://github.com/pmd/pmd/issues/3212] which is 
still open is meant to address flagging constructors. I added the above 
scenarios as a comment on that issue.


was (Author: JIRAUSER294662):
I discovered this rule only covers a very basic case of 
{code:java}
Charset.forName{code}
I do not see the following cases being flagged 
 # Base64.getDecoder().decode("someString"), "UTF-8")
 # URLEncoder.encode("someString", "UTF-8")
 # "someString".getBytes("UTF-8")
 # new String(someByteArray, "UTF-8")
 # intanceOfByteArrayOutputStream.toString("UTF-8")

yet they are flagged in Intellij.

The following issue [3212|https://github.com/pmd/pmd/issues/3212] which is 
still open is meant to address flagging constructors. I added the above 
scenarios as a comment on that issue.

> Apply PMD UseStandardCharsets check across the code base
> --------------------------------------------------------
>
>                 Key: NIFI-14135
>                 URL: https://issues.apache.org/jira/browse/NIFI-14135
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Daniel Stieglitz
>            Assignee: Daniel Stieglitz
>            Priority: Minor
>




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

Reply via email to