diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 00079caf1..90ec55f74 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,10 +18,8 @@ updates: - package-ecosystem: "maven" directory: "/" schedule: - interval: "weekly" - day: "friday" + interval: "quarterly" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" - day: "friday" + interval: "quarterly" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4cbe168c3..9ff35c83e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -23,7 +23,7 @@ Before you push a pull request, review this list: - [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project. - [ ] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI). -- [ ] I used AI to create any part of, or all of, this pull request. +- [ ] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute? - [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. - [ ] 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. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f8db33bf4..d0c44b99c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,6 +37,7 @@ jobs: security-events: write strategy: + max-parallel: 20 fail-fast: false matrix: language: [ 'java' ] @@ -45,10 +46,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -57,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5 + uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # 4.37.7 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,7 +69,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5 + uses: github/codeql-action/autobuild@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # 4.37.7 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -82,4 +83,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5 + uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # 4.37.7 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index a657a4ae2..4c17443c9 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -26,6 +26,6 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: 'Dependency Review PR' - uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1 + uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f923232fc..f3235a887 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,7 +15,11 @@ name: Java CI -on: [push, pull_request] +on: + push: + branches: + - 'master' + pull_request: {} permissions: contents: read @@ -26,25 +30,28 @@ jobs: runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} strategy: + max-parallel: 20 matrix: - java: [ 8, 11, 17, 21, 25 ] + java: [ 8, 11, 17, 21, 25, 26 ] experimental: [false] include: - - java: 26-ea + - java: 27-ea + experimental: true + - java: 28-ea experimental: true steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # 5.7.0 with: distribution: 'temurin' java-version: ${{ matrix.java }} diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 17444b765..b5289bff0 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -40,12 +40,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # 2.4.3 + uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc #2.4.4 with: results_file: results.sarif results_format: sarif @@ -57,13 +57,13 @@ jobs: publish_results: true - name: "Upload artifact" - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: SARIF file path: results.sarif retention-days: 5 - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # 3.29.5 + uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # 4.37.7 with: sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index 979659713..5a3aaa1b2 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ site-content *.iws *.ipr *.iml + +# NetBeans files +nb-configuration.xml +nbactions.xml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4440b2a2..7be0822d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,13 +48,13 @@ Getting Started --------------- + Make sure you have a [JIRA account](https://issues.apache.org/jira/). -+ Make sure you have a [GitHub account](https://github.com/signup/free). This is not essential, but makes providing patches much easier. ++ Make sure you have a [GitHub account](https://github.com/signup). This is not essential, but makes providing patches much easier. + If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons CLI's scope. + Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist. + Clearly describe the issue including steps to reproduce when it is a bug. + Make sure you fill in the earliest version that you know has the issue. + Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-), -[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository. If you don't have a GitHub account, you can still clone the Commons repository. +[fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) and check out your forked repository. If you don't have a GitHub account, you can still clone the Commons repository. Making Changes -------------- @@ -108,8 +108,8 @@ Additional Resources + [Contributing patches](https://commons.apache.org/patches.html) + [Apache Commons CLI JIRA project page][jira] + [Contributor License Agreement][cla] -+ [General GitHub documentation](https://help.github.com/) -+ [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/) ++ [General GitHub documentation](https://docs.github.com/) ++ [GitHub pull request documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) + [Apache Commons Twitter Account](https://twitter.com/ApacheCommons) [cla]:https://www.apache.org/licenses/#clas diff --git a/NOTICE.txt b/NOTICE.txt index 10eb78eb4..a8fd7fbae 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Commons CLI -Copyright 2002-2025 The Apache Software Foundation +Copyright 2002-2026 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (https://www.apache.org/). diff --git a/pom.xml b/pom.xml index ec44cb737..760a67205 100644 --- a/pom.xml +++ b/pom.xml @@ -19,12 +19,12 @@ org.apache.commons commons-parent - 91 + 104 4.0.0 commons-cli commons-cli - 1.11.1-SNAPSHOT + 1.12.0-SNAPSHOT Apache Commons CLI 2002 @@ -68,19 +68,18 @@ commons-io commons-io - 2.21.0 + 2.22.0 test org.apache.commons commons-text - 1.14.0 + 1.15.0 test org.mockito mockito-core - ${commons.mockito.version} test @@ -91,12 +90,12 @@ 1.8 cli org.apache.commons.cli - 1.11.0 - 1.11.1 + 1.12.0 + 1.12.1 commons-cli-${commons.release.version} true RC1 - 1.10.0 + 1.11.0 org.apache.commons.cli CLI 12310463 diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 269763f54..0bc73da08 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -22,6 +22,27 @@ Apache Commons CLI Release Notes + + + Fix broken Introduction links on the website #417. + Fix malformed Javadoc comments. + Correct HelpFormatter Javadoc #418. + Fix broken Javadoc links, replace deprecated methods in usage examples, and add a missing method to HelpFormatter (#424). + Use Locale.ENGLISH when parsing dates in Converter.DATE (#426). + Reject non-BMP code points in the Character type converter (#425). + Reject invalid dates in Converter.DATE (#430). + Reject an empty option name in getMatchingOptions (#434). + Reject trailing text after the date in Converter.DATE (#435). + Fix integer overflow in TextHelpAppendable.indexOfWrap (#437). + Reject UTF-16 surrogate values in Character converter (#438). + Fix HelpFormatter wrapped description indent (#439). + + Add AbstractHelpFormatter.printHelp(String, Options). + + Bump org.apache.commons:commons-parent from 91 to 104 #414, #416. + [test] Bump org.apache.commons:commons-text from 1.14.0 to 1.15.0. + Bump commons-io:commons-io from 2.21.0 to 2.22.0. + Multiple trailing BREAK_CHAR_SET characters cause infinite loop in HelpFormatter. diff --git a/src/main/java/org/apache/commons/cli/AlreadySelectedException.java b/src/main/java/org/apache/commons/cli/AlreadySelectedException.java index 7603eac5e..99024c197 100644 --- a/src/main/java/org/apache/commons/cli/AlreadySelectedException.java +++ b/src/main/java/org/apache/commons/cli/AlreadySelectedException.java @@ -36,8 +36,8 @@ public class AlreadySelectedException extends ParseException { /** * Constructs a new {@code AlreadySelectedException} for the specified option group. * - * @param optionGroup the option group already selected. - * @param option the option that triggered the exception. + * @param optionGroup The option group already selected. + * @param option The option that triggered the exception. * @since 1.2 */ public AlreadySelectedException(final OptionGroup optionGroup, final Option option) { @@ -48,7 +48,7 @@ public AlreadySelectedException(final OptionGroup optionGroup, final Option opti /** * Constructs a new {@code AlreadySelectedException} with the specified detail message. * - * @param message the detail message. + * @param message The detail message. */ public AlreadySelectedException(final String message) { this(message, null, null); @@ -63,7 +63,7 @@ private AlreadySelectedException(final String message, final OptionGroup optionG /** * Gets the option that was added to the group and triggered the exception. * - * @return the related option. + * @return The related option. * @since 1.2 */ public Option getOption() { @@ -73,7 +73,7 @@ public Option getOption() { /** * Gets the option group where another option has been selected. * - * @return the related option group. + * @return The related option group. * @since 1.2 */ public OptionGroup getOptionGroup() { diff --git a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java index d38a81ccc..1a64e95c1 100644 --- a/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java +++ b/src/main/java/org/apache/commons/cli/AmbiguousOptionException.java @@ -26,6 +26,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @since 1.3 */ public class AmbiguousOptionException extends UnrecognizedOptionException { + /** * This exception {@code serialVersionUID}. */ @@ -61,8 +62,8 @@ private static String createMessage(final String option, final Collection matchingOptions) { super(createMessage(option, matchingOptions), option); @@ -72,7 +73,7 @@ public AmbiguousOptionException(final String option, final Collection ma /** * Gets the options matching the partial name. * - * @return a collection of options matching the name. + * @return A collection of options matching the name. */ public Collection getMatchingOptions() { return matchingOptions; diff --git a/src/main/java/org/apache/commons/cli/CommandLine.java b/src/main/java/org/apache/commons/cli/CommandLine.java index 477903e7d..2942d5f92 100644 --- a/src/main/java/org/apache/commons/cli/CommandLine.java +++ b/src/main/java/org/apache/commons/cli/CommandLine.java @@ -76,7 +76,7 @@ public Builder() { /** * Adds left-over unrecognized option/argument. * - * @param arg the unrecognized option/argument. + * @param arg The unrecognized option/argument. * @return this Builder instance for method chaining. */ public Builder addArg(final String arg) { @@ -89,7 +89,7 @@ public Builder addArg(final String arg) { /** * Adds an option to the command line. The values of the option are stored. * - * @param option the processed option. + * @param option The processed option. * @return this Builder instance for method chaining. */ public Builder addOption(final Option option) { @@ -102,7 +102,7 @@ public Builder addOption(final Option option) { /** * Creates a new instance. * - * @return a new instance. + * @return A new instance. * @deprecated Use {@link #get()}. */ @Deprecated @@ -113,7 +113,7 @@ public CommandLine build() { /** * Creates a new instance. * - * @return a new instance. + * @return A new instance. * @since 1.10.0 */ @Override @@ -124,7 +124,7 @@ public CommandLine get() { /** * Sets the deprecated option handler. * - * @param deprecatedHandler the deprecated option handler. + * @param deprecatedHandler The deprecated option handler. * @return {@code this} instance. * @since 1.7.0 */ @@ -140,7 +140,7 @@ public Builder setDeprecatedHandler(final Consumer