Bump Checkstyle to 8.20 (#7651)

* Bump Checkstyle to 8.20

Moderate severity vulnerability that affects:
com.puppycrawl.tools:checkstyle

Checkstyle prior to 8.18 loads external DTDs by default,
which can potentially lead to denial of service attacks
or the leaking of confidential information.

Affected versions: < 8.18

* Oops, missed one

* Oops, missed a few
This commit is contained in:
Fokko Driesprong 2019-05-14 20:53:37 +02:00 committed by Fangjin Yang
parent e8a6575fb3
commit 2aa9613bed
60 changed files with 210 additions and 72 deletions

View File

@ -58,5 +58,7 @@ public class ConfigDrivenAwsCredentialsConfigProvider implements AWSCredentialsP
} }
@Override @Override
public void refresh() {} public void refresh()
{
}
} }

View File

@ -31,5 +31,7 @@ public final class ByteUtils
return result; return result;
} }
private ByteUtils() {} private ByteUtils()
{
}
} }

View File

@ -60,5 +60,7 @@ public class IntArrayUtils
} while (nextIndex != startIndex); } while (nextIndex != startIndex);
} }
private IntArrayUtils() {} private IntArrayUtils()
{
}
} }

View File

@ -55,5 +55,7 @@ public final class Threads
} }
} }
private Threads() {} private Threads()
{
}
} }

View File

@ -127,5 +127,7 @@ public final class Rows
return metricValueString; return metricValueString;
} }
private Rows() {} private Rows()
{
}
} }

View File

@ -92,5 +92,7 @@ public class CloseableIterators
return wrap(innerIterator, null); return wrap(innerIterator, null);
} }
private CloseableIterators() {} private CloseableIterators()
{
}
} }

View File

@ -34,7 +34,9 @@ public class AllGranularity extends Granularity
* This constructor is public b/c it is serialized and deserialized * This constructor is public b/c it is serialized and deserialized
* based on type in GranularityModule * based on type in GranularityModule
*/ */
public AllGranularity() {} public AllGranularity()
{
}
@Override @Override
public DateTimeFormatter getFormatter(Formatter type) public DateTimeFormatter getFormatter(Formatter type)

View File

@ -31,7 +31,9 @@ public class NoneGranularity extends Granularity
* This constructor is public b/c it is serialized and deserialized * This constructor is public b/c it is serialized and deserialized
* based on type in GranularityModule * based on type in GranularityModule
*/ */
public NoneGranularity() {} public NoneGranularity()
{
}
@Override @Override
public DateTimeFormatter getFormatter(Formatter type) public DateTimeFormatter getFormatter(Formatter type)

View File

@ -85,7 +85,9 @@ public class NativeIO
private static native int sync_file_range(int fd, long offset, long len, int flags); private static native int sync_file_range(int fd, long offset, long len, int flags);
private NativeIO() {} private NativeIO()
{
}
private static Field getFieldByReflection(Class cls, String fieldName) private static Field getFieldByReflection(Class cls, String fieldName)
{ {

View File

@ -34,7 +34,9 @@ public class HttpEmitterConfig extends BaseHttpEmittingConfig
/** /**
* For JSON deserialization only. In other cases use {@link Builder} * For JSON deserialization only. In other cases use {@link Builder}
*/ */
public HttpEmitterConfig() {} public HttpEmitterConfig()
{
}
public HttpEmitterConfig(BaseHttpEmittingConfig base, String recipientBaseUrl) public HttpEmitterConfig(BaseHttpEmittingConfig base, String recipientBaseUrl)
{ {

View File

@ -28,7 +28,9 @@ import org.asynchttpclient.AsyncHttpClient;
public class LoggingEmitterFactory extends LoggingEmitterConfig implements EmitterFactory public class LoggingEmitterFactory extends LoggingEmitterConfig implements EmitterFactory
{ {
public LoggingEmitterFactory() {} public LoggingEmitterFactory()
{
}
@Override @Override
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle) public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)

View File

@ -218,7 +218,9 @@ public class HttpClientConfig
private CompressionCodec compressionCodec = DEFAULT_COMPRESSION_CODEC; private CompressionCodec compressionCodec = DEFAULT_COMPRESSION_CODEC;
private Duration unusedConnectionTimeoutDuration = DEFAULT_UNUSED_CONNECTION_TIMEOUT_DURATION; private Duration unusedConnectionTimeoutDuration = DEFAULT_UNUSED_CONNECTION_TIMEOUT_DURATION;
private Builder() {} private Builder()
{
}
public Builder withNumConnections(int numConnections) public Builder withNumConnections(int numConnections)
{ {

View File

@ -45,5 +45,7 @@ public final class CloseableUtils
} }
} }
private CloseableUtils() {} private CloseableUtils()
{
}
} }

View File

@ -68,5 +68,7 @@ public final class CollectionUtils
}; };
} }
private CollectionUtils() {} private CollectionUtils()
{
}
} }

View File

@ -36,5 +36,7 @@ public final class BufferUtils
return totalMemoryUsed; return totalMemoryUsed;
} }
private BufferUtils() {} private BufferUtils()
{
}
} }

View File

@ -69,16 +69,24 @@ public class CustomEmitterFactoryTest
} }
@Override @Override
public void start() {} public void start()
{
}
@Override @Override
public void emit(Event event) {} public void emit(Event event)
{
}
@Override @Override
public void flush() {} public void flush()
{
}
@Override @Override
public void close() {} public void close()
{
}
} }
@Test @Test

View File

@ -30,7 +30,9 @@ public final class EmptyIntIterator implements IntSet.IntIterator
return INSTANCE; return INSTANCE;
} }
private EmptyIntIterator() {} private EmptyIntIterator()
{
}
@Override @Override
public boolean hasNext() public boolean hasNext()

View File

@ -27,7 +27,9 @@ public class ConciseBitMapFactory implements BitMapFactory
{ {
private static final BitmapFactory bitmapFactory = new ConciseBitmapFactory(); private static final BitmapFactory bitmapFactory = new ConciseBitmapFactory();
public ConciseBitMapFactory() {} public ConciseBitMapFactory()
{
}
@Override @Override
public MutableBitmap makeEmptyMutableBitmap() public MutableBitmap makeEmptyMutableBitmap()

View File

@ -27,7 +27,9 @@ public class JavaBitMapFactory implements BitMapFactory
{ {
private static final BitmapFactory bitmapFactory = new BitSetBitmapFactory(); private static final BitmapFactory bitmapFactory = new BitSetBitmapFactory();
public JavaBitMapFactory() {} public JavaBitMapFactory()
{
}
@Override @Override
public MutableBitmap makeEmptyMutableBitmap() public MutableBitmap makeEmptyMutableBitmap()

View File

@ -27,7 +27,9 @@ public class RoaringBitMapFactory implements BitMapFactory
{ {
private static final BitmapFactory bitmapFactory = new RoaringBitmapFactory(); private static final BitmapFactory bitmapFactory = new RoaringBitmapFactory();
public RoaringBitMapFactory() {} public RoaringBitMapFactory()
{
}
@Override @Override
public MutableBitmap makeEmptyMutableBitmap() public MutableBitmap makeEmptyMutableBitmap()

View File

@ -384,7 +384,9 @@ public class MovingAverageQueryTest
new ServiceEmitter("", "", null) new ServiceEmitter("", "", null)
{ {
@Override @Override
public void emit(Event event) {} public void emit(Event event)
{
}
}, },
baseClient, warehouse, retryConfig, jsonMapper, serverConfig, null, new CacheConfig() baseClient, warehouse, retryConfig, jsonMapper, serverConfig, null, new CacheConfig()
); );

View File

@ -83,7 +83,9 @@ public class StatsDEmitter implements Emitter
} }
@Override @Override
public void start() {} public void start()
{
}
@Override @Override
public void emit(Event event) public void emit(Event event)
@ -169,7 +171,9 @@ public class StatsDEmitter implements Emitter
} }
@Override @Override
public void flush() {} public void flush()
{
}
@Override @Override
public void close() public void close()

View File

@ -44,5 +44,6 @@ public class ThriftExtensionsModule implements DruidModule
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
{ } {
}
} }

View File

@ -42,7 +42,9 @@ import java.util.List;
public class AvroExtensionsModule implements DruidModule public class AvroExtensionsModule implements DruidModule
{ {
public AvroExtensionsModule() {} public AvroExtensionsModule()
{
}
@Override @Override
public List<? extends Module> getJacksonModules() public List<? extends Module> getJacksonModules()
@ -62,7 +64,8 @@ public class AvroExtensionsModule implements DruidModule
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
{ } {
}
} }
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = GsonJsonUtil.class) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = GsonJsonUtil.class)

View File

@ -31,7 +31,9 @@ public class RawInputValueExtractor implements ComplexMetricExtractor
return EXTRACTOR; return EXTRACTOR;
} }
private RawInputValueExtractor() {} private RawInputValueExtractor()
{
}
@Override @Override
public Class<?> extractedClass() public Class<?> extractedClass()

View File

@ -35,7 +35,9 @@ public class HadoopFsWrapper
{ {
private static final Logger log = new Logger(HadoopFsWrapper.class); private static final Logger log = new Logger(HadoopFsWrapper.class);
private HadoopFsWrapper() {} private HadoopFsWrapper()
{
}
/** /**
* Same as FileSystem.rename(from, to, Options.Rename). It is different from FileSystem.rename(from, to) which moves * Same as FileSystem.rename(from, to, Options.Rename). It is different from FileSystem.rename(from, to) which moves

View File

@ -44,5 +44,6 @@ public class ProtobufExtensionsModule implements DruidModule
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
{ } {
}
} }

View File

@ -25,7 +25,9 @@ package org.apache.druid.data.input.protobuf;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
public final class ProtoTestEventWrapper public final class ProtoTestEventWrapper
{ {
private ProtoTestEventWrapper() {} private ProtoTestEventWrapper()
{
}
public static void registerAllExtensions( public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry com.google.protobuf.ExtensionRegistryLite registry

View File

@ -47,5 +47,7 @@ public final class Counters
return counter.incrementAndGet(); return counter.incrementAndGet();
} }
private Counters() {} private Counters()
{
}
} }

View File

@ -30,7 +30,9 @@ import org.apache.druid.segment.realtime.RealtimeMetricsMonitor;
public class TaskRealtimeMetricsMonitorBuilder public class TaskRealtimeMetricsMonitorBuilder
{ {
private TaskRealtimeMetricsMonitorBuilder() {} private TaskRealtimeMetricsMonitorBuilder()
{
}
public static RealtimeMetricsMonitor build(Task task, FireDepartment fireDepartment) public static RealtimeMetricsMonitor build(Task task, FireDepartment fireDepartment)
{ {

View File

@ -47,7 +47,9 @@ public class TestFirehose implements Firehose
private boolean waitForClose = true; private boolean waitForClose = true;
private List<Object> seedRows; private List<Object> seedRows;
public TestFirehoseFactory() {} public TestFirehoseFactory()
{
}
public TestFirehoseFactory(boolean waitForClose, List<Object> seedRows) public TestFirehoseFactory(boolean waitForClose, List<Object> seedRows)
{ {

View File

@ -408,7 +408,9 @@ public class OverlordTest
} }
@Override @Override
public void shutdown(String taskid, String reason) {} public void shutdown(String taskid, String reason)
{
}
@Override @Override
public synchronized Collection<? extends TaskRunnerWorkItem> getRunningTasks() public synchronized Collection<? extends TaskRunnerWorkItem> getRunningTasks()

View File

@ -112,7 +112,9 @@ public class ITAppenderatorDriverRealtimeIndexTaskTest extends AbstractITRealtim
try { try {
Thread.sleep(DELAY_BETWEEN_EVENTS_SECS * 1000); Thread.sleep(DELAY_BETWEEN_EVENTS_SECS * 1000);
} }
catch (InterruptedException ex) { /* nothing */ } catch (InterruptedException ex) {
/* nothing */
}
dtLast = dt; // latest timestamp dtLast = dt; // latest timestamp
dt = DateTimes.nowUtc(); dt = DateTimes.nowUtc();
i++; i++;

View File

@ -123,7 +123,9 @@ public class ITRealtimeIndexTaskTest extends AbstractITRealtimeIndexTaskTest
try { try {
Thread.sleep(DELAY_BETWEEN_EVENTS_SECS * 1000); Thread.sleep(DELAY_BETWEEN_EVENTS_SECS * 1000);
} }
catch (InterruptedException ex) { /* nothing */ } catch (InterruptedException ex) {
/* nothing */
}
dtLast = dt; dtLast = dt;
dt = DateTimes.nowUtc(); dt = DateTimes.nowUtc();
i++; i++;

View File

@ -994,7 +994,7 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>8.14</version> <version>8.20</version>
</dependency> </dependency>
</dependencies> </dependencies>
<executions> <executions>

View File

@ -45,5 +45,7 @@ final class TopNUtils
return cursor.getOffset().clone(); return cursor.getOffset().clone();
} }
private TopNUtils() {} private TopNUtils()
{
}
} }

View File

@ -51,7 +51,9 @@ public class Capabilities
{ {
private boolean dimensionValuesSorted = false; private boolean dimensionValuesSorted = false;
private CapabilitiesBuilder() {} private CapabilitiesBuilder()
{
}
public CapabilitiesBuilder dimensionValuesSorted(boolean value) public CapabilitiesBuilder dimensionValuesSorted(boolean value)
{ {

View File

@ -51,7 +51,9 @@ public final class DimensionHandlerUtils
public static final Float ZERO_FLOAT = 0.0f; public static final Float ZERO_FLOAT = 0.0f;
public static final Long ZERO_LONG = 0L; public static final Long ZERO_LONG = 0L;
private DimensionHandlerUtils() {} private DimensionHandlerUtils()
{
}
public static final ColumnCapabilities DEFAULT_STRING_CAPABILITIES = public static final ColumnCapabilities DEFAULT_STRING_CAPABILITIES =
new ColumnCapabilitiesImpl().setType(ValueType.STRING) new ColumnCapabilitiesImpl().setType(ValueType.STRING)

View File

@ -205,5 +205,7 @@ public final class IntIteratorUtils
return IntLists.unmodifiable(integers); return IntLists.unmodifiable(integers);
} }
private IntIteratorUtils() {} private IntIteratorUtils()
{
}
} }

View File

@ -25,7 +25,9 @@ import it.unimi.dsi.fastutil.ints.IntList;
public class IntListUtils public class IntListUtils
{ {
private IntListUtils() {} private IntListUtils()
{
}
public static IntList fromTo(int from, int to) public static IntList fromTo(int from, int to)
{ {

View File

@ -40,7 +40,9 @@ public class NilColumnValueSelector implements ColumnValueSelector
return INSTANCE; return INSTANCE;
} }
private NilColumnValueSelector() {} private NilColumnValueSelector()
{
}
/** /**
* always returns 0, if {@link NullHandling#NULL_HANDLING_CONFIG_STRING} is set to true, * always returns 0, if {@link NullHandling#NULL_HANDLING_CONFIG_STRING} is set to true,

View File

@ -27,12 +27,16 @@ public class BitmapSerde
// default bitmap indices for Druid >= 0.7.x // default bitmap indices for Druid >= 0.7.x
// annotation required so Jackson doesn't get confused // annotation required so Jackson doesn't get confused
@JsonTypeName("concise") @JsonTypeName("concise")
public static class DefaultBitmapSerdeFactory extends ConciseBitmapSerdeFactory {} public static class DefaultBitmapSerdeFactory extends ConciseBitmapSerdeFactory
{
}
// default bitmap indices in Druid <= 0.6.x // default bitmap indices in Druid <= 0.6.x
@JsonTypeName("concise") @JsonTypeName("concise")
// annotation required so Jackson doesn't get confused by subclassing // annotation required so Jackson doesn't get confused by subclassing
public static class LegacyBitmapSerdeFactory extends ConciseBitmapSerdeFactory {} public static class LegacyBitmapSerdeFactory extends ConciseBitmapSerdeFactory
{
}
public static BitmapSerdeFactory createLegacyFactory() public static BitmapSerdeFactory createLegacyFactory()
{ {

View File

@ -38,7 +38,9 @@ public final class MetaSerdeHelper<T>
private final List<FieldWriter<T>> fieldWriters = new ArrayList<>(); private final List<FieldWriter<T>> fieldWriters = new ArrayList<>();
private MetaSerdeHelper() {} private MetaSerdeHelper()
{
}
public MetaSerdeHelper<T> writeInt(IntFieldWriter<T> fieldWriter) public MetaSerdeHelper<T> writeInt(IntFieldWriter<T> fieldWriter)
{ {

View File

@ -34,7 +34,9 @@ public class OffHeapMemorySegmentWriteOutMediumFactory implements SegmentWriteOu
return INSTANCE; return INSTANCE;
} }
private OffHeapMemorySegmentWriteOutMediumFactory() {} private OffHeapMemorySegmentWriteOutMediumFactory()
{
}
@Override @Override
public SegmentWriteOutMedium makeSegmentWriteOutMedium(File outDir) public SegmentWriteOutMedium makeSegmentWriteOutMedium(File outDir)

View File

@ -34,7 +34,9 @@ public final class TmpFileSegmentWriteOutMediumFactory implements SegmentWriteOu
return INSTANCE; return INSTANCE;
} }
private TmpFileSegmentWriteOutMediumFactory() {} private TmpFileSegmentWriteOutMediumFactory()
{
}
@Override @Override
public SegmentWriteOutMedium makeSegmentWriteOutMedium(File outDir) throws IOException public SegmentWriteOutMedium makeSegmentWriteOutMedium(File outDir) throws IOException

View File

@ -258,7 +258,9 @@ public class ConcurrentGrouperTest
} }
@Override @Override
public void reset() {} public void reset()
{
}
}; };
} }

View File

@ -39,5 +39,7 @@ public final class RowIteratorHelper
} }
} }
private RowIteratorHelper() {} private RowIteratorHelper()
{
}
} }

View File

@ -98,10 +98,14 @@ public class NoopSupervisorSpec implements SupervisorSpec
return new Supervisor() return new Supervisor()
{ {
@Override @Override
public void start() {} public void start()
{
}
@Override @Override
public void stop(boolean stopGracefully) {} public void stop(boolean stopGracefully)
{
}
@Override @Override
public SupervisorReport getStatus() public SupervisorReport getStatus()
@ -110,7 +114,9 @@ public class NoopSupervisorSpec implements SupervisorSpec
} }
@Override @Override
public void reset(DataSourceMetadata dataSourceMetadata) {} public void reset(DataSourceMetadata dataSourceMetadata)
{
}
@Override @Override
public void checkpoint( public void checkpoint(

View File

@ -39,10 +39,14 @@ public class NoopSegmentHandoffNotifierFactory implements SegmentHandoffNotifier
} }
@Override @Override
public void start() {} public void start()
{
}
@Override @Override
public void close() {} public void close()
{
}
}; };
@Override @Override

View File

@ -317,7 +317,8 @@ public class CuratorLoadQueuePeon extends LoadQueuePeon
@Override @Override
public void start() public void start()
{ } {
}
@Override @Override
public void stop() public void stop()

View File

@ -53,5 +53,7 @@ class SegmentCompactorUtil
return new Interval(largeInterval.getStart(), smallInterval.getStart()); return new Interval(largeInterval.getStart(), smallInterval.getStart());
} }
private SegmentCompactorUtil() {} private SegmentCompactorUtil()
{
}
} }

View File

@ -40,5 +40,7 @@ public class Rules
} }
} }
private Rules() {} private Rules()
{
}
} }

View File

@ -50,7 +50,9 @@ public class RedirectFilter implements Filter
} }
@Override @Override
public void init(FilterConfig filterConfig) {} public void init(FilterConfig filterConfig)
{
}
@Override @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
@ -85,5 +87,7 @@ public class RedirectFilter implements Filter
} }
@Override @Override
public void destroy() {} public void destroy()
{
}
} }

View File

@ -37,7 +37,9 @@ public final class DefaultRequestLogEventBuilderFactory implements RequestLogEve
return INSTANCE; return INSTANCE;
} }
private DefaultRequestLogEventBuilderFactory() {} private DefaultRequestLogEventBuilderFactory()
{
}
@Override @Override
public ServiceEventBuilder<RequestLogEvent> createRequestLogEventBuilder(String feed, RequestLogLine requestLogLine) public ServiceEventBuilder<RequestLogEvent> createRequestLogEventBuilder(String feed, RequestLogLine requestLogLine)

View File

@ -31,7 +31,11 @@ public interface RequestLogger
void logSqlQuery(RequestLogLine requestLogLine) throws IOException; void logSqlQuery(RequestLogLine requestLogLine) throws IOException;
default void start() throws Exception {} default void start() throws Exception
{
default void stop() {} }
default void stop()
{
}
} }

View File

@ -115,5 +115,7 @@ public final class CachingClusteredClientTestUtils
return objectMapper; return objectMapper;
} }
private CachingClusteredClientTestUtils() {} private CachingClusteredClientTestUtils()
{
}
} }

View File

@ -35,7 +35,9 @@ import org.junit.runner.RunWith;
@RunWith(EasyMockRunner.class) @RunWith(EasyMockRunner.class)
public class ServiceAnnouncingChatHandlerProviderTest extends EasyMockSupport public class ServiceAnnouncingChatHandlerProviderTest extends EasyMockSupport
{ {
private static class TestChatHandler implements ChatHandler {} private static class TestChatHandler implements ChatHandler
{
}
private static final String TEST_SERVICE_NAME = "test-service-name"; private static final String TEST_SERVICE_NAME = "test-service-name";
private static final String TEST_HOST = "test-host"; private static final String TEST_HOST = "test-host";

View File

@ -472,9 +472,13 @@ public class AsyncManagementForwardingServletTest extends BaseJettyTest
} }
@Override @Override
public void registerListener(Listener listener) {} public void registerListener(Listener listener)
{
}
@Override @Override
public void unregisterListener() {} public void unregisterListener()
{
}
} }
} }

View File

@ -30,5 +30,7 @@ public class NoopServiceEmitter extends ServiceEmitter
} }
@Override @Override
public void emit(Event event) {} public void emit(Event event)
{
}
} }

View File

@ -96,7 +96,9 @@ public abstract class ServerRunnable extends GuiceRunnable
*/ */
protected static class DiscoverySideEffectsProvider implements Provider<DiscoverySideEffectsProvider.Child> protected static class DiscoverySideEffectsProvider implements Provider<DiscoverySideEffectsProvider.Child>
{ {
public static class Child {} public static class Child
{
}
public static class Builder public static class Builder
{ {