commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CLI-274) Option parser type EXISTING_FILE_VALUE not check file existing
Date Wed, 14 Jun 2017 08:00:01 GMT

     [ https://issues.apache.org/jira/browse/CLI-274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benedikt Ritter resolved CLI-274.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 1.5

Merged in 0b45395.

Thank you!

> Option parser type EXISTING_FILE_VALUE not check file existing
> --------------------------------------------------------------
>
>                 Key: CLI-274
>                 URL: https://issues.apache.org/jira/browse/CLI-274
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: Parser
>            Reporter: Béla Schaum
>            Assignee: Benedikt Ritter
>            Priority: Minor
>             Fix For: 1.5
>
>
> When the user pass option type FileInputStream.class, I think the expected behavior for
the return value is the same type, which the user passed.
> Options options = new Options();
> options.addOption(Option.builder("f").hasArg().type(FileInputStream.class).build());
> CommandLine cline = new DefaultParser().parse(options, args);
> FileInputStream file = (FileInputStream) cline.getParsedOptionValue("f"); // it returns
"File" object, without check File exist.
> I attach a solution for it:
> https://github.com/schaumb/commons-cli/commit/abfcc8211f529ab75f3b3edd4a827e484109eb0b



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message