Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump org.apache.maven.plugins:maven-pmd-plugin from 3.14.0 to 3.26.0 #815

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 @@ -100,7 +100,7 @@ private String[] convertCredentials(final Supplier<Security.JmxSecurity> jmxSecu
Credentials credentials = jmxSecurity.get().getJmxCredentials();
if (!credentials.isEnabled())
{
return null;
return new String[0];
}
return new String[] {
credentials.getUsername(), credentials.getPassword()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public ECChronosInternals(final Config configuration,
.build();

myTableRepairMetricsImpl = TableRepairMetricsImpl.builder()
.withTableStorageStates(myTableStorageStatesImpl)
.withMeterRegistry(meterRegistry)
.build();

Expand Down Expand Up @@ -213,9 +212,8 @@ public final void close()
myCassandraMetrics.close();
}

private static class NoOpRepairMetrics implements TableRepairMetrics
private static final class NoOpRepairMetrics implements TableRepairMetrics
{

@Override
public void repairState(final TableReference tableReference,
final int repairedRanges,
Expand Down Expand Up @@ -252,7 +250,7 @@ public void repairSession(final TableReference tableReference,
}
}

private static class NoOpTableStorageState implements TableStorageStates
private static final class NoOpTableStorageState implements TableStorageStates
{
@Override
public long getDataSize(final TableReference tableReference)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,7 @@ CqlTLSConfig getTlsConfig()

boolean sameConfig(final CqlTLSConfig newTLSConfig) throws IOException, NoSuchAlgorithmException
{
if (!myTlsConfig.equals(newTLSConfig))
{
return false;
}
return checksumSame(newTLSConfig);
return myTlsConfig.equals(newTLSConfig) && checksumSame(newTLSConfig);
}

private boolean checksumSame(final CqlTLSConfig newTLSConfig) throws IOException, NoSuchAlgorithmException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private <T> T getConfiguration(final File configurationFile, final Class<T> claz
}
return config;
}
catch (IOException e)
catch (IOException e) // NOPMD
{
throw new ConfigurationException("Unable to load configuration file " + configurationFile, e);
}
Expand All @@ -105,7 +105,7 @@ private <T> T getConfiguration(final InputStream configurationFile,
}
return config;
}
catch (IOException e)
catch (IOException e) // NOPMD
{
throw new ConfigurationException("Unable to load configuration file from classpath", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public final void setProvider(final Class<? extends T> providerClass) throws NoS
* If the getDeclaredConstructor method was not found.
*/
@JsonProperty("certificateHandler")
public void setCertificateHandler(final Class<? extends CertificateHandler> certificateHandlerClass)
public final void setCertificateHandler(final Class<? extends CertificateHandler> certificateHandlerClass)
throws NoSuchMethodException
{
certificateHandlerClass.getDeclaredConstructor(expectedCertHandlerConstructor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public final String[] getProtocols()
{
if (myProtocol == null)
{
return null;
return new String[0];
}
return myProtocol.split(",");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public class DataCenterAwarePolicy extends DefaultLoadBalancingPolicy
{
private static final Logger LOG = LoggerFactory.getLogger(DataCenterAwarePolicy.class);

private final ConcurrentMap<String, CopyOnWriteArrayList<Node>> myPerDcLiveNodes = new ConcurrentHashMap<>();
private final ConcurrentMap<String, CopyOnWriteArrayList<Node>> myPerDcLiveNodes = // NOPMD
new ConcurrentHashMap<>();
private final AtomicInteger myIndex = new AtomicInteger();

public DataCenterAwarePolicy(final DriverContext context, final String profileName)
Expand All @@ -64,7 +65,7 @@ public final void init(final Map<UUID, Node> nodes, final DistanceReporter dista
super.init(nodes, distanceReporter);
LOG.info("Using provided data-center name '{}' for DataCenterAwareLoadBalancingPolicy", getLocalDatacenter());

ArrayList<String> notInLocalDC = new ArrayList<>();
List<String> notInLocalDC = new ArrayList<>();

for (Node node : nodes.values())
{
Expand All @@ -75,7 +76,7 @@ public final void init(final Map<UUID, Node> nodes, final DistanceReporter dista
notInLocalDC.add(String.format("%s (%s)", node, dc));
}

CopyOnWriteArrayList<Node> nodeList = myPerDcLiveNodes.get(dc);
CopyOnWriteArrayList<Node> nodeList = myPerDcLiveNodes.get(dc); // NOPMD
if (nodeList == null)
{
myPerDcLiveNodes.put(dc, new CopyOnWriteArrayList<>(Collections.singletonList(node)));
Expand Down Expand Up @@ -172,7 +173,7 @@ public NodeDistance distance(final Node node, final String dataCenter)
return NodeDistance.LOCAL;
}

CopyOnWriteArrayList<Node> dcNodes = myPerDcLiveNodes.get(dc);
CopyOnWriteArrayList<Node> dcNodes = myPerDcLiveNodes.get(dc); // NOPMD
if (dcNodes == null)
{
return NodeDistance.IGNORED;
Expand All @@ -183,7 +184,7 @@ public NodeDistance distance(final Node node, final String dataCenter)

private Queue<Node> getFallbackQueryPlan(final String dataCenter)
{
CopyOnWriteArrayList<Node> localLiveNodes = myPerDcLiveNodes.get(dataCenter);
CopyOnWriteArrayList<Node> localLiveNodes = myPerDcLiveNodes.get(dataCenter); // NOPMD
final List<Node> nodes = localLiveNodes == null ? Collections.emptyList() : cloneList(localLiveNodes);
final int startIndex = myIndex.getAndIncrement();
int index = startIndex;
Expand All @@ -203,7 +204,7 @@ private Queue<Node> getFallbackQueryPlan(final String dataCenter)
}

@SuppressWarnings ("unchecked")
private static CopyOnWriteArrayList<Node> cloneList(final CopyOnWriteArrayList<Node> list)
private static CopyOnWriteArrayList<Node> cloneList(final CopyOnWriteArrayList<Node> list) // NOPMD
{
return (CopyOnWriteArrayList<Node>) list.clone();
}
Expand All @@ -219,10 +220,10 @@ private void markAsUp(final Node node)
{
String dc = getDc(node);

CopyOnWriteArrayList<Node> dcNodes = myPerDcLiveNodes.get(dc);
CopyOnWriteArrayList<Node> dcNodes = myPerDcLiveNodes.get(dc); // NOPMD
if (dcNodes == null)
{
CopyOnWriteArrayList<Node> newMap = new CopyOnWriteArrayList<>(Collections.singletonList(node));
CopyOnWriteArrayList<Node> newMap = new CopyOnWriteArrayList<>(Collections.singletonList(node)); // NOPMD
dcNodes = myPerDcLiveNodes.putIfAbsent(dc, newMap);
// If we've successfully put our new node, we're good, otherwise we've been beaten so continue
if (dcNodes == null)
Expand All @@ -242,7 +243,7 @@ public final void onDown(final Node node)

private void markAsDown(final Node node)
{
CopyOnWriteArrayList<Node> dcNodes = myPerDcLiveNodes.get(getDc(node));
CopyOnWriteArrayList<Node> dcNodes = myPerDcLiveNodes.get(getDc(node)); // NOPMD
if (dcNodes != null)
{
dcNodes.remove(node);
Expand Down Expand Up @@ -272,7 +273,7 @@ public final void onRemove(final Node node)
/**
* Only for test purposes.
*/
ConcurrentMap<String, CopyOnWriteArrayList<Node>> getPerDcLiveNodes()
ConcurrentMap<String, CopyOnWriteArrayList<Node>> getPerDcLiveNodes() // NOPMD
{
return myPerDcLiveNodes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.io.Closeable;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

Expand All @@ -38,7 +39,7 @@ public final class HostStatesImpl implements HostStates, Closeable

private static final long DEFAULT_REFRESH_INTERVAL_IN_MS = TimeUnit.SECONDS.toMillis(10);

private final ConcurrentHashMap<InetAddress, Boolean> myHostStates = new ConcurrentHashMap<>();
private final Map<InetAddress, Boolean> myHostStates = new ConcurrentHashMap<>();
private final Object myRefreshLock = new Object();
private final long myRefreshIntervalInMs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
/**
* A factory creating JMX proxies to Cassandra.
*/
@SuppressWarnings("FinalClass")
public class JmxProxyFactoryImpl implements JmxProxyFactory
public final class JmxProxyFactoryImpl implements JmxProxyFactory
{
private static final Logger LOG = LoggerFactory.getLogger(JmxProxyFactoryImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class TableStorageStatesImpl implements TableStorageStates, Closeab

private static final long DEFAULT_UPDATE_DELAY_IN_MS = TimeUnit.SECONDS.toMillis(60);

private final AtomicReference<ImmutableMap<TableReference, Long>> myTableSizes = new AtomicReference<>();
private final AtomicReference<Map<TableReference, Long>> myTableSizes = new AtomicReference<>();
private final ScheduledExecutorService myScheduledExecutorService;

private final ReplicatedTableProvider myReplicatedTableProvider;
Expand All @@ -60,7 +60,7 @@ private TableStorageStatesImpl(final Builder builder)
@Override
public long getDataSize(final TableReference tableReference)
{
ImmutableMap<TableReference, Long> dataSizes = myTableSizes.get();
Map<TableReference, Long> dataSizes = myTableSizes.get();

if (dataSizes != null && dataSizes.containsKey(tableReference))
{
Expand All @@ -73,7 +73,7 @@ public long getDataSize(final TableReference tableReference)
@Override
public long getDataSize()
{
ImmutableMap<TableReference, Long> dataSizes = myTableSizes.get();
Map<TableReference, Long> dataSizes = myTableSizes.get();

if (dataSizes != null)
{
Expand Down Expand Up @@ -160,7 +160,7 @@ void updateTableStates()
}
}

private ImmutableMap<TableReference, Long> getTableSizes(final JmxProxy jmxProxy)
private Map<TableReference, Long> getTableSizes(final JmxProxy jmxProxy)
{
Map<TableReference, Long> dataSizes = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.micrometer.core.instrument.Timer;

import java.io.Closeable;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
Expand All @@ -49,16 +50,13 @@ interface Clock
}

@VisibleForTesting
static Clock clock = () -> System.currentTimeMillis();
static Clock clock = () -> System.currentTimeMillis(); // NOPMD

private final ConcurrentHashMap<TableReference, TableGauges> myTableGauges = new ConcurrentHashMap<>();
private final TableStorageStates myTableStorageStates;
private final Map<TableReference, TableGauges> myTableGauges = new ConcurrentHashMap<>();
private final MeterRegistry myMeterRegistry;

private TableRepairMetricsImpl(final Builder builder)
{
myTableStorageStates = Preconditions.checkNotNull(builder.myTableStorageStates,
"Table storage states cannot be null");
myMeterRegistry = Preconditions.checkNotNull(builder.myMeterRegistry, "Meter registry cannot be null");
}

Expand Down Expand Up @@ -153,18 +151,20 @@ public static Builder builder()

public static class Builder
{
private TableStorageStates myTableStorageStates;
private MeterRegistry myMeterRegistry;

/**
* Build with table storage states.
*
* @deprecated
* This is not used anymore, calling this method is a NoOP
*
* @param tableStorageStates Table storage states
* @return Builder
*/
@Deprecated
public Builder withTableStorageStates(final TableStorageStates tableStorageStates)
{
myTableStorageStates = tableStorageStates;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class CombinedRepairResourceFactory implements RepairResourceFactory
{
private final ImmutableSet<RepairResourceFactory> myRepairResourceFactories;
private final Set<RepairResourceFactory> myRepairResourceFactories;

/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
import com.ericsson.bss.cassandra.ecchronos.core.utils.LongTokenRange;
import com.ericsson.bss.cassandra.ecchronos.core.utils.DriverNode;
import com.ericsson.bss.cassandra.ecchronos.core.utils.TableReference;
import com.google.common.collect.ImmutableSet;

@SuppressWarnings("FinalClass")
public class OngoingJob
public final class OngoingJob
{
public enum Status
{
Expand All @@ -39,7 +37,7 @@ public enum Status
private final UUID myJobId;
private final UUID myHostId;
private final TableReference myTableReference;
private final Map<LongTokenRange, ImmutableSet<DriverNode>> myTokens;
private final Map<LongTokenRange, Set<DriverNode>> myTokens;
private final Set<UdtValue> myRepairedTokens;
private final OnDemandStatus myOnDemandStatus;
private final ReplicationState myReplicationState;
Expand Down Expand Up @@ -112,7 +110,7 @@ public void finishRanges(final Set<LongTokenRange> ranges)
myOnDemandStatus.updateJob(myJobId, myRepairedTokens);
}

public Map<LongTokenRange, ImmutableSet<DriverNode>> getTokens()
public Map<LongTokenRange, Set<DriverNode>> getTokens()
{
return myTokens;
}
Expand All @@ -127,11 +125,11 @@ public boolean hasTopologyChanged()

public void startClusterWideJob(final RepairOptions.RepairType repairType)
{
Map<LongTokenRange, ImmutableSet<DriverNode>> allTokenRanges = myReplicationState
Map<LongTokenRange, Set<DriverNode>> allTokenRanges = myReplicationState
.getTokenRanges(myTableReference);
Map<DriverNode, Set<LongTokenRange>> repairedRangesPerNode = new HashMap<>();
Map<DriverNode, Set<LongTokenRange>> remainingRangesPerNode = new HashMap<>();
for (Map.Entry<LongTokenRange, ImmutableSet<DriverNode>> range : allTokenRanges.entrySet())
for (Map.Entry<LongTokenRange, Set<DriverNode>> range : allTokenRanges.entrySet())
{
LongTokenRange rangeForNodes = range.getKey();
Set<DriverNode> nodes = range.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
/**
* Configuration options for table repairs.
*/
@SuppressWarnings("FinalClass")
public class RepairConfiguration
public final class RepairConfiguration
{
public static final double NO_UNWIND = 0.0d;
public static final long FULL_REPAIR_SIZE = Long.MAX_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,21 @@ private LockFactory.DistributedLock getLockForRepairResource(
String dataCenter = repairResource.getDataCenter();

String resource = repairResource.getResourceName(LOCKS_PER_RESOURCE);
try
{
myLock = lockFactory.tryLock(dataCenter, resource, priority, metadata);

if (myLock != null)
{
return myLock;
}
myLock = lockFactory.tryLock(dataCenter, resource, priority, metadata);

String msg = String.format("Lock resources exhausted for %s", repairResource);
LOG.warn(msg);
throw new LockException(msg);
}
catch (LockException e)
if (myLock != null)
{
LOG.debug("Lock ({} in datacenter {}) got error {}",
resource,
dataCenter,
e.getMessage());
throw e;
return myLock;
}

String msg = String.format("Lock resources exhausted for %s", repairResource);
LOG.warn(msg);
LOG.debug("Lock ({} in datacenter {}) got error {}",
resource,
dataCenter,
msg);
throw new LockException(msg);
}

static class TemporaryLockHolder implements AutoCloseable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public enum ProgressEventType
NOTIFICATION
}

private class HangPreventingTask implements Runnable
private final class HangPreventingTask implements Runnable
{
private static final int MAX_CHECKS = 3;
private static final String NORMAL_STATUS = "NORMAL";
Expand Down
Loading
Loading