Issue with AbstractMessageSource class for methods getMessage in Spring 5

We have recently upgraded spring version from 4.1.9 to 5.2.12 and we received below bug in sonar report.

Null passed for non-null parameter of, Object, Locale)

We are only passing third parameter as null and as per method signature, second parameter can be null so why it’s reporting an error for Locale?

Method Signature in spring 5: getMessage(String code, @Nullable Object args, Locale locale)
Method call description: getMessageSource().getMessage(“current.state”, null, null);

Is this false positive or expected behavior from Spring 5?


Welcome to the community!

You’ve tagged this thread with both SonarQube and SonarLint. In which one do you see the error, and can you provide version (and flavor) details?


Hi Ann,

Thanks for your quick reply.

We saw this error on sonarqube, tags are updated. Version 6.7.2.


Thanks for updating the tags and providing your SonarQube version.

Your version is way past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

6.7.2 → 7.9.6 → 8.9.2 → 9.1 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

Once you’ve upgraded you’ll find the rules have been upgraded as well. It’s quite possibly this error will disappear. If it does not, please come back to us. And good luck on your upgrade journey.