static private void validateDirectory ( File aDirectory ) throws FileNotFoundException { if ( aDirectory == null ) { throw new IllegalArgumentException ( "Directory should not be null." ) ; } if ( ! aDirectory . exists ( ) ) { throw new FileNotFoundException ( "Directory does not exist: " + aDirectory ) ; } if ( ! aDirectory . isDirectory ( ) ) { throw new IllegalArgumentException ( "Is not a directory: " + aDirectory ) ; } if ( ! aDirectory . canRead ( ) ) { throw new IllegalArgumentException ( "Directory cannot be read: " + aDirectory ) ; } }
Directory is valid if it exists does not represent a file and can be read .