Skip to content

Commit ceacf03

Browse files
committed
[cli-221] resolved merge conflict from master
1 parent b0b1985 commit ceacf03

47 files changed

Lines changed: 1705 additions & 1576 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Y
2222
Before you push a pull request, review this list:
2323

2424
- [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
25+
- [ ] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI).
26+
- [ ] I used AI to create any part of, or all of, this pull request.
2527
- [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself.
26-
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice.
28+
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best-practice.
2729
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
28-
- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge.
30+
- [ ] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
5858
# Initializes the CodeQL tools for scanning.
5959
- name: Initialize CodeQL
60-
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
60+
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
6161
with:
6262
languages: ${{ matrix.language }}
6363
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,7 +68,7 @@ jobs:
6868
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6969
# If this step fails, then you should remove it and run the build manually (see below)
7070
- name: Autobuild
71-
uses: github/codeql-action/autobuild@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
71+
uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
7272

7373
# ℹ️ Command-line programs to run using the OS shell.
7474
# 📚 https://git.io/JvXDl
@@ -82,4 +82,4 @@ jobs:
8282
# make release
8383

8484
- name: Perform CodeQL Analysis
85-
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
85+
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4

.github/workflows/scorecards-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ jobs:
6464
retention-days: 5
6565

6666
- name: "Upload to code-scanning"
67-
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # 3.29.2
67+
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # 3.29.4
6868
with:
6969
sarif_file: results.sarif

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ Making Changes
6161

6262
+ Create a _topic branch_ for your isolated work.
6363
* Usually you should base your branch from the `master` branch.
64-
* A good topic branch name can be the JIRA bug ID plus a keyword, for example, `CLI-123-InputStream`.
64+
* A good topic branch name can be the JIRA bug ID plus a keyword, e.g. `CLI-123-InputStream`.
6565
* If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
6666
+ Make commits of logical units.
6767
* Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
68-
* For example, `[CLI-123] Close input stream earlier`
68+
* For example, `[CLI-123] Close input stream sooner`
6969
+ Respect the original code style:
7070
+ Only use spaces for indentation; you can check for unnecessary whitespace with `git diff` before committing.
7171
+ Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ There are some guidelines which will make applying PRs easier for us:
9090
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
9191
+ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running `mvn`.
9292
+ Before you pushing a PR, run `mvn` (by itself), this runs the default goal, which contains all build checks.
93-
+ To see the code coverage report, regardless of coverage failures, run `mvn clean site -Dcommons.jacoco.haltOnFailure=false`
93+
+ To see the code coverage report, regardless of coverage failures, run `mvn clean site -Dcommons.jacoco.haltOnFailure=false -Pjacoco`
9494

9595
If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas).
9696
You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md).

RELEASE-NOTES.txt

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,73 @@
11
Apache Commons CLI 1.10.0 Release Notes
22
---------------------------------------
33

4+
The Apache Commons CLI team is pleased to announce the release of Apache Commons CLI 1.10.0.
5+
46
Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
57

68
This is a feature and maintenance release. Java 8 or later is required.
79

810

11+
New Features
12+
------------
13+
14+
* CLI-339: Help formatter extension in the new package #314. Thanks to Claude Warren, Gary Gregory.
15+
* CommandLine.Builder implements Supplier<CommandLine>. Thanks to Gary Gregory.
16+
* DefaultParser.Builder implements Supplier<DefaultParser>. Thanks to Gary Gregory.
17+
* CLI-340: Add CommandLine.getParsedOptionValues() #334. Thanks to Claude Warren, Gary Gregory.
18+
* CLI-333: org.apache.commons.cli.Option.Builder implements Supplier<Option>. Thanks to Claude Warren, Gary Gregory.
19+
20+
Fixed Bugs
21+
----------
22+
23+
* Deprecate CommandLine.Builder() in favor of CommandLine.builder(). Thanks to Gary Gregory.
24+
* Deprecate DeprecatedAttributes.Builder() in favor of DeprecatedAttributes.builder(). Thanks to Gary Gregory.
25+
* Refactor default parser test #294. Thanks to Dávid Szigecsán.
26+
* Port to JUnit 5. Thanks to Gary Gregory.
27+
* Generics for Converter should use Exception not Throwable. Thanks to Gary Gregory.
28+
* Pick up maven-antrun-plugin version from parent POM org.apache:apache. Thanks to Gary Gregory.
29+
* Javadoc is missing its Overview page. Thanks to Gary Gregory.
30+
* Get mockito version from parent pom (#351). Thanks to Arnout Engelen.
31+
* Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80). Thanks to Gary Gregory.
32+
* Deprecate PatternOptionBuilder.PatternOptionBuilder(). Thanks to Arnout Engelen.
33+
* CLI-341: HelpFormatter infinite loop with 0 width input. Thanks to Ruiqi Dong, Gary Gregory.
34+
* CLI-349: Fail faster with a more precise NullPointerException: Option.processValue() throws NullPointerException when passed null value with value separator configured. Thanks to Leo Fernandes, Gary Gregory.
35+
* CLI-344: Fail faster with a more precise NullPointerException: DefaultParser.parse() throws NullPointerException when options parameter is null. Thanks to Ruiqi Dong, Gary Gregory.
36+
* CLI-347: Options.addOptionGroup(OptionGroup) does not remove required options from requiredOpts list. Thanks to Ruiqi Dong, Gary Gregory.
37+
* org.apache.commons.cli.Option.Builder.get() should throw IllegalStateException instead of IllegalArgumentException. Thanks to Gary Gregory.
38+
* org.apache.commons.cli.Option.processValue(String) should throw IllegalStateException instead of IllegalArgumentException. Thanks to Gary Gregory.
39+
* org.apache.commons.cli.OptionBuilder.create() should throw IllegalStateException instead of IllegalArgumentException. Thanks to Gary Gregory.
40+
41+
Updates
42+
-------
43+
44+
* Bump org.apache.commons:commons-parent from 72 to 85 #302, #304, #310, #315, #320, #327, #371. Thanks to Gary Gregory, Dependabot.
45+
* [test] Bump commons-io:commons-io from 2.16.1 to 2.20.0 #309, #337. Thanks to Gary Gregory, Dependabot.
46+
* [test] Bump org.apache.commons:commons-text from 1.12.0 to 1.14.0 #344. Thanks to Gary Gregory, Dependabot.
47+
* Update site documentation to https://maven.apache.org/xsd/xdoc-2.0.xsd. Thanks to Gary Gregory.
48+
49+
50+
Historical list of changes: https://commons.apache.org/proper/commons-cli/changes.html
51+
52+
For complete information on Apache Commons CLI, including instructions on how to submit bug reports,
53+
patches, or suggestions for improvement, see the Apache Commons CLI website:
54+
55+
https://commons.apache.org/proper/commons-cli/
56+
57+
Download page: https://commons.apache.org/proper/commons-cli/download_cli.cgi
58+
59+
Have fun!
60+
The Apache Commons Team
61+
62+
------------------------------------------------------------------------------
63+
64+
Apache Commons CLI 1.10.0 Release Notes
65+
---------------------------------------
66+
67+
Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
68+
69+
This is a feature and maintenance release. Java 8 or later is required.
70+
971
New Features
1072
------------
1173

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<dependency>
7171
<groupId>org.apache.commons</groupId>
7272
<artifactId>commons-text</artifactId>
73-
<version>1.13.1</version>
73+
<version>1.14.0</version>
7474
<scope>test</scope>
7575
</dependency>
7676
<dependency>

src/changes/changes.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<title>Apache Commons CLI Release Notes</title>
2323
</properties>
2424
<body>
25-
<release version="1.10.0" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
25+
<release version="1.10.0" date="2025-07-30" description="This is a feature and maintenance release. Java 8 or later is required.">
2626
<!-- FIX -->
2727
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate CommandLine.Builder() in favor of CommandLine.builder().</action>
2828
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate DeprecatedAttributes.Builder() in favor of DeprecatedAttributes.builder().</action>
@@ -35,15 +35,22 @@
3535
<action type="fix" dev="ggregory" due-to="Gary Gregory">Remove -nouses directive from maven-bundle-plugin. OSGi package imports now state 'uses' definitions for package imports, this doesn't affect JPMS (from org.apache.commons:commons-parent:80).</action>
3636
<action type="fix" dev="ggregory" due-to="Arnout Engelen">Deprecate PatternOptionBuilder.PatternOptionBuilder().</action>
3737
<action type="fix" issue="CLI-341" dev="ggregory" due-to="Ruiqi Dong, Gary Gregory">HelpFormatter infinite loop with 0 width input.</action>
38+
<action type="fix" issue="CLI-349" dev="ggregory" due-to="Leo Fernandes, Gary Gregory">Fail faster with a more precise NullPointerException: Option.processValue() throws NullPointerException when passed null value with value separator configured.</action>
39+
<action type="fix" issue="CLI-344" dev="ggregory" due-to="Ruiqi Dong, Gary Gregory">Fail faster with a more precise NullPointerException: DefaultParser.parse() throws NullPointerException when options parameter is null.</action>
40+
<action type="fix" issue="CLI-347" dev="ggregory" due-to="Ruiqi Dong, Gary Gregory">Options.addOptionGroup(OptionGroup) does not remove required options from requiredOpts list.</action>
41+
<action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.commons.cli.Option.Builder.get() should throw IllegalStateException instead of IllegalArgumentException.</action>
42+
<action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.commons.cli.Option.processValue(String) should throw IllegalStateException instead of IllegalArgumentException.</action>
43+
<action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.commons.cli.OptionBuilder.create() should throw IllegalStateException instead of IllegalArgumentException.</action>
3844
<!-- ADD -->
3945
<action type="add" issue="CLI-339" dev="ggregory" due-to="Claude Warren, Gary Gregory">Help formatter extension in the new package #314.</action>
4046
<action type="add" dev="ggregory" due-to="Gary Gregory">CommandLine.Builder implements Supplier&lt;CommandLine&gt;.</action>
4147
<action type="add" dev="ggregory" due-to="Gary Gregory">DefaultParser.Builder implements Supplier&lt;DefaultParser&gt;.</action>
42-
<action type="add" issue="CLI-340" dev="ggregory" due-to="Claude Warren, Gary Gregory">Add CommandLine.getParsedOptionValues() #334.</action>
48+
<action type="add" issue="CLI-340" dev="ggregory" due-to="Claude Warren, Gary Gregory">Add CommandLine.getParsedOptionValues() #334.</action>
49+
<action type="add" issue="CLI-333" dev="ggregory" due-to="Claude Warren, Gary Gregory">org.apache.commons.cli.Option.Builder implements Supplier&lt;Option&gt;.</action>
4350
<!-- UPDATE -->
4451
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 72 to 85 #302, #304, #310, #315, #320, #327, #371.</action>
4552
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">[test] Bump commons-io:commons-io from 2.16.1 to 2.20.0 #309, #337.</action>
46-
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">[test] Bump org.apache.commons:commons-text from 1.12.0 to 1.13.1 #344.</action>
53+
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">[test] Bump org.apache.commons:commons-text from 1.12.0 to 1.14.0 #344.</action>
4754
<action type="update" dev="ggregory" due-to="Gary Gregory">Update site documentation to https://maven.apache.org/xsd/xdoc-2.0.xsd.</action>
4855
</release>
4956
<release version="1.9.0" date="2024-08-10" description="This release contains new features and bug fixes and requires Java 8 or above.">

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ public class AlreadySelectedException extends ParseException {
2828
private static final long serialVersionUID = 3674381532418544760L;
2929

3030
/** The option group selected. */
31-
private final OptionGroup group;
31+
private final OptionGroup optionGroup;
3232

3333
/** The option that triggered the exception. */
3434
private final Option option;
3535

3636
/**
3737
* Constructs a new {@code AlreadySelectedException} for the specified option group.
3838
*
39-
* @param group the option group already selected
39+
* @param optionGroup the option group already selected
4040
* @param option the option that triggered the exception
4141
* @since 1.2
4242
*/
43-
public AlreadySelectedException(final OptionGroup group, final Option option) {
44-
this(String.format("The option '%s' was specified but an option from this group has already been selected: '%s'", option.getKey(), group.getSelected()),
45-
group, option);
43+
public AlreadySelectedException(final OptionGroup optionGroup, final Option option) {
44+
this(String.format("The option '%s' was specified but an option from this group has already been selected: '%s'", option.getKey(),
45+
optionGroup.getSelected()), optionGroup, option);
4646
}
4747

4848
/**
@@ -54,9 +54,9 @@ public AlreadySelectedException(final String message) {
5454
this(message, null, null);
5555
}
5656

57-
private AlreadySelectedException(final String message, final OptionGroup group, final Option option) {
57+
private AlreadySelectedException(final String message, final OptionGroup optionGroup, final Option option) {
5858
super(message);
59-
this.group = group;
59+
this.optionGroup = optionGroup;
6060
this.option = option;
6161
}
6262

@@ -77,6 +77,6 @@ public Option getOption() {
7777
* @since 1.2
7878
*/
7979
public OptionGroup getOptionGroup() {
80-
return group;
80+
return optionGroup;
8181
}
8282
}

0 commit comments

Comments
 (0)