rspec/rules/S2225/java/rule.adoc

42 lines
805 B
Plaintext
Raw Normal View History

2020-06-30 12:48:07 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
public String toString () {
if (this.collection.isEmpty()) {
return null; // Noncompliant
} else {
// ...
----
== Compliant Solution
----
public String toString () {
if (this.collection.isEmpty()) {
return "";
} else {
// ...
----
== See
2021-10-28 10:07:16 +02:00
* https://cwe.mitre.org/data/definitions/476.html[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[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]