Repository: incubator-beam Updated Branches: refs/heads/master 12b6ff8d7 -> ef2c51400
Add FindBugs analysis to the build FindBugs is a static analysis tool which looks for common coding issues in Java code. See: http://findbugs.sourceforge.net/ This commit integrates FindBugs into the build process using findbugs-maven-plugin, and subscribes java-sdk-all for analysis. The codebase currently generates many Findbugs issues, which have been added in the findbugs-filter.xml file as a baseline. These issues should be triaged and fixed over time. There will be some cases where we choose to ignore issues reported by FindBugs. In such a case, the issue should be suppressed in code via the @SuppressFBWarnings annotation with a comment describing why it is suppressed. Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/58a029a0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/58a029a0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/58a029a0 Branch: refs/heads/master Commit: 58a029a06aea1030279e5da8f9fa3114f456c1db Parents: 9d6d622 Author: Scott Wegner <[email protected]> Authored: Mon May 16 15:44:45 2016 -0700 Committer: Scott Wegner <[email protected]> Committed: Wed Jun 29 16:17:58 2016 -0700 ---------------------------------------------------------------------- examples/java/pom.xml | 2 +- pom.xml | 56 +- runners/core-java/pom.xml | 4 +- runners/direct-java/pom.xml | 2 +- runners/google-cloud-dataflow-java/pom.xml | 2 +- .../src/main/resources/beam/findbugs-filter.xml | 561 +++++++++++++++++++ sdks/java/core/pom.xml | 7 +- .../java/org/apache/beam/sdk/util/ZipFiles.java | 11 + sdks/java/io/google-cloud-platform/pom.xml | 14 +- sdks/java/io/hdfs/pom.xml | 2 +- sdks/java/io/kafka/pom.xml | 2 +- 11 files changed, 651 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/examples/java/pom.xml ---------------------------------------------------------------------- diff --git a/examples/java/pom.xml b/examples/java/pom.xml index 3b67797..6173ce3 100644 --- a/examples/java/pom.xml +++ b/examples/java/pom.xml @@ -240,7 +240,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 6848973..6f1eaac 100644 --- a/pom.xml +++ b/pom.xml @@ -122,8 +122,8 @@ <grpc.version>0.12.0</grpc.version> <hamcrest.version>1.3</hamcrest.version> <jackson.version>2.7.2</jackson.version> + <findbugs.version>3.0.1</findbugs.version> <joda.version>2.4</joda.version> - <jsr305.version>3.0.1</jsr305.version> <junit.version>4.11</junit.version> <mockito.version>1.9.5</mockito.version> <protobuf.version>3.0.0-beta-1</protobuf.version> @@ -338,6 +338,10 @@ <groupId>com.google.guava</groupId> <artifactId>guava-jdk5</artifactId> </exclusion> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> </exclusions> </dependency> @@ -362,6 +366,10 @@ <groupId>com.google.guava</groupId> <artifactId>guava-jdk5</artifactId> </exclusion> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> </exclusions> </dependency> @@ -469,20 +477,32 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> - <version>${jsr305.version}</version> + <artifactId>annotations</artifactId> + <version>${findbugs.version}</version> </dependency> <dependency> <groupId>com.google.cloud.bigdataoss</groupId> <artifactId>gcsio</artifactId> <version>${google-cloud-bigdataoss.version}</version> + <exclusions> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.google.cloud.bigdataoss</groupId> <artifactId>util</artifactId> <version>${google-cloud-bigdataoss.version}</version> + <exclusions> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -608,6 +628,12 @@ <artifactId>guava-testlib</artifactId> <version>${guava.version}</version> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -911,6 +937,30 @@ </execution> </executions> </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <version>${findbugs.version}</version> + <dependencies> + <dependency> + <groupId>org.apache.beam</groupId> + <artifactId>beam-sdks-java-build-tools</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + <configuration> + <excludeFilterFile>beam/findbugs-filter.xml</excludeFilterFile> + </configuration> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </pluginManagement> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/runners/core-java/pom.xml ---------------------------------------------------------------------- diff --git a/runners/core-java/pom.xml b/runners/core-java/pom.xml index 3a91f7e..c7eea4a 100644 --- a/runners/core-java/pom.xml +++ b/runners/core-java/pom.xml @@ -199,7 +199,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> @@ -216,7 +216,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/runners/direct-java/pom.xml ---------------------------------------------------------------------- diff --git a/runners/direct-java/pom.xml b/runners/direct-java/pom.xml index 82c1e15..2e45e1d 100644 --- a/runners/direct-java/pom.xml +++ b/runners/direct-java/pom.xml @@ -276,7 +276,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/runners/google-cloud-dataflow-java/pom.xml ---------------------------------------------------------------------- diff --git a/runners/google-cloud-dataflow-java/pom.xml b/runners/google-cloud-dataflow-java/pom.xml index 38ffa49..76e5f80 100644 --- a/runners/google-cloud-dataflow-java/pom.xml +++ b/runners/google-cloud-dataflow-java/pom.xml @@ -363,7 +363,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml ---------------------------------------------------------------------- diff --git a/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml b/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml new file mode 100644 index 0000000..3f15835 --- /dev/null +++ b/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml @@ -0,0 +1,561 @@ +<?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> + <!-- Ignored bug categories. Bugs in these categories should not block the build. --> + <Bug category="I18N"/> + <Bug pattern="DM_STRING_CTOR"/> + <Bug pattern="SE_NO_SERIALVERSIONID"/> + + + <!-- + Baseline issues below. No new issues should be added to this list. Instead, suppress + the issue inline using @SuppressFBWarnings and a documented reason, or (preferably) fix + the issue. + --> + <Match> + <Class name="org.apache.beam.sdk.coders.AvroCoder"/> + <Field name="decoder"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.AvroCoder"/> + <Field name="encoder"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.AvroCoder"/> + <Field name="reader"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.AvroCoder"/> + <Field name="writer"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.AvroCoder"/> + <Field name="reader"/> + <Bug pattern="SE_BAD_FIELD_STORE"/> + <!--Non-serializable value stored into instance field of a serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.AvroCoder"/> + <Field name="writer"/> + <Bug pattern="SE_BAD_FIELD_STORE"/> + <!--Non-serializable value stored into instance field of a serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.Coder$NonDeterministicException"/> + <Bug pattern="NM_CLASS_NOT_EXCEPTION"/> + <!--Class is not derived from an Exception, even though it is named as such--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.Coder$NonDeterministicException"/> + <Method name="getMessage"/> + <Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/> + <!--Format string should use %n rather than \n--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.EntityCoder"/> + <Method name="decode"/> + <Bug pattern="RR_NOT_CHECKED"/> + <!--Method ignores results of InputStream.read()--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.JAXBCoder"/> + <Method name="getContext"/> + <Bug pattern="DC_DOUBLECHECK"/> + <!--Possible double check of field--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.JAXBCoder"/> + <Field name="jaxbContext"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.InstantCoder$1"/> + <Bug pattern="HE_INHERITS_EQUALS_USE_HASHCODE"/> + <!--Class inherits equals() and uses Object.hashCode()--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.SerializableCoder"/> + <Method name="equals"/> + <Bug pattern="NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT"/> + <!--equals() method does not check for null argument--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.StandardCoder"/> + <Method name="toString"/> + <Bug pattern="SBSC_USE_STRINGBUFFER_CONCATENATION"/> + <!--Method invokes inefficient new String(String) constructor--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.StructuralByteArray"/> + <Method name="getValue"/> + <Bug pattern="EI_EXPOSE_REP"/> + <!--May expose internal representation by returning reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.coders.StructuralByteArray"/> + <Method name="<init>"/> + <Bug pattern="EI_EXPOSE_REP2"/> + <!--May expose internal representation by incorporating reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.BigQueryIO$StreamingWriteFn"/> + <Method name="finishBundle"/> + <Bug pattern="WMI_WRONG_MAP_ITERATOR"/> + <!--Inefficient use of keySet iterator instead of entrySet iterator--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.PubsubIO$Read$Bound$PubsubBoundedReader"/> + <Method name="processElement"/> + <Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/> + <!--Random object created and used only once--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.PubsubUnboundedSink$WriterFn"/> + <Method name="publishBatch"/> + <Bug pattern="DLS_DEAD_LOCAL_STORE"/> + <!--Dead store to local variable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.Write$Bound"/> + <Method name="createWrite"/> + <Bug pattern="DLS_DEAD_LOCAL_STORE"/> + <!--Dead store to local variable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.range.OffsetRangeTracker"/> + <Field name="done"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.range.OffsetRangeTracker"/> + <Field name="lastRecordStart"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.range.OffsetRangeTracker"/> + <Field name="offsetOfLastSplitPoint"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.range.OffsetRangeTracker"/> + <Field name="splitPointsSeen"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.range.OffsetRangeTracker"/> + <Field name="startOffset"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.io.range.OffsetRangeTracker"/> + <Field name="stopOffset"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.options.PipelineOptionsFactory$1"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.options.PipelineOptionsFactory$2"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.options.PipelineOptionsFactory$3"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.options.PipelineOptionsFactory$4"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.options.ProxyInvocationHandler"/> + <Method name="<init>"/> + <Bug pattern="DM_NEXTINT_VIA_NEXTDOUBLE"/> + <!--Use the nextInt method of Random rather than nextDouble to generate a random integer--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.runners.DirectPipelineRunner"/> + <Method name="<init>"/> + <Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/> + <!--Random object created and used only once--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.CoderProperties"/> + <Field name="ALL_CONTEXTS"/> + <Bug pattern="MS_MUTABLE_COLLECTION_PKGPROTECT"/> + <!--Field is a mutable collection which should be package protected--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.PAssert$IterableAssert"/> + <Method name="equals"/> + <Bug pattern="EQ_UNUSUAL"/> + <!--Unusual equals method --> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.PAssert$IterableAssert"/> + <Field name="pipeline"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.PAssert$PCollectionContentsAssert"/> + <Method name="equals"/> + <Bug pattern="EQ_UNUSUAL"/> + <!--Unusual equals method--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.PAssert$PCollectionViewAssert"/> + <Method name="equals"/> + <Bug pattern="EQ_UNUSUAL"/> + <!--Unusual equals method--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.PAssert$SingletonAssert"/> + <Method name="equals"/> + <Bug pattern="EQ_UNUSUAL"/> + <!--Unusual equals method --> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.PAssert$SingletonAssert"/> + <Field name="pipeline"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.SerializableMatchers$SerializableArrayViaCoder"/> + <Field name="value"/> + <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/> + <!--Transient field that isn't set by deserialization. --> + </Match> + <Match> + <Class name="org.apache.beam.sdk.testing.WindowSupplier"/> + <Field name="windows"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization --> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.ApproximateQuantiles$ApproximateQuantilesCombineFn"/> + <Method name="create"/> + <Bug pattern="ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL"/> + <!--Integral value cast to double and then passed to Math.ceil--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.ApproximateQuantiles$QuantileBuffer"/> + <Method name="compareTo"/> + <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/> + <!--Class defines compareTo(...) and uses Object.equals()--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.Create$TimestampedValues"/> + <Field name="elems"/> + <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/> + <!--Transient field that isn't set by deserialization. --> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.DoFnTester"/> + <Field name="sideOutputTags"/> + <Bug pattern="URF_UNREAD_FIELD"/> + <!--Unread field--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.Mean$CountSum"/> + <Method name="equals"/> + <Bug pattern="FE_FLOATING_POINT_EQUALITY"/> + <!--Test for floating point equality--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.display.DisplayData"/> + <Field name="entries"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.display.DisplayData$InternalBuilder$PopulateDisplayDataException"/> + <Bug pattern="SIC_INNER_SHOULD_BE_STATIC"/> + <!--Should be a static inner class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.join.CoGbkResult$UnionValueIterator"/> + <Method name="hasNext"/> + <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/> + <!--Suspicious reference comparison of Boolean values--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.windowing.AfterDelayFromFirstElement"/> + <Method name="prefetchOnElement"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.windowing.AfterDelayFromFirstElement"/> + <Method name="prefetchShouldFire"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.transforms.windowing.AfterPane"/> + <Method name="prefetchShouldFire"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.AttemptAndTimeBoundedExponentialBackOff"/> + <Method name="reset"/> + <Bug pattern="UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR"/> + <!--Uninitialized read of field method called from constructor of superclass--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.AttemptAndTimeBoundedExponentialBackOff"/> + <Method name="reset"/> + <Bug pattern="UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR"/> + <!--Uninitialized read of field method called from constructor of superclass--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.AvroUtils$AvroMetadata"/> + <Method name="getSyncMarker"/> + <Bug pattern="EI_EXPOSE_REP"/> + <!--May expose internal representation by returning reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.BitSetCoder"/> + <Field name="byteArrayCoder"/> + <Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/> + <!--Transient field that isn't set by deserialization. --> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.CombineFnUtil$NonSerializableBoundedKeyedCombineFn"/> + <Field name="context"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.ExposedByteArrayInputStream"/> + <Method name="readAll"/> + <Bug pattern="EI_EXPOSE_REP"/> + <!--May expose internal representation by returning reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.ExposedByteArrayOutputStream"/> + <Method name="toByteArray"/> + <Bug pattern="EI_EXPOSE_REP"/> + <!--May expose internal representation by returning reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.ExposedByteArrayOutputStream"/> + <Method name="writeAndOwn"/> + <Bug pattern="EI_EXPOSE_REP2"/> + <!--May expose internal representation by incorporating reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.PCollectionViews$PCollectionViewBase"/> + <Method name="equals"/> + <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/> + <!--Redundant nullcheck of value known to be non-null--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.PCollectionViews$SingletonPCollectionView"/> + <Field name="defaultValue"/> + <Bug pattern="IS2_INCONSISTENT_SYNC"/> + <!--Inconsistent synchronization--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.PaneInfoTracker$1"/> + <Method name="readLater"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.PubsubClient$IncomingMessage"/> + <Method name="<init>"/> + <Bug pattern="EI_EXPOSE_REP2"/> + <!--May expose internal representation by incorporating reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.PubsubClient$IncomingMessage"/> + <Method name="<init>"/> + <Bug pattern="EI_EXPOSE_REP2"/> + <!--May expose internal representation by incorporating reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.PubsubClient$OutgoingMessage"/> + <Method name="<init>"/> + <Bug pattern="EI_EXPOSE_REP2"/> + <!--May expose internal representation by incorporating reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.ReleaseInfo"/> + <Method name="<init>"/> + <Bug pattern="OBL_UNSATISFIED_OBLIGATION"/> + <!--Method may fail to clean up stream or resource--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.SystemReduceFn"/> + <Method name="prefetchOnTrigger"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.TriggerContextFactory"/> + <Field name="activeWindows"/> + <Bug pattern="URF_UNREAD_FIELD"/> + <!--Unread field--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.TriggerRunner"/> + <Method name="prefetchForMerge"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.TriggerRunner"/> + <Method name="prefetchForValue"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.TriggerRunner"/> + <Method name="prefetchOnFire"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.TriggerRunner"/> + <Method name="prefetchShouldFire"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.ValueWithRecordId"/> + <Method name="getId"/> + <Bug pattern="EI_EXPOSE_REP"/> + <!--May expose internal representation by returning reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.ValueWithRecordId"/> + <Method name="<init>"/> + <Bug pattern="EI_EXPOSE_REP2"/> + <!--May expose internal representation by incorporating reference to mutable object--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.WatermarkHold"/> + <Field name="timerInternals"/> + <Bug pattern="SE_BAD_FIELD"/> + <!--Non-transient non-serializable instance field in serializable class--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.WatermarkHold$1"/> + <Method name="readLater"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.common.ReflectHelpers$1"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.common.ReflectHelpers$2"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.common.ReflectHelpers$3"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.common.ReflectHelpers$4"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.common.ReflectHelpers$5"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.common.ReflectHelpers$6"/> + <Method name="apply"/> + <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"/> + <!--Parameter must be non-null but is marked as nullable--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.state.StateMerging"/> + <Method name="mergeBags"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.state.StateMerging"/> + <Method name="mergeCombiningValues"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.state.StateMerging"/> + <Method name="prefetchBags"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.state.StateMerging"/> + <Method name="prefetchCombiningValues"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.state.StateMerging"/> + <Method name="prefetchWatermarks"/> + <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> + <!--Return value of method without side effect is ignored--> + </Match> + <Match> + <Class name="org.apache.beam.sdk.util.state.StateTags$CombiningValueStateTag"/> + <Method name="equals"/> + <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/> + <!--Class doesn't override equals in superclass--> + </Match> +</FindBugsFilter> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/sdks/java/core/pom.xml ---------------------------------------------------------------------- diff --git a/sdks/java/core/pom.xml b/sdks/java/core/pom.xml index 3b650c6..67c7fe9 100644 --- a/sdks/java/core/pom.xml +++ b/sdks/java/core/pom.xml @@ -234,6 +234,11 @@ </executions> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + </plugin> + <!-- Coverage analysis for unit tests. --> <plugin> <groupId>org.jacoco</groupId> @@ -415,7 +420,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ZipFiles.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ZipFiles.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ZipFiles.java index 038b9cb..c93e18d 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ZipFiles.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/ZipFiles.java @@ -40,6 +40,8 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + /** * Functions for zipping a directory (including a subdirectory) into a ZIP-file * or unzipping it again. @@ -226,6 +228,10 @@ public final class ZipFiles { * @throws IOException the zipping failed, e.g. because the input was not * readable. */ + @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", + justification = "File.listFiles() will return null if the File instance is not a directory. " + + "Null dereference is not a possibility here since we validate sourceDirectory is " + + "directory via sourceDirectory.isDirectory()") public static void zipDirectory( File sourceDirectory, OutputStream outputStream) throws IOException { @@ -235,6 +241,7 @@ public final class ZipFiles { sourceDirectory.isDirectory(), "%s is not a valid directory", sourceDirectory.getAbsolutePath()); + ZipOutputStream zos = new ZipOutputStream(outputStream); for (File file : sourceDirectory.listFiles()) { zipDirectoryInternal(file, "", zos); @@ -257,6 +264,10 @@ public final class ZipFiles { * @throws IOException the zipping failed, e.g. because the output was not * writeable. */ + @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", + justification = "File.listFiles() will return null if the File instance is not a directory. " + + "Null dereference is not a possibility here since we validate inputFile is directory " + + "via inputFile.isDirectory()") private static void zipDirectoryInternal( File inputFile, String directoryName, http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/sdks/java/io/google-cloud-platform/pom.xml ---------------------------------------------------------------------- diff --git a/sdks/java/io/google-cloud-platform/pom.xml b/sdks/java/io/google-cloud-platform/pom.xml index 692ac96..c95ea71 100644 --- a/sdks/java/io/google-cloud-platform/pom.xml +++ b/sdks/java/io/google-cloud-platform/pom.xml @@ -112,12 +112,24 @@ <groupId>com.google.cloud.bigtable</groupId> <artifactId>bigtable-protos</artifactId> <version>${bigtable.version}</version> + <exclusions> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.google.cloud.bigtable</groupId> <artifactId>bigtable-client-core</artifactId> <version>${bigtable.version}</version> + <exclusions> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -137,7 +149,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/sdks/java/io/hdfs/pom.xml ---------------------------------------------------------------------- diff --git a/sdks/java/io/hdfs/pom.xml b/sdks/java/io/hdfs/pom.xml index f2c9f68..2e427b1 100644 --- a/sdks/java/io/hdfs/pom.xml +++ b/sdks/java/io/hdfs/pom.xml @@ -78,7 +78,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/58a029a0/sdks/java/io/kafka/pom.xml ---------------------------------------------------------------------- diff --git a/sdks/java/io/kafka/pom.xml b/sdks/java/io/kafka/pom.xml index cc447cd..9777543 100644 --- a/sdks/java/io/kafka/pom.xml +++ b/sdks/java/io/kafka/pom.xml @@ -100,7 +100,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <artifactId>annotations</artifactId> </dependency> <!-- test dependencies-->
