...
This compliant solution handles a FileNotFoundException
by requesting that the user specify another file name:
Code Block | ||
---|---|---|
| ||
volatile boolean validFlag = false; do { try { // ... // If requested file does not exist, throws FileNotFoundException // If requested file exists, sets validFlag to true validFlag = true; } catch (FileNotFoundException e) { // Ask the user for a different file name } } while (validFlag != true); // Use the file |
...
Tool | Version | Checker | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| FB.BAD_PRACTICE.DE_MIGHT_IGNORE | JAVA.STRUCT.EXCP.EEH | Empty Exception Handler (Java) Method might ignore exception | ||||||
Coverity | 7.5 | MISSING_THROW | Implemented | |||||||
Parasoft Jtest |
| SECURITYCERT.UEHLERR00.LGE, UC.UCATCH CERT.ERR00.UCATCH | Ensure all exceptions are either logged with a standard logger or rethrown Use a caught exception in the "catch" block | |||||||
PVS-Studio |
| V5301Implemented | ||||||||
SonarQube |
| S1166 | Exception handlers should preserve the original exceptions |
...