Versions Compared

Key

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

...

This compliant solution handles a FileNotFoundException by requesting that the user specify another file name:

Code Block
bgColor#ccccff
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
Include Page
CodeSonar_V
CodeSonar_V
FB.BAD_PRACTICE.DE_MIGHT_IGNORE

JAVA.STRUCT.EXCP.EEH

Empty Exception Handler (Java)

Method might ignore exception

Coverity7.5MISSING_THROWImplemented
Parasoft Jtest
Include Page
Parasoft_V
Parasoft_V
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

Include Page
PVS-Studio_V
PVS-Studio_V

V5301Implemented
SonarQube
Include Page
SonarQube_V
SonarQube_V
S1166Exception handlers should preserve the original exceptions

...