Versions Compared

Key

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

...

Exception

Reason

NoSuchFileException

File does not exist

DirectoryNotEmptyException

File is a directory and could not otherwise be deleted because the directory is not empty

IOException

An I/O error occurs

SecurityException

In the case of the default provider, and a security manager is installed, the SecurityManager.checkDelete(String) method is invoked to check delete access to the file

Since SecurityException is a runtime exception, it need not be declared. And NoSuchFileException and DirectoryNotExmptyException both inherit from IOException, they will be caught by the compliant solution's catch clause.

Risk Assessment

Failure to check the return values of methods that perform file I/O can result in unexpected behavior.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0e7839ac241f7ad0-7393681e-42f642a6-a0998016-9d5ed515fcbd055a317c7cc7"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

File.delete()

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ad240c5bae84009f-763f4078-412142fb-bcd2862f-aed1fd9af26d5beb08c0797f"><ac:plain-text-body><![CDATA[

[[J2SE 2011

AA. Bibliography#J2SE 11]]

Files.delete()

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6bfc8bc799a6b2eb-68e2f621-43f64170-b35081fd-d965bc72f58fd711c31a49a6"><ac:plain-text-body><![CDATA[

[[Seacord 2005

AA. Bibliography#Seacord 05]]

Chapter 7, "File I/O"

]]></ac:plain-text-body></ac:structured-macro>

...