Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
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 @@ -22,7 +22,6 @@

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
Expand All @@ -38,16 +37,22 @@ class LifeCycleMethods
addLifeCycleMethods(clazz, new HashSet<>(), new HashSet<>());
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

boolean hasFor(Class<? extends Annotation> annotation)
{
Collection<Method> methods = methodMap.get(annotation);
return (methods != null) && (!methods.isEmpty());
return !methods.isEmpty();
}

Collection<Method> methodsFor(Class<? extends Annotation> annotation)
{
Collection<Method> methods = methodMap.get(annotation);
return (methods != null) ? methods : new ArrayList<>();
return methodMap.get(annotation);
}

private void addLifeCycleMethods(Class<?> clazz, Set<String> usedConstructNames, Set<String> usedDestroyNames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ else if (!this.defunctConfig.add(defunct)) {
}
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

public static boolean isConfigClass(Class<?> classz)
{
for (Method method : classz.getDeclaredMethods()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public ServiceDescriptors(String type,
}
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

public String getType()
{
return type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ else if (token.size() == 1) {
}
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

@Override
public Class<T> handledType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public static <T> FullSmileResponseHandler<T> createFullSmileResponseHandler(Jso
return new FullSmileResponseHandler<>(jsonCodec);
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

private final JsonCodec<T> jsonCodec;

private FullSmileResponseHandler(JsonCodec<T> jsonCodec)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ private HttpUriBuilder(URI previous)
params.putAll(parseParams(previous.getRawQuery()));
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

public static HttpUriBuilder uriBuilder()
{
return new HttpUriBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ public HttpServiceBalancerImpl(String description, HttpServiceBalancerStats http
this.ticker = requireNonNull(ticker, "ticker is null");
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

@Override
public HttpServiceAttempt createAttempt()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public JettyHttpClient(String name, HttpClientConfig config)
public JettyHttpClient(
String name,
HttpClientConfig config,
Iterable<? extends HttpRequestFilter> requestFilters) {
Iterable<? extends HttpRequestFilter> requestFilters)
{
this(name, config, DEFAULT_CLIENT_OPTIONS, requestFilters);
}

Expand Down Expand Up @@ -331,6 +332,13 @@ public JettyHttpClient(
});
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

private static QueuedThreadPool createExecutor(String name, int minThreads, int maxThreads)
{
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ protected void runJob(Runnable job)
.map(date -> ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()));
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

private ServerConnector createHttpsServerConnector(HttpServerConfig config, ServerSocketChannel serverSocketChannel, HttpConfiguration configuration, Executor threadPool, int acceptors, int selectors)
throws IOException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ public MBeanRepresentation(MBeanServer mbeanServer, ObjectName objectName, Objec
this.operations = operations.build();
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

@JsonProperty
public ObjectName getObjectName()
{
Expand Down
7 changes: 7 additions & 0 deletions jmx/src/main/java/com/proofpoint/jmx/JmxAgent9.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ else if (configuredRegistryPort != null) {
}
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

@Nullable
@Override
public JMXServiceURL getUrl()
Expand Down
7 changes: 7 additions & 0 deletions jmx/src/main/java/com/proofpoint/jmx/JmxInspector.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public JmxInspector(Injector injector)
inspectorRecords = builder.build();
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

@Override
public Iterator<InspectorRecord> iterator()
{
Expand Down
7 changes: 7 additions & 0 deletions launcher/src/main/java/com/proofpoint/launcher/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ private Main()
{
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

public static void main(String[] args)
{
Cli<Runnable> cli = Cli.<Runnable>builder("launcher")
Expand Down
7 changes: 7 additions & 0 deletions launcher/src/main/java/com/proofpoint/launcher/PidFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ class PidFile implements PidStatusSource
}
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

void indicateStarting()
throws AlreadyRunningError
{
Expand Down
6 changes: 6 additions & 0 deletions log/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<optional>true</optional>
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.proofpoint.platform</groupId>
Expand Down
9 changes: 9 additions & 0 deletions log/src/main/java/com/proofpoint/log/Logging.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.proofpoint.configuration.PropertiesBuilder;
import com.proofpoint.units.DataSize;
import com.proofpoint.units.Duration;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.BufferedWriter;
import java.io.File;
Expand Down Expand Up @@ -98,6 +99,7 @@ public class Logging
*
* @return the logging system singleton
*/
@SuppressFBWarnings("MS_EXPOSE_REP")
public static synchronized Logging initialize()
{
if (instance == null) {
Expand All @@ -117,6 +119,13 @@ private Logging()
rewireStdStreams();
}

// Protect against finalizer attacks, as constructor can throw exception.
@SuppressWarnings("deprecation")
@Override
protected final void finalize()
{
}

@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private void rewireStdStreams()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void report(long systemTimeMillis, Table<String, Map<String, String>, Obj
//Reporting events
reportEach(systemTimeMillis, collectedData.cellSet().stream()
.filter(cell -> !(cell.getValue() instanceof Number))
.filter(cell -> cell.getValue() != "")
.filter(cell -> !cell.getValue().equals(""))
.collect(ImmutableTable.toImmutableTable(
Table.Cell::getRowKey,
Table.Cell::getColumnKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void check()
}

@SuppressWarnings({"ObjectEqualsNull", "SelfEquals"})
@SuppressFBWarnings({"EC_NULL_ARG","RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"})
@SuppressFBWarnings({"DCN_NULLPOINTER_EXCEPTION","EC_NULL_ARG","RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"})
private List<ElementCheckFailure> checkEquivalence()
{
ImmutableList.Builder<ElementCheckFailure> errors = new ImmutableList.Builder<>();
Expand Down
6 changes: 6 additions & 0 deletions trace-token/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<optional>true</optional>
</dependency>

<!-- for testing -->
<dependency>
<groupId>org.testng</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.Map;

Expand Down Expand Up @@ -56,6 +57,7 @@ protected Map<String, String> delegate()
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public String toString()
{
if (delegate.size() == 1) {
Expand Down
Loading