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

Koji Noguchi updated PIG-4909:
------------------------------
    Attachment: pig-4909-v01-notest.patch

This is coming from

{code:title=PigStorage.java}
174         Option overwrite = new Option(" ", "Overwrites the destination.");
{code}

Reason for passing space over null was mentioned in
https://issues.apache.org/jira/browse/PIG-3988?focusedCommentId=14028212&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14028212
"Looks like commons-cli 1.0 passes " " instead of null to the Option 
constructor in OptionBuilder."

This makes it a bit interesting such that for providing only long-option,

|| || " "(space) || null ||
| commons-cli-1.0.jar | O | X |
| commons-cli-1.1.jar | O | O |
| commons-cli-1.2.jar | O | O |
| commons-cli-1.3.1.jar | X | O |

At this point, I was stuck.  But stepping a bit back, with current source code, 
testing
\-overwrite" (short option) as well as "\--overwrite"(long option).

|| || -overwrite || --overwrite ||
| commons-cli-1.0.jar | X | O |
| commons-cli-1.1.jar | O | O |
| commons-cli-1.2.jar | O | O |

So "\-overwrite" and "\--overwrite" are both somehow supported.
If that's the case,  I think there's no harm in passing that as a param for 
short-option name.
Also reading original PIG-259, I don’t think there was any reason not to 
support short-option.

Uploading a simple patch.
Manually tested it with commons-cli-\{1.0,1.1,1.2,1.3.1\}.jar

> PigStorage incompatible with commons-cli-1.3 
> ---------------------------------------------
>
>                 Key: PIG-4909
>                 URL: https://issues.apache.org/jira/browse/PIG-4909
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>            Reporter: Koji Noguchi
>            Assignee: Koji Noguchi
>            Priority: Trivial
>         Attachments: pig-4909-v01-notest.patch
>
>
> Pig uses commons-cli-1.2.jar but when user overwrite the classpath with 
> commons-cli-1.3.jar, job failed with 
> {noformat}
> Caused by: java.lang.IllegalArgumentException: Illegal option name ' '
> at 
> org.apache.commons.cli.OptionValidator.validateOption(OptionValidator.java:60)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to