False Positives
Contents
What are False Positives
Globalyzer scans the source code to detect candidate issues based on rules. Given some code, a rule may detect a candidate issue. In one context, that candidate issue may need to be corrected when in another context, the same issue may not need any work and is a false positive.
Let's look at a couple of lines of Java code which creates a date string based on a hard coded date format using SimpleDateFormat
:
SimpleDateFormat formatter =new SimpleDateFormat("MM/dd/yy");
String dateString = formatter.format(new Date());
Using the default Java rule sets, this code will raise i18n issues. If the dateString
variable is user facing, this code is indeed an issue to be fixed (for more information, check your rule set help pages).
However, if the dateString
variable is used for internal purposes, or a log file for support, it should not be modified and is a false positive.
This section describes different ways to handle rule sets.