Throwing the SecurityException is fine. For both the cases where this is called, if the scanner can't read the dir a runtime exception is appropriate.