commons-cli bug一粒

阅读更多
commons-cli 1.2里关于OptionGroup有一个bug

上代码
list [-t file type| -n file name]
OptionGroup optionGroup = new OptionGroup();
optionGroup.addOption(new Option("t", "type", true, "file type"));
optionGroup.addOption(new Option("n", "name", true, "file name"));


比如第一次解析了list -t以后
第二次解析list -n就会报AlreadySelectedException错,说
The option 'n' was specified but an option from this group has already been selected: 't'

跟踪了半天代码,然后查了官网jira issue,发现这个是1.2版的一个issue,然后再1.3-SNAPSHOT版里解决了。 :-(

https://issues.apache.org/jira/browse/CLI-183

你可能感兴趣的:(commons-cli bug一粒)