False positive issue for Java rule (squid:S4248)

There are a false positive issue reported for java rule squid:S4248 in case of used constant. See the example below.

  • text.split(" "); //nothing reported

  • text.split(CONSTANT); //issue reported

1 Like

hello @Tomas_Lestyan,

while I understand that this is FP strictly speaking, however wouldn’t you agree that it makes sense to create a static instance of java.util.regex.Pattern and use Pattern.split method instead?

1 Like

Hi Tomáš,
I have created a ticket SONARJAVA-3276 to improve the rule S4248.
Thanks for the feedback!

1 Like