commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLI-274) Option parser type EXISTING_FILE_VALUE not check file existing
Date Mon, 17 Apr 2017 12:05:41 GMT

    [ https://issues.apache.org/jira/browse/CLI-274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15971008#comment-15971008
] 

ASF GitHub Bot commented on CLI-274:
------------------------------------

GitHub user schaumb opened a pull request:

    https://github.com/apache/commons-cli/pull/10

    [CLI-274] implement EXISTING_FILE_VALUE type handler

    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.
    Before this there was no check whether the file exist.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/schaumb/commons-cli patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-cli/pull/10.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10
    
----
commit abfcc8211f529ab75f3b3edd4a827e484109eb0b
Author: Bela Schaum <schaumb@users.noreply.github.com>
Date:   2017-04-17T11:45:09Z

    implement EXISTING_FILE_VALUE type handler
    
    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.
    Before this there was no check whether the file exist.

----


> 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
>            Priority: Minor
>
> 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.3.15#6346)

Mime
View raw message