Skip to content

Commit 2f21499

Browse files
committed
Replace deprecated FindBugs with SpotBugs.
1 parent 2b2267c commit 2f21499

3 files changed

Lines changed: 56 additions & 23 deletions

File tree

pom.xml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,12 @@
211211
<commons.jacoco.version>0.8.7</commons.jacoco.version>
212212
<commons.surefire-report.version>3.0.0-M5</commons.surefire-report.version>
213213
<commons.surefire.version>3.0.0-M5</commons.surefire.version>
214+
<spotbugs.plugin.version>4.4.1</spotbugs.plugin.version>
215+
<spotbugs.impl.version>4.4.1</spotbugs.impl.version>
214216
</properties>
215217

216218
<build>
217-
<defaultGoal>clean package apache-rat:check clirr:check checkstyle:check findbugs:check javadoc:javadoc</defaultGoal>
219+
<defaultGoal>clean package apache-rat:check clirr:check checkstyle:check spotbugs:check javadoc:javadoc</defaultGoal>
218220
<pluginManagement>
219221
<plugins>
220222
<plugin>
@@ -246,16 +248,21 @@
246248
</dependency>
247249
</dependencies>
248250
</plugin>
249-
<plugin>
250-
<groupId>org.codehaus.mojo</groupId>
251-
<artifactId>findbugs-maven-plugin</artifactId>
252-
<version>${commons.findbugs.version}</version>
253-
<configuration>
254-
<threshold>Normal</threshold>
255-
<effort>Default</effort>
256-
<excludeFilterFile>${basedir}/src/conf/findbugs-exclude-filter.xml</excludeFilterFile>
257-
</configuration>
258-
</plugin>
251+
<plugin>
252+
<groupId>com.github.spotbugs</groupId>
253+
<artifactId>spotbugs-maven-plugin</artifactId>
254+
<version>${spotbugs.plugin.version}</version>
255+
<dependencies>
256+
<dependency>
257+
<groupId>com.github.spotbugs</groupId>
258+
<artifactId>spotbugs</artifactId>
259+
<version>${spotbugs.impl.version}</version>
260+
</dependency>
261+
</dependencies>
262+
<configuration>
263+
<excludeFilterFile>${basedir}/src/conf/spotbugs-exclude-filter.xml</excludeFilterFile>
264+
</configuration>
265+
</plugin>
259266
<plugin>
260267
<groupId>org.apache.maven.plugins</groupId>
261268
<artifactId>maven-scm-publish-plugin</artifactId>
@@ -272,6 +279,10 @@
272279
<groupId>org.apache.maven.plugins</groupId>
273280
<artifactId>maven-checkstyle-plugin</artifactId>
274281
</plugin>
282+
<plugin>
283+
<groupId>com.github.spotbugs</groupId>
284+
<artifactId>spotbugs-maven-plugin</artifactId>
285+
</plugin>
275286
<plugin>
276287
<artifactId>maven-assembly-plugin</artifactId>
277288
<configuration>
@@ -313,6 +324,10 @@
313324
<groupId>org.apache.maven.plugins</groupId>
314325
<artifactId>maven-checkstyle-plugin</artifactId>
315326
</plugin>
327+
<plugin>
328+
<groupId>com.github.spotbugs</groupId>
329+
<artifactId>spotbugs-maven-plugin</artifactId>
330+
</plugin>
316331
<plugin>
317332
<groupId>org.apache.rat</groupId>
318333
<artifactId>apache-rat-plugin</artifactId>

src/changes/changes.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424

2525
<release version="1.5" date="tba" description="tba">
2626
<!-- FIX -->
27-
<action type="update" dev="ggregory" due-to="Gary Gregory">
27+
<action type="fix" dev="ggregory" due-to="Gary Gregory">
2828
Fix NPE in DefaultParser.isLongOption(String).
2929
</action>
30-
<action type="update" dev="britter" due-to="Krishna Mohan Rao Kandunoori" issue="CLI-279">
30+
<action type="fix" dev="britter" due-to="Krishna Mohan Rao Kandunoori" issue="CLI-279">
3131
@param or @return lines should end with a period in CommandLine.java
3232
</action>
33+
<action type="fix" dev="ggregory" due-to="Gary Gregory">
34+
Replace deprecated FindBugs with SpotBugs.
35+
</action>
3336
<!-- ADD -->
3437
<action type="add" dev="chtompki" due-to="Rubin Simons" issue="CLI-217">
3538
Accommodate toggling partial matching in DefaultParser.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
Licensed to the Apache Software Foundation (ASF) under one or more
44
contributor license agreements. See the NOTICE file distributed with
@@ -15,20 +15,35 @@
1515
See the License for the specific language governing permissions and
1616
limitations under the License.
1717
-->
18+
<FindBugsFilter xmlns="https://github.com/spotbugs/filter/3.0.0"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
1821

19-
<!--
20-
This file contains some false positive bugs detected by findbugs. Their
21-
false positive nature has been analyzed individually and they have been
22-
put here to instruct findbugs it must ignore them.
23-
-->
24-
<FindBugsFilter>
25-
26-
<!-- default encoding is intended when writing to System.out -->
2722
<Match>
2823
<Class name="org.apache.commons.cli.HelpFormatter" />
2924
<Method name="printHelp"
30-
params="int,java.lang.String,java.lang.String,org.apache.commons.cli.Options,java.lang.String,boolean" returns="void" />
25+
params="int,java.lang.String,java.lang.String,org.apache.commons.cli.Options,java.lang.String,boolean"
26+
returns="void" />
3127
<Bug pattern="DM_DEFAULT_ENCODING" />
3228
</Match>
3329

30+
<Match>
31+
<!-- Note: OptionBuilder is deprecated. -->
32+
<Class name="org.apache.commons.cli.OptionBuilder" />
33+
<Method name="withType"
34+
params="java.lang.Class"
35+
returns="org.apache.commons.cli.OptionBuilder" />
36+
<Bug pattern="EI_EXPOSE_STATIC_REP2" />
37+
</Match>
38+
39+
<Match>
40+
<!-- TODO ? -->
41+
<Bug pattern="EI_EXPOSE_REP" />
42+
</Match>
43+
44+
<Match>
45+
<!-- TODO ? -->
46+
<Bug pattern="EI_EXPOSE_REP2" />
47+
</Match>
48+
3449
</FindBugsFilter>

0 commit comments

Comments
 (0)