You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/05/06 11:28:25 UTC
[commons-cli] branch master updated: Fix SpotBugs 4.7.0 issues.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git
The following commit(s) were added to refs/heads/master by this push:
new 1af9b95 Fix SpotBugs 4.7.0 issues.
1af9b95 is described below
commit 1af9b95aa30c8383588e169bf2fe749c3e9c7c64
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri May 6 07:28:20 2022 -0400
Fix SpotBugs 4.7.0 issues.
[INFO] BugInstance size is 3
[INFO] Error size is 0
[INFO] Total bugs: 3
Error: Medium: Method intentionally throws RuntimeException.
[org.apache.commons.cli.Option] At Option.java:[lines 417-423]
THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
Error: Medium: Method intentionally throws RuntimeException.
[org.apache.commons.cli.Option] At Option.java:[lines 446-450]
THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
Error: Medium: Method intentionally throws RuntimeException.
[org.apache.commons.cli.Option] At Option.java:[lines 474-478]
THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
Bump spotbugs from 4.6.0 to 4.7.0 #107.
---
pom.xml | 2 +-
src/changes/changes.xml | 14 ++++++++++++--
src/main/java/org/apache/commons/cli/Option.java | 6 +++---
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index d8958f8..a2142fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -218,7 +218,7 @@
<commons.felix.version>5.1.2</commons.felix.version>
<biz.aQute.bndlib.version>6.0.0</biz.aQute.bndlib.version>
<spotbugs.plugin.version>4.6.0.0</spotbugs.plugin.version>
- <spotbugs.impl.version>4.6.0</spotbugs.impl.version>
+ <spotbugs.impl.version>4.7.0</spotbugs.impl.version>
<commons.animal-sniffer.version>1.20</commons.animal-sniffer.version>
<commons.japicmp.version>0.15.3</commons.japicmp.version>
<clirr.skip>true</clirr.skip>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 21a2154..a731c7a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -21,6 +21,16 @@
</properties>
<body>
<release version="1.6" date="tbd" description="New features and bug fixes">
+ <!-- FIX -->
+ <action type="update" dev="ggregory" due-to="Gary Gregory">
+ Fix SpotBugs Error: Medium: Method intentionally throws RuntimeException. [org.apache.commons.cli.Option] At Option.java:[lines 417-423] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
+ </action>
+ <action type="update" dev="ggregory" due-to="Gary Gregory">
+ Fix SpotBugs Error: Medium: Method intentionally throws RuntimeException. [org.apache.commons.cli.Option] At Option.java:[lines 446-450] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
+ </action>
+ <action type="update" dev="ggregory" due-to="Gary Gregory">
+ Fix SpotBugs Error: Medium: Method intentionally throws RuntimeException. [org.apache.commons.cli.Option] At Option.java:[lines 474-478] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
+ </action>
<!-- ADD -->
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">
Add github/codeql-action.
@@ -32,8 +42,8 @@
<action type="update" dev="ggregory" due-to="Gary Gregory">
Bump actions/setup-java from 2 to 3.
</action>
- <action type="update" dev="ggregory" due-to="Gary Gregory">
- Bump spotbugs from 4.5.3 to 4.6.0 #96
+ <action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">
+ Bump spotbugs from 4.5.3 to 4.7.0 #96, #107.
</action>
<action type="update" dev="ggregory" due-to="Dependabot">
Bump spotbugs-maven-plugin from 4.5.3.0 to 4.6.0.0 #98.
diff --git a/src/main/java/org/apache/commons/cli/Option.java b/src/main/java/org/apache/commons/cli/Option.java
index a1c2e4e..616c112 100644
--- a/src/main/java/org/apache/commons/cli/Option.java
+++ b/src/main/java/org/apache/commons/cli/Option.java
@@ -415,7 +415,7 @@ public class Option implements Cloneable, Serializable {
*/
private void add(final String value) {
if (!acceptsArg()) {
- throw new RuntimeException("Cannot add value, list full.");
+ throw new IllegalArgumentException("Cannot add value, list full.");
}
// store value
@@ -444,7 +444,7 @@ public class Option implements Cloneable, Serializable {
*/
void addValueForProcessing(final String value) {
if (argCount == UNINITIALIZED) {
- throw new RuntimeException("NO_ARGS_ALLOWED");
+ throw new IllegalArgumentException("NO_ARGS_ALLOWED");
}
processValue(value);
}
@@ -475,7 +475,7 @@ public class Option implements Cloneable, Serializable {
option.values = new ArrayList<>(values);
return option;
} catch (final CloneNotSupportedException cnse) {
- throw new RuntimeException("A CloneNotSupportedException was thrown: " + cnse.getMessage());
+ throw new IllegalStateException("A CloneNotSupportedException was thrown: " + cnse.getMessage());
}
}