@ Override public String parse ( String argument ) throws CommandLineException { File file = new File ( argument ) ; try { Assert . isTrue ( file . exists ( ) , "File '" + file + "' does not exist" ) ; Assert . isFalse ( file . isDirectory ( ) , "File '" + file + "' is a directory" ) ; Assert . isTrue ( file . canRead ( ) , "File '" + file + "' cannot be read" ) ; } catch ( IllegalArgumentException e ) { throw new CommandLineException ( e . getMessage ( ) ) ; } return file . getAbsolutePath ( ) ; }
Expects file that is available and readable