- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I assume Files.deleteIfExists(filePath) returns true, false or FileNotFound
btw, frist.
Admin
Comments.deleteThisIfFristExists();
Admin
This made me chuckle way more than the code and article itself! Take a bow :)
Edit Admin
There should be a try/catch at the end of this block that checks for the file and throws a "File Not Deleted" exception which, of course, needs to be captured and swallowed with no log entry, no UI message, and no action taken.
Or, maybe the "File Not Deleted" exception should create the file and then re-run the delete. Y'know - to make sure it really gets deleted!
Edit Admin
"Or, maybe the "File Not Deleted" exception should create the file and then re-run the delete. Y'know - to make sure it really gets deleted!" The file equivalent to an "Upsert?"