class throws a LengthException then catch it and display the appropriate

Class throws a lengthexception then catch it and

This preview shows page 4 - 6 out of 6 pages.

class throws a LengthException, then catch it and display the appropriate message. catch (LengthException e){JOptionPane.showMessageDialog(null, "LengthException: The password must be at least 6 characters long.", "Password Status", JOptionPane.INFORMATION_MESSAGE);e.printStackTrace();}// If the isValidPassword method from the PasswordChecker class throws a NoDigitException, then catch it and display the appropriate message. class throws a NoUpperAlphaException, then catch it and display the appropriate message.catch (NoUpperAlphaException e){JOptionPane.showMessageDialog(null, "NoUpperAlphaException: The password must contain at least one uppercase class throws a NoLowerAlphaException, then catch it and display the appropriate message.catch (NoLowerAlphaException e){JOptionPane.showMessageDialog(null, "NoLowerAlphaException: The password must contain at least one lowercase class throws a InvalidSequenceException, then catch it and display the appropriate message. catch (InvalidSequenceException e) {JOptionPane.showMessageDialog(null, "InvalidSequenceException: The password cannot contain more than two of the same
Image of page 4
character in sequence.","Password Status", JOptionPane.INFORMATION_MESSAGE); e.printStackTrace(); } // If the If the password is OK, but between 6 and 10 characters catch (Exception e) { JOptionPane.showMessageDialog(null, "Password is OK but weak","Password Status", JOptionPane.INFORMATION_MESSAGE); e.printStackTrace(); } } } // It will check to see which passwords are invalid from the file that is read in, and also display its error status. class CheckFilePasswordsButtonEventHandler implements EventHandler<ActionEvent>{ @Override public void handle(ActionEvent event){ File selectedFile = null; Scanner inputFile; ArrayList<String> passwordList = new ArrayList<>(); // Declares a String ArrayList to hold the contents of the file being read. ArrayList<String> illegalList = new ArrayList<>(); // Declares a String ArrayList to hold all the invalid passwords from the file that was read in. // Will display a window box allowing the user to select a file from their computer to open, in order to read its list of passwords.
Image of page 5
Image of page 6

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture