...
Failure to perform necessary cleanup at program termination may leave the system in an inconsistent state.
Rule | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
FIO14-J | Medium | Likely | No |
No |
P6 |
L2 |
Automated Detection
| Tool | Version | Checker | Description |
|---|---|---|---|
| Parasoft Jtest |
| CERT.FIO14.CIO CERT.FIO14.CCR CERT.FIO14.CRWD | Close input and output resources in "finally" blocks Close all "java.io.Closeable" resources in a "finally" block Close resources as early as possible |
Related Guidelines
| ISO/IEC TR 24772:2010 | Termination Strategy [REU] |
CWE-705, Incorrect Control Flow Scoping |
Android Implementation Details
Although most of the code examples are not applicable to the Android platform, the principle is applicable to Android. Aprocess on Android can be terminated in a number of ways: android.app.Activity.finish() and the related finish() methods, android.app.Activity.moveTaskToBack(boolean flag), android.os.Process.killProcess(int pid), and System.exit().
Bibliography
[API 2014] | |
Section 6.46, "Termination Strategy [REU]" |
...
...