Can you move spotbugs-filter.xml into src/main/config/spotbugs? The root directory is expensive real-estate.
> On Sep 20, 2018, at 2:04 PM, kris...@apache.org wrote: > > Repository: calcite-avatica > Updated Branches: > refs/heads/master 6afbfd52a -> 3cfafde9f > > > [CALCITE-1006] Enable spotbugs-maven-plugin > > Close apache/calcite-avatica#39 > > Signed-off-by: Kevin Risden <kris...@apache.org> > > > Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo > Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/3cfafde9 > Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/3cfafde9 > Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/3cfafde9 > > Branch: refs/heads/master > Commit: 3cfafde9f5f0f1fc3ddc60b5a4db19762c73b96b > Parents: 6afbfd5 > Author: Kevin Risden <kris...@apache.org> > Authored: Thu Apr 19 21:51:45 2018 -0500 > Committer: Kevin Risden <kris...@apache.org> > Committed: Thu Sep 20 17:04:14 2018 -0400 > > ---------------------------------------------------------------------- > .../calcite/avatica/AvaticaConnection.java | 2 +- > .../apache/calcite/avatica/DriverVersion.java | 12 +++--- > .../calcite/avatica/util/DateTimeUtils.java | 2 +- > pom.xml | 40 ++++++++++++++++++++ > spotbugs-filter.xml | 39 +++++++++++++++++++ > 5 files changed, 87 insertions(+), 8 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/3cfafde9/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java > ---------------------------------------------------------------------- > diff --git > a/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java > b/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java > index c2f1f0d..b3552f8 100644 > --- a/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java > +++ b/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java > @@ -133,7 +133,7 @@ public abstract class AvaticaConnection implements > Connection { > * {@link AvaticaStatement#executeInternal(Meta.Signature, boolean)} > * should retry before failing. */ > long getNumStatementRetries(Properties props) { > - return Long.valueOf(Objects.requireNonNull(props) > + return Long.parseLong(Objects.requireNonNull(props) > .getProperty(NUM_EXECUTE_RETRIES_KEY, NUM_EXECUTE_RETRIES_DEFAULT)); > } > > > http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/3cfafde9/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java > ---------------------------------------------------------------------- > diff --git a/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java > b/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java > index 15c966a..9b8bcf7 100644 > --- a/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java > +++ b/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java > @@ -109,29 +109,29 @@ public class DriverVersion { > jdbcCompliant = > Boolean.valueOf(properties.getProperty("jdbc.compliant")); > String[] s = driverVersion.replaceAll("-.*$", "").split("\\."); > - final int major = Integer.valueOf(s[0]); > - final int minor = Integer.valueOf(s[1]); > + final int major = Integer.parseInt(s[0]); > + final int minor = Integer.parseInt(s[1]); > try { > majorVersion = > - > Integer.valueOf(properties.getProperty("driver.version.major")); > + > Integer.parseInt(properties.getProperty("driver.version.major")); > } catch (NumberFormatException e) { > majorVersion = major; > } > try { > minorVersion = > - > Integer.valueOf(properties.getProperty("driver.version.minor")); > + > Integer.parseInt(properties.getProperty("driver.version.minor")); > } catch (NumberFormatException e) { > minorVersion = minor; > } > try { > databaseMajorVersion = > - > Integer.valueOf(properties.getProperty("database.version.major")); > + > Integer.parseInt(properties.getProperty("database.version.major")); > } catch (NumberFormatException e) { > databaseMajorVersion = major; > } > try { > databaseMinorVersion = > - > Integer.valueOf(properties.getProperty("database.version.minor")); > + > Integer.parseInt(properties.getProperty("database.version.minor")); > } catch (NumberFormatException e) { > databaseMinorVersion = minor; > } > > http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/3cfafde9/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java > ---------------------------------------------------------------------- > diff --git > a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java > b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java > index 25a9558..e028a81 100644 > --- a/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java > +++ b/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java > @@ -253,7 +253,7 @@ public class DateTimeUtils { > millis = millis + "0"; > } > > - int ms = Integer.valueOf(millis); > + int ms = Integer.parseInt(millis); > cal.add(Calendar.MILLISECOND, ms); > } > } > > http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/3cfafde9/pom.xml > ---------------------------------------------------------------------- > diff --git a/pom.xml b/pom.xml > index 1d6c9ac..8d09363 100644 > --- a/pom.xml > +++ b/pom.xml > @@ -87,6 +87,8 @@ limitations under the License. > <maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version> > <maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version> > <maven-scm-provider.version>1.11.1</maven-scm-provider.version> > + <!-- ASF 21 provides 3.1.1 but need 3.2.0 due to MSHADE-289 --> > + <maven-shade-plugin.version>3.2.0</maven-shade-plugin.version> > <mockito.version>2.22.0</mockito.version> > <os-maven-plugin.version>1.6.0</os-maven-plugin.version> > <owasp-dependency-check.version>3.3.2</owasp-dependency-check.version> > @@ -95,6 +97,8 @@ limitations under the License. > <scott-data-hsqldb.version>0.1</scott-data-hsqldb.version> > <servlet.version>4.0.1</servlet.version> > <slf4j.version>1.7.25</slf4j.version> > + <spotbugs.version>3.1.7</spotbugs.version> > + <spotbugs-maven-plugin.version>3.1.6</spotbugs-maven-plugin.version> > </properties> > <issueManagement> > <system>Jira</system> > @@ -496,6 +500,10 @@ limitations under the License. > </dependency> > </dependencies> > </plugin> > + <plugin> > + <groupId>com.github.spotbugs</groupId> > + <artifactId>spotbugs-maven-plugin</artifactId> > + </plugin> > </plugins> > <pluginManagement> > <plugins> > @@ -573,7 +581,9 @@ limitations under the License. > <artifactId>maven-javadoc-plugin</artifactId> > </plugin> > <plugin> > + <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-shade-plugin</artifactId> > + <version>${maven-shade-plugin.version}</version> > </plugin> > <plugin> > <artifactId>maven-source-plugin</artifactId> > @@ -648,6 +658,31 @@ limitations under the License. > <checkStaleness>true</checkStaleness> > </configuration> > </plugin> > + <plugin> > + <groupId>com.github.spotbugs</groupId> > + <artifactId>spotbugs-maven-plugin</artifactId> > + <version>${spotbugs-maven-plugin.version}</version> > + <configuration> > + <threshold>High</threshold> > + <failOnError>true</failOnError> > + <excludeFilterFile>spotbugs-filter.xml</excludeFilterFile> > + </configuration> > + <executions> > + <execution> > + <goals> > + <goal>check</goal> > + </goals> > + </execution> > + </executions> > + <dependencies> > + <!-- overwrite dependency on spotbugs if you want to specify the > version of spotbugs --> > + <dependency> > + <groupId>com.github.spotbugs</groupId> > + <artifactId>spotbugs</artifactId> > + <version>${spotbugs.version}</version> > + </dependency> > + </dependencies> > + </plugin> > </plugins> > </pluginManagement> > </build> > @@ -664,6 +699,11 @@ limitations under the License. > <windowtitle>Apache Calcite Avatica API</windowtitle> > </configuration> > </plugin> > + <plugin> > + <groupId>com.github.spotbugs</groupId> > + <artifactId>spotbugs-maven-plugin</artifactId> > + <version>${spotbugs-maven-plugin.version}</version> > + </plugin> > </plugins> > </reporting> > <repositories> > > http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/3cfafde9/spotbugs-filter.xml > ---------------------------------------------------------------------- > diff --git a/spotbugs-filter.xml b/spotbugs-filter.xml > new file mode 100644 > index 0000000..6c1cc3a > --- /dev/null > +++ b/spotbugs-filter.xml > @@ -0,0 +1,39 @@ > +<?xml version="1.0" encoding="UTF-8"?> > +<!-- > +Licensed to the Apache Software Foundation (ASF) under one or more > +contributor license agreements. See the NOTICE file distributed with > +this work for additional information regarding copyright ownership. > +The ASF licenses this file to you under the Apache License, Version 2.0 > +(the "License"); you may not use this file except in compliance with > +the License. You may obtain a copy of the License at > + > +http://www.apache.org/licenses/LICENSE-2.0 > + > +Unless required by applicable law or agreed to in writing, software > +distributed under the License is distributed on an "AS IS" BASIS, > +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > +See the License for the specific language governing permissions and > +limitations under the License. > +--> > +<FindBugsFilter > + xmlns="https://github.com/spotbugs/filter/3.0.0" > + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > + xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 > https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"> > + > + <!-- Base64 copied from public domain --> > + <Match> > + <Class name="org.apache.calcite.avatica.util.Base64" /> > + </Match> > + > + <!-- Clone is on purpose --> > + <Match> > + <Class name="org.apache.calcite.avatica.util.ByteString" /> > + <Method name="clone" /> > + <Bug pattern="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" /> > + </Match> > + > + <!-- Test only class --> > + <Match> > + <Class name="org.apache.calcite.avatica.tck.tests.InsertTest" /> > + </Match> > +</FindBugsFilter> >