Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This noncompliant code example attempts to delete a specified file but gives no indication of its success. The Java Platform, Standard Edition 6 API Specification [API 2006] requires File.delete() to throw a SecurityException only when the program lacks authorization to delete the file. No other exceptions are thrown, so the deletion can silently fail.

...

The Java SE 7 Documentation [J2SE 2011] defines Files.delete() to throw the following exceptions:

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

FIO02-J

Medium

Probable

Medium

P8

L2

Related Guidelines

Bibliography

[API 2006]

File.delete()

[J2SE 2011]

Files.delete()

[Seacord 2005]

Chapter 7, File I/O

 

...

      Rule 13: Input Output (FIO)Image Added