...
This noncompliant code example attempt attempts to delete a file, but does not check that the operation succeeds.
...
Code Block | ||
---|---|---|
| ||
public class Ignore {
public static void main(String[] args) {
String original = "insecure";
original.replace( 'i', '9' );
System.out.println (original);
}
}
|
Compliant Solution
...
Code Block | ||
---|---|---|
| ||
public class DoNotIgnore {
public static void main(String[] args) {
String original = "insecure";
original = original.replace( 'i', '9' );
System.out.println (original);
}
}
|
Yet another Another source of coding bugs caused by ignoring return values is detailed in FIO03-J. Keep track of bytes read and account for character encoding while reading data.
...
Ignoring method return values may lead to erroneous computation which, in turn, may lead to security risksvulnerabilities.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXP02-J | medium | probable | medium | P8 | L2 |
...