Versions Compared

Key

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

...

Code Block
bgColor#ccccff
boolean volatile validFlag = false;
do {
  try {
    // If requested file does not exist, throws FileNotFoundException
    // If requested file exists, sets a Boolean flag validFlag to true
    validFlag = true; 
  } catch (FileNotFoundException e) { 
    // Ask the user for a different file name 
  }
} while (validFlag != true);
// Use the file

The In order to comply with ERR06-J. Do not allow exceptions to expose sensitive information, the user is only allowed to access only files in a user-specific directory. This prevents any other IOException that escapes the loop from leaking potentially sensitive file system information. See guideline ERR06-J. Do not allow exceptions to expose sensitive information for additional information.

Compliant Solution (Skeletal Implementation of Exception Reporter)

...