Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public static class BookieUnauthorizedAccessException extends BookieException {
public BookieUnauthorizedAccessException() {
super(Code.UnauthorizedAccessException);
}

public BookieUnauthorizedAccessException(String reason) {
super(Code.UnauthorizedAccessException, reason);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.io.IOException;
import java.lang.Thread.UncaughtExceptionHandler;
import java.net.UnknownHostException;
import java.security.AccessControlException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.apache.bookkeeper.bookie.Bookie;
Expand Down Expand Up @@ -201,7 +200,7 @@ public synchronized void shutdown() {
/**
* Ensure the current user can start-up the process if it's restricted.
*/
private void validateUser(ServerConfiguration conf) throws AccessControlException {
private void validateUser(ServerConfiguration conf) throws BookieException {
if (conf.containsKey(PERMITTED_STARTUP_USERS)) {
String currentUser = System.getProperty("user.name");
String[] propertyValue = conf.getPermittedStartupUsers();
Expand All @@ -215,7 +214,7 @@ private void validateUser(ServerConfiguration conf) throws AccessControlExceptio
+ " Current user: " + currentUser + " permittedStartupUsers: "
+ Arrays.toString(propertyValue);
LOG.error(errorMsg);
throw new AccessControlException(errorMsg);
throw new BookieException.BookieUnauthorizedAccessException(errorMsg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.bookkeeper.verifier;

import static com.google.common.base.Preconditions.checkState;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -32,7 +32,6 @@
import java.util.TreeSet;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

import org.apache.bookkeeper.client.BKException;

/**
Expand Down Expand Up @@ -180,6 +179,7 @@ private long getNextLedgerID() {
/**
* State required to regenerate an entry.
*/
@SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE")
class EntryInfo {
private final long entryID;
private final long seed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import java.net.InetAddress;
import java.net.URL;
import java.net.URLConnection;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -579,7 +578,7 @@ conf, new TestBookieImpl(conf),
new MockUncleanShutdownDetection());

fail("Bookkeeper should not have started since current user isn't in permittedStartupUsers");
} catch (AccessControlException buae) {
} catch (BookieException.BookieUnauthorizedAccessException buae) {
sawException = true;
} finally {
if (bs1 != null && bs1.isRunning()) {
Expand Down Expand Up @@ -615,7 +614,7 @@ conf, new TestBookieImpl(conf),
NullStatsLogger.INSTANCE, UnpooledByteBufAllocator.DEFAULT,
new MockUncleanShutdownDetection());
bs1.start();
} catch (AccessControlException buae) {
} catch (BookieException.BookieUnauthorizedAccessException buae) {
fail("Bookkeeper should have started since current user is in permittedStartupUsers");
} finally {
if (bs1 != null && bs1.isRunning()) {
Expand All @@ -632,7 +631,7 @@ conf, new TestBookieImpl(conf),
NullStatsLogger.INSTANCE, UnpooledByteBufAllocator.DEFAULT,
new MockUncleanShutdownDetection());
bs1.start();
} catch (AccessControlException buae) {
} catch (BookieException.BookieUnauthorizedAccessException buae) {
fail("Bookkeeper should have started since current user is in permittedStartupUsers");
} finally {
if (bs1 != null && bs1.isRunning()) {
Expand Down Expand Up @@ -664,7 +663,7 @@ conf, new TestBookieImpl(conf),
NullStatsLogger.INSTANCE, UnpooledByteBufAllocator.DEFAULT,
new MockUncleanShutdownDetection());
bs1.start();
} catch (AccessControlException buae) {
} catch (BookieException.BookieUnauthorizedAccessException buae) {
fail("Bookkeeper should have started since permittedStartupUser is not specified");
} finally {
if (bs1 != null && bs1.isRunning()) {
Expand Down
1 change: 1 addition & 0 deletions bookkeeper-stats/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ plugins {
dependencies {
implementation depLibs.commonsConfiguration
implementation depLibs.slf4j
compileOnly depLibs.spotbugsAnnotations
}

jar {
Expand Down
9 changes: 9 additions & 0 deletions bookkeeper-stats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<artifactId>bookkeeper-stats-api</artifactId>
<name>Apache BookKeeper :: Stats API</name>
<url>http://maven.apache.org</url>
<properties>
<spotbugs-annotations.version>4.6.0</spotbugs-annotations.version>
</properties>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -55,5 +58,11 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs-annotations.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.bookkeeper.stats;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

Expand All @@ -29,6 +31,7 @@ public class CachingStatsLogger implements StatsLogger {
protected final ConcurrentMap<String, OpStatsLogger> opStatsLoggers;
protected final ConcurrentMap<String, StatsLogger> scopeStatsLoggers;

@SuppressFBWarnings("EI_EXPOSE_REP2")
public CachingStatsLogger(StatsLogger statsLogger) {
this.underlying = statsLogger;
this.counters = new ConcurrentHashMap<String, Counter>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.bookkeeper.stats;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.concurrent.TimeUnit;

/**
Expand All @@ -24,6 +26,7 @@
* <p>Metrics are not recorded, making this receiver useful in unit tests and as defaults in
* situations where metrics are not strictly required.
*/
@SuppressFBWarnings("EI_EXPOSE_REP2")
public class NullStatsLogger implements StatsLogger {

public static final NullStatsLogger INSTANCE = new NullStatsLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
*/
package org.apache.bookkeeper.stats;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.configuration.Configuration;

/**
* A <i>no-op</i> stats provider implementation.
*/
@SuppressFBWarnings("EI_EXPOSE_REP2")
public class NullStatsProvider implements StatsProvider {

final StatsLogger nullStatsLogger = new NullStatsLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package org.apache.bookkeeper.stats;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.configuration.Configuration;
Expand Down Expand Up @@ -63,6 +64,7 @@ public static void loadStatsProvider(String className) {
}
}

@SuppressFBWarnings("EI_EXPOSE_REP2")
public static StatsProvider get() {
return prov;
}
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ allprojects {
}

spotbugs {
toolVersion = '3.1.8'
excludeFilter = file("$rootDir/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml")
reportLevel = 'high'
spotbugsTest.enabled = false
Expand Down
10 changes: 10 additions & 0 deletions buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
limitations under the License.
//-->
<FindBugsFilter>
<!--Global rules suppressions-->
<Match>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<Match>
<Bug pattern="MS_EXPOSE_REP"/>
</Match>
<!-- circe-checksum -->
<Match>
<!-- imported code -->
Expand Down
10 changes: 10 additions & 0 deletions buildtools/src/main/resources/distributedlog/findbugsExclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
limitations under the License.
//-->
<FindBugsFilter>
<!--Global rules suppressions-->
<Match>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
<Match>
<Bug pattern="MS_EXPOSE_REP"/>
</Match>
<Match>
<!-- generated code, we can't be held responsible for findbugs in it //-->
<Class name="~org\.apache\.distributedlog\.tests\.generated.*" />
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

protobufPluginVersion=0.8.18
apcheRatPluginVersion=0.7.0
shadowPluginVersion=6.1.0
shadowPluginVersion=7.1.2
licenseGradlePluginVersion=0.15.0
checkStyleVersion=6.19
spotbugsPlugin=4.7.0
spotbugsPlugin=5.0.5
testLogger=3.1.0
testRetry=1.0.0
owaspPlugin=6.5.3
1 change: 1 addition & 0 deletions microbenchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
compileOnly depLibs.jmhCore
compileOnly depLibs.guava
compileOnly depLibs.slf4j
compileOnly depLibs.spotbugsAnnotations
annotationProcessor depLibs.jmhGeneratorAnnprocess
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.bookkeeper.stats.codahale;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;

import org.apache.bookkeeper.stats.OpStatsLogger;
import org.apache.bookkeeper.stats.StatsLogger;
import org.openjdk.jmh.annotations.Benchmark;
Expand Down Expand Up @@ -71,6 +71,7 @@ public static class MyState {
private int timeIdx = 0;

@Setup(Level.Trial)
@SuppressFBWarnings("SSD_DO_NOT_USE_INSTANCE_LOCK_ON_SHARED_STATIC_DATA")
public void doSetup() throws Exception {
StatsLogger logger = null;
switch (timerType) {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
<shrinkwrap.version>3.0.1</shrinkwrap.version>
<slf4j.version>1.7.32</slf4j.version>
<snakeyaml.version>1.30</snakeyaml.version>
<spotbugs-annotations.version>3.1.8</spotbugs-annotations.version>
<spotbugs-annotations.version>4.6.0</spotbugs-annotations.version>
<javax-annotations-api.version>1.3.2</javax-annotations-api.version>
<testcontainers.version>1.15.1</testcontainers.version>
<vertx.version>3.9.8</vertx.version>
Expand Down Expand Up @@ -205,7 +205,7 @@
<os-maven-plugin.version>1.4.1.Final</os-maven-plugin.version>
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
<puppycrawl.checkstyle.version>6.19</puppycrawl.checkstyle.version>
<spotbugs-maven-plugin.version>3.1.8</spotbugs-maven-plugin.version>
<spotbugs-maven-plugin.version>4.6.0.0</spotbugs-maven-plugin.version>
<forkCount.variable>1</forkCount.variable>
<servlet-api.version>4.0.0</servlet-api.version>
<rxjava.version>3.0.1</rxjava.version>
Expand Down
1 change: 1 addition & 0 deletions stream/distributedlog/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation depLibs.guava
compileOnly depLibs.jsr305
compileOnly depLibs.lombok
compileOnly depLibs.spotbugsAnnotations
implementation depLibs.nettyBuffer
implementation depLibs.nettyTransportNativeEpoll
implementation depLibs.slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.URI;
import java.util.Collections;

import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -533,6 +533,7 @@ public void processResult(int rc, String path, Object ctx, List<OpResult> result
}, null);
}

@SuppressFBWarnings("DCN_NULLPOINTER_EXCEPTION")
static LogMetadataForWriter processLogMetadatas(URI uri,
String logName,
String logIdentifier,
Expand Down
19 changes: 19 additions & 0 deletions stream/distributedlog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<module>core</module>
<module>io</module>
</modules>
<properties>
<spotbugs-annotations.version>4.6.0</spotbugs-annotations.version>
</properties>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -87,5 +90,21 @@
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs-annotations.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Loading