rspec/rules/S2447/java/rule.adoc
jtingsanchali 96d9ddb930
RULEAPI-755 Update CWE URLs by removing .html suffix and update with https protocol (#926)
* Change affects only see.adoc and rule.adoc files, not comments-and-links.adoc files
2022-04-07 08:53:59 -05:00

29 lines
771 B
Plaintext

While ``++null++`` is technically a valid ``++Boolean++`` value, that fact, and the distinction between ``++Boolean++`` and ``++boolean++`` is easy to forget. So returning ``++null++`` from a ``++Boolean++`` method is likely to cause problems with callers' code.
== Noncompliant Code Example
[source,java]
----
public Boolean isUsable() {
// ...
return null; // Noncompliant
}
----
== See
* https://cwe.mitre.org/data/definitions/476[MITRE, CWE-476] - NULL Pointer Dereference
* https://wiki.sei.cmu.edu/confluence/x/aDdGBQ[CERT, EXP01-J.] - Do not use a null in a case where an object is required
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
endif::env-github,rspecator-view[]