[
https://issues.apache.org/jira/browse/PIG-3988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14028094#comment-14028094
]
Rohini Palaniswamy commented on PIG-3988:
-----------------------------------------
Encountered this exception in line Option overwrite = new Option(null,
"Overwrites the destination."); in PigStorage.java while running from eclipse.
It was because commons-cli-1.0.jar was in my classpath. Passes while running
TestPigStorage though as it has commons-cli-1.2.jar which was only recently
upgraded in pig.
{code}
Caused by: java.lang.IllegalArgumentException: opt is null
at org.apache.commons.cli.Option.validateOption(Option.java:159)
at org.apache.commons.cli.Option.<init>(Option.java:250)
at org.apache.commons.cli.Option.<init>(Option.java:222)
at
org.apache.pig.builtin.PigStorage.populateValidOptions(PigStorage.java:167)
{code}
What is the reason behind changing
{code}
Option overwrite =
OptionBuilder.hasOptionalArgs(1).withArgName("overwrite").withLongOpt("overwrite").withDescription("Overwrites
the destination.").create();
{code}
to
{code}
Option overwrite = new Option(null, "Overwrites the destination.");
overwrite.setLongOpt("overwrite");
overwrite.setOptionalArg(true);
overwrite.setArgs(1);
overwrite.setArgName("overwrite");
{code}
I don't see a difference. We should revert back so that it is backward
compatible with commons-cli-1.0.jar as well
> PigStorage: CommandLineParser is not thread safe
> ------------------------------------------------
>
> Key: PIG-3988
> URL: https://issues.apache.org/jira/browse/PIG-3988
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.13.0
> Reporter: Travis Woodruff
> Assignee: Travis Woodruff
> Priority: Minor
> Fix For: 0.14.0
>
> Attachments: PIG-3988-1.patch
>
>
> PigStorage uses commons-cli to parse options. The CommandLineParser is stored
> as a static member. This can cause issues when two threads instantiate
> PigStorage at the same time, since CommandLineParser stores state in a
> non-thread-safe way.
> OptionBuilder, used in populateValidOptions(), is also not thread safe, as it
> stores its state in static members.
--
This message was sent by Atlassian JIRA
(v6.2#6252)