Skip to content

Commit 1af9b95

Browse files
committed
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 apache#107.
1 parent a500e8b commit 1af9b95

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
<commons.felix.version>5.1.2</commons.felix.version>
219219
<biz.aQute.bndlib.version>6.0.0</biz.aQute.bndlib.version>
220220
<spotbugs.plugin.version>4.6.0.0</spotbugs.plugin.version>
221-
<spotbugs.impl.version>4.6.0</spotbugs.impl.version>
221+
<spotbugs.impl.version>4.7.0</spotbugs.impl.version>
222222
<commons.animal-sniffer.version>1.20</commons.animal-sniffer.version>
223223
<commons.japicmp.version>0.15.3</commons.japicmp.version>
224224
<clirr.skip>true</clirr.skip>

src/changes/changes.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
</properties>
2222
<body>
2323
<release version="1.6" date="tbd" description="New features and bug fixes">
24+
<!-- FIX -->
25+
<action type="update" dev="ggregory" due-to="Gary Gregory">
26+
Fix SpotBugs Error: Medium: Method intentionally throws RuntimeException. [org.apache.commons.cli.Option] At Option.java:[lines 417-423] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
27+
</action>
28+
<action type="update" dev="ggregory" due-to="Gary Gregory">
29+
Fix SpotBugs Error: Medium: Method intentionally throws RuntimeException. [org.apache.commons.cli.Option] At Option.java:[lines 446-450] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
30+
</action>
31+
<action type="update" dev="ggregory" due-to="Gary Gregory">
32+
Fix SpotBugs Error: Medium: Method intentionally throws RuntimeException. [org.apache.commons.cli.Option] At Option.java:[lines 474-478] THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
33+
</action>
2434
<!-- ADD -->
2535
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">
2636
Add github/codeql-action.
@@ -32,8 +42,8 @@
3242
<action type="update" dev="ggregory" due-to="Gary Gregory">
3343
Bump actions/setup-java from 2 to 3.
3444
</action>
35-
<action type="update" dev="ggregory" due-to="Gary Gregory">
36-
Bump spotbugs from 4.5.3 to 4.6.0 #96
45+
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">
46+
Bump spotbugs from 4.5.3 to 4.7.0 #96, #107.
3747
</action>
3848
<action type="update" dev="ggregory" due-to="Dependabot">
3949
Bump spotbugs-maven-plugin from 4.5.3.0 to 4.6.0.0 #98.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ boolean acceptsArg() {
415415
*/
416416
private void add(final String value) {
417417
if (!acceptsArg()) {
418-
throw new RuntimeException("Cannot add value, list full.");
418+
throw new IllegalArgumentException("Cannot add value, list full.");
419419
}
420420

421421
// store value
@@ -444,7 +444,7 @@ public boolean addValue(final String value) {
444444
*/
445445
void addValueForProcessing(final String value) {
446446
if (argCount == UNINITIALIZED) {
447-
throw new RuntimeException("NO_ARGS_ALLOWED");
447+
throw new IllegalArgumentException("NO_ARGS_ALLOWED");
448448
}
449449
processValue(value);
450450
}
@@ -475,7 +475,7 @@ public Object clone() {
475475
option.values = new ArrayList<>(values);
476476
return option;
477477
} catch (final CloneNotSupportedException cnse) {
478-
throw new RuntimeException("A CloneNotSupportedException was thrown: " + cnse.getMessage());
478+
throw new IllegalStateException("A CloneNotSupportedException was thrown: " + cnse.getMessage());
479479
}
480480
}
481481

0 commit comments

Comments
 (0)