Skip to content

Commit 8c14cb4

Browse files
committed
[CLI-234] Fixed javadoc example of Option.Builder.valueSeparator(char). Thanks to Greg Thomas.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1544827 13f79535-47bb-0310-9956-ffa450edef68
1 parent b1ffe27 commit 8c14cb4

4 files changed

Lines changed: 25 additions & 6 deletions

File tree

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ NEW FEATURES:
3636

3737
BUG FIXES:
3838

39+
* Fixed code example in javadoc of "Option#Builder#valueSeparator(char)". Thanks to Greg Thomas. (CLI-234)
40+
3941
* Clarified behavior of "OptionValidator#validateOption(String)" in case of null input. Thanks to Beluga Behr. (CLI-241)
4042

4143
* Default options will now work correctly with required options that are missing. (CLI-202)

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,17 @@
8585
<email>ebourg@apache.org</email>
8686
<organization>Ariane Software</organization>
8787
</developer>
88+
<developer>
89+
<name>Thomas Neidhart</name>
90+
<id>tn</id>
91+
<email>tn@apache.org</email>
92+
</developer>
8893
</developers>
8994

9095
<contributors>
96+
<contributor>
97+
<name>Beluga Behr</name>
98+
</contributor>
9199
<contributor>
92100
<name>Peter Donald</name>
93101
<roles>
@@ -133,6 +141,9 @@
133141
<role>lots of fixes for 1.1</role>
134142
</roles>
135143
</contributor>
144+
<contributor>
145+
<name>Greg Thomas</name>
146+
</contributor>
136147
<contributor>
137148
<name>Slawek Zachcial</name>
138149
<roles>

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<body>
2424

2525
<release version="1.3" date="in SVN" description="This is a maintenance release containing bug fixes.">
26+
<action type="fix" dev="tn" issue="CLI-234" due-to="Greg Thomas">
27+
Fixed code example in javadoc of "Option#Builder#valueSeparator(char)".
28+
</action>
2629
<action type="fix" dev="tn" issue="CLI-241" due-to="Beluga Behr">
2730
Clarified behavior of "OptionValidator#validateOption(String)" in case of null input.
2831
</action>

src/main/java/org/apache/commons/cli/Option.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -933,13 +933,16 @@ public Builder valueSeparator()
933933
* <p>
934934
* <b>Example:</b>
935935
* <pre>
936-
* Option opt = Option.builder("D").valueSeparator('=')
936+
* Option opt = Option.builder("D").hasArgs()
937+
* .valueSeparator('=')
937938
* .build();
938-
*
939-
* String args = "-Dkey=value";
940-
* CommandLine line = parser.parse(args);
941-
* String propertyName = opt.getValue(0); // will be "key"
942-
* String propertyValue = opt.getValue(1); // will be "value"
939+
* Options options = new Options();
940+
* options.addOption(opt);
941+
* String[] args = {"-Dkey=value"};
942+
* CommandLineParser parser = new DefaultParser();
943+
* CommandLine line = parser.parse(options, args);
944+
* String propertyName = line.getOptionValues("D")[0]; // will be "key"
945+
* String propertyValue = line.getOptionValues("D")[1]; // will be "value"
943946
* </pre>
944947
*
945948
* @param sep The value separator.

0 commit comments

Comments
 (0)