From c3a6e8fa21c046054996befb1effc831fc651bf6 Mon Sep 17 00:00:00 2001 From: Christopher Gross cogross Date: Mon, 5 Feb 2024 15:52:08 +0000 Subject: [PATCH] fix build warning messages --- pom.xml | 4 +- warehouse/accumulo-extensions/pom.xml | 2 +- .../datawave/common/util/MultiComparator.java | 3 ++ .../data/hash/AbstractUIDBuilder.java | 2 +- .../java/datawave/data/hash/SnowflakeUID.java | 1 - .../src/main/java/datawave/data/hash/UID.java | 2 + .../java/datawave/edge/protobuf/EdgeData.java | 8 +-- .../util/cache/ReloadableCacheBuilder.java | 11 ++-- .../iterators/filter/TokenSpecParser.java | 3 +- .../iterators/filter/ageoff/AppliedRule.java | 4 +- .../datawave/mr/bulk/BulkInputFormat.java | 4 +- .../mr/bulk/BulkIteratorEnvironment.java | 4 ++ .../java/datawave/util/ObjectFactory.java | 4 +- .../datawave/data/hash/SnowflakeUIDTest.java | 2 +- .../test/java/datawave/data/hash/UIDTest.java | 8 +++ .../edge/util/EdgeValueHelperTest.java | 2 +- .../protobuf/TermWeightPositionTest.java | 2 +- .../watch/FileRuleDataTypeMergeTest.java | 18 +++---- .../cache/watch/FileRuleFieldMergeTest.java | 10 ++-- .../FileRuleLoadContentsMergeFiltersTest.java | 22 ++++---- .../filter/ColumnVisibilityLabeledFilter.java | 2 +- .../filter/ConfigurableAgeOffFilterTest.java | 54 +++++++++---------- .../iterators/filter/TokenTtlTrieTest.java | 2 +- .../filter/ageoff/FieldAgeOffFilterTest.java | 5 -- .../datawave/util/cli/AccumuloArgsTest.java | 25 +++++---- .../util/cli/PasswordConverterTest.java | 15 +++--- .../mapreduce/shardStats/MockMapDriver.java | 2 +- .../main/java/datawave/ingest/data/Type.java | 6 ++- .../data/config/ingest/CompositeIngest.java | 1 + .../data/config/ingest/IngestFieldFilter.java | 3 +- .../data/config/ingest/VirtualIngest.java | 1 + .../datawave/ingest/data/hash/StringUID.java | 1 + .../data/tokenize/TokenizationHelper.java | 3 +- .../ingest/mapreduce/EventMapper.java | 6 +-- .../mapreduce/handler/facet/FacetHandler.java | 5 +- .../mapreduce/job/ConstraintChecker.java | 5 +- .../ingest/mapreduce/job/IngestJob.java | 4 +- .../job/MultiRFileOutputFormatter.java | 4 +- .../mapreduce/job/PartitionerCache.java | 2 +- .../mapreduce/job/TableConfigurationUtil.java | 8 +-- .../job/TablePartitionerOffsets.java | 1 + .../job/metrics/MetricsConfiguration.java | 2 +- .../writer/AbstractChainedContextWriter.java | 2 +- .../iterators/StatsLinksEdgeCombiner.java | 2 +- .../ingest/mapreduce/EventMapperTest.java | 2 +- .../mapreduce/SimpleDataTypeHelper.java | 2 +- .../ingest/mapreduce/TablePropertiesMap.java | 2 + .../CounterToStatsDConfigurationTest.java | 1 + .../partition/LimitedKeyPartitionerTest.java | 8 +-- .../LocalityGroupPartitionerTest.java | 2 +- .../partition/RowHashingPartitionerTest.java | 4 +- .../csv/TableConfigurationUtilTest.java | 6 +-- ...tentCSVIndexingColumnBasedHandlerTest.java | 4 +- .../config/helper/JsonDataTypeHelper.java | 4 +- .../config/helper/JsonIngestFlattener.java | 3 +- .../json/config/helper/JsonIngestHelper.java | 3 +- .../json/mr/input/JsonRecordReader.java | 3 +- .../helper/JsonIngestFlattenerTest.java | 6 +-- .../ContentJsonColumnBasedHandlerTest.java | 4 +- .../util/JsonObjectFlattenerImplTest.java | 33 ++++-------- .../wikipedia/WikipediaDataTypeHandler.java | 2 +- .../wikipedia/WikipediaIngestHelper.java | 1 - .../metrics/mapreduce/MetricsIngester.java | 3 +- .../validation/AccumuloIndexAgeDisplay.java | 15 +++--- warehouse/pom.xml | 12 ++--- .../core/iterators/ColumnRangeIterator.java | 1 + .../DatawaveFieldIndexListIteratorJexl.java | 7 ++- .../core/iterators/EnrichingIterator.java | 6 ++- .../querylock/ZookeeperQueryLock.java | 1 + .../query/attributes/AttributeFactory.java | 2 +- .../datawave/query/attributes/Attributes.java | 4 +- .../datawave/query/attributes/Document.java | 4 +- .../query/attributes/ExcerptFields.java | 2 + .../datawave/query/attributes/Metadata.java | 4 +- .../query/attributes/TimingMetadata.java | 1 + .../query/attributes/UniqueFields.java | 3 ++ .../query/common/grouping/GroupFields.java | 1 + .../query/common/grouping/Grouping.java | 1 + .../common/grouping/GroupingAttribute.java | 1 + .../common/grouping/ImmutableGrouping.java | 1 + .../query/composite/CompositeUtils.java | 2 +- .../DiscoveryQueryConfiguration.java | 1 + .../BooleanLogicFatalQueryException.java | 1 + .../exceptions/FieldNotMutableException.java | 1 + .../exceptions/InvalidQueryTreeException.java | 1 + .../exceptions/LoadAverageWatchException.java | 2 +- .../datawave/query/function/LimitFields.java | 3 +- .../query/iterator/CloseableListIterable.java | 1 + .../datawave/query/iterator/QueryOptions.java | 4 +- .../query/jexl/DatawaveInterpreter.java | 5 +- .../jexl/functions/EventFieldAggregator.java | 2 +- .../JexlFunctionNamespaceRegistry.java | 5 +- .../query/jexl/lookups/IndexLookupMap.java | 1 + .../visitors/BaseIndexExpansionVisitor.java | 1 + .../whindex/DistributeAndedNodesVisitor.java | 1 + .../builder/jexl/JexlTreeBuilder.java | 2 +- .../parser/lucene/AccumuloSyntaxParser.java | 4 +- .../language/parser/lucene/TokenMgrError.java | 2 + .../query/model/edge/EdgeQueryModel.java | 1 + .../SortedKeyValueIteratorToIterator.java | 1 + .../query/util/cache/DatatypeLoader.java | 2 +- .../util/cache/NormalizerConfigLoader.java | 5 +- .../query/util/cache/NormalizerLoader.java | 2 +- .../query/util/ssdeep/NGramScoreTuple.java | 1 + .../query/RebuildingScannerTestHelper.java | 7 ++- .../edge/ExtendedEdgeQueryLogicTest.java | 2 +- .../query/iterator/CommaFreeType.java | 3 ++ .../visitors/ExpandCompositeTermsTest.java | 1 + .../predicate/DocumentKeyToFieldNameTest.java | 1 + .../AbstractFunctionalQuery.java | 4 +- .../query/testframework/RawDataManager.java | 2 +- .../query/util/CompositeTestingIngest.java | 2 + .../query/util/MockMetadataHelper.java | 4 +- .../util/ssdeep/ChunkSizeEncoding.java | 2 + .../datawave/util/ssdeep/IntegerEncoding.java | 2 + .../datawave/util/ssdeep/NGramGenerator.java | 2 + .../java/datawave/util/ssdeep/NGramTuple.java | 2 + .../datawave/util/ssdeep/SSDeepEncoding.java | 2 + .../java/datawave/util/ssdeep/SSDeepHash.java | 2 + .../ssdeep/SSDeepHashEditDistanceScorer.java | 11 +++- .../util/ssdeep/SSDeepParseException.java | 3 ++ web-services/atom/pom.xml | 9 ++-- .../atom/AtomKeyValueParserTest.java | 54 ++++++------------- .../results/cached/CachedResultsBean.java | 11 ++-- .../results/cached/CachedRunningQuery.java | 11 ++-- .../modification/ModificationEventBase.java | 2 +- .../datawave/webservice/query/QueryImpl.java | 3 +- .../webservice/query/QueryMessages.java | 6 +-- .../query/exception/ExceptionMessages.java | 2 +- .../webservice/query/map/QueryGeometry.java | 2 + .../query/result/EdgeQueryResponseBase.java | 2 + .../query/result/event/FacetsBase.java | 1 + .../result/EventQueryResponseBase.java | 2 + .../result/FacetQueryResponseBase.java | 1 + .../result/MetadataQueryResponseBase.java | 1 + .../result/QueryImplListResponse.java | 23 ++++---- .../result/QueryWizardResultResponse.java | 12 ++--- .../webservice/result/ResponseMessages.java | 20 +++---- .../results/ingest/file/FileDetails.java | 2 + .../query/data/ObjectSizeOfTest.java | 18 +++---- .../configuration/ConfigExtension.java | 2 +- .../authorization/DatawavePrincipal.java | 2 + .../authorization/UserOperations.java | 4 +- .../CreateQuerySessionIDFilterTest.java | 7 ++- .../util/WSAuthorizationsUtilTest.java | 11 ++-- .../metrics/MetricsCdiConfiguration.java | 5 +- .../datawave/webservice/mr/MapReduceBean.java | 4 +- .../map/BulkResultsFileOutputMapper.java | 6 ++- .../QueryResponseMessageJsonEncoder.java | 5 +- .../messages/CreateQueryMessage.java | 2 +- .../query/exception/EmptyObjectException.java | 2 +- .../webservice/query/logic/QueryLogic.java | 2 +- .../composite/CompositeLogicException.java | 2 + .../CompositeQueryConfiguration.java | 1 + .../query/metric/QueryMetricsWriter.java | 9 ++-- .../query/runner/QueryPredictor.java | 1 + .../util/AbstractUUIDLookupCriteria.java | 2 +- .../webservice/query/util/LookupUUIDUtil.java | 3 +- .../composite/CompositeQueryLogicTest.java | 1 + .../runner/ExtendedQueryExecutorBeanTest.java | 7 ++- .../query/runner/QueryExecutorBeanTest.java | 6 +-- .../query/runner/RunningQueryTest.java | 4 +- .../auth/DatawaveAuthenticationMechanism.java | 2 + .../ConditionalRemoteUserOperationsTest.java | 2 +- 164 files changed, 456 insertions(+), 357 deletions(-) diff --git a/pom.xml b/pom.xml index d6c1cfd118e..03b63022588 100644 --- a/pom.xml +++ b/pom.xml @@ -2039,9 +2039,9 @@ clover - com.cenqua.clover + org.openclover clover - RELEASE + 4.5.1 diff --git a/warehouse/accumulo-extensions/pom.xml b/warehouse/accumulo-extensions/pom.xml index 80fa451539b..50c0adf75b8 100644 --- a/warehouse/accumulo-extensions/pom.xml +++ b/warehouse/accumulo-extensions/pom.xml @@ -60,7 +60,7 @@ clover - com.cenqua.clover + org.openclover clover diff --git a/warehouse/common/src/main/java/datawave/common/util/MultiComparator.java b/warehouse/common/src/main/java/datawave/common/util/MultiComparator.java index 30df7836a6d..22716abf13d 100644 --- a/warehouse/common/src/main/java/datawave/common/util/MultiComparator.java +++ b/warehouse/common/src/main/java/datawave/common/util/MultiComparator.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; public class MultiComparator implements Comparator, Serializable { @@ -15,6 +16,8 @@ public MultiComparator(Collection> comparators) { this.comparators = comparators; } + @SafeVarargs + @SuppressWarnings("varargs") public MultiComparator(Comparator... comparators) { this((comparators != null && comparators.length > 0) ? Arrays.asList(comparators) : new ArrayList<>()); } diff --git a/warehouse/core/src/main/java/datawave/data/hash/AbstractUIDBuilder.java b/warehouse/core/src/main/java/datawave/data/hash/AbstractUIDBuilder.java index 00263d6fe1d..e3c057f71cd 100644 --- a/warehouse/core/src/main/java/datawave/data/hash/AbstractUIDBuilder.java +++ b/warehouse/core/src/main/java/datawave/data/hash/AbstractUIDBuilder.java @@ -130,7 +130,7 @@ public UID_TYPE newId(final UID template, final String... extras) { } else if (template.getClass() == SnowflakeUID.class) { validatedTemplate = template; } else { - validatedTemplate = template.parse(template.toString()); + validatedTemplate = UID.parse(template.toString()); } } else { validatedTemplate = null; diff --git a/warehouse/core/src/main/java/datawave/data/hash/SnowflakeUID.java b/warehouse/core/src/main/java/datawave/data/hash/SnowflakeUID.java index b5df2904da2..0b4fe9af872 100644 --- a/warehouse/core/src/main/java/datawave/data/hash/SnowflakeUID.java +++ b/warehouse/core/src/main/java/datawave/data/hash/SnowflakeUID.java @@ -5,7 +5,6 @@ import java.io.DataInput; import java.io.IOException; -import java.io.Serializable; import java.math.BigInteger; import org.apache.commons.lang.builder.CompareToBuilder; diff --git a/warehouse/core/src/main/java/datawave/data/hash/UID.java b/warehouse/core/src/main/java/datawave/data/hash/UID.java index 6782f4a8616..2f4a6d90df6 100644 --- a/warehouse/core/src/main/java/datawave/data/hash/UID.java +++ b/warehouse/core/src/main/java/datawave/data/hash/UID.java @@ -43,6 +43,8 @@ public abstract class UID implements Comparable, Comparator, Writable, private static final Logger LOGGER = Logger.getLogger(UID.class); + private static final long serialVersionUID = 0L; + protected static final String[] EMPTY_EXTRAS = {}; protected static final String NULL = "" + null; protected static final int RADIX = Character.MAX_RADIX; diff --git a/warehouse/core/src/main/java/datawave/edge/protobuf/EdgeData.java b/warehouse/core/src/main/java/datawave/edge/protobuf/EdgeData.java index c354aa8c834..b72a01d9dfa 100644 --- a/warehouse/core/src/main/java/datawave/edge/protobuf/EdgeData.java +++ b/warehouse/core/src/main/java/datawave/edge/protobuf/EdgeData.java @@ -1466,15 +1466,15 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io output.writeInt64(1, count_); } if (getHoursList().size() > 0) { - output.writeRawVarint32(18); - output.writeRawVarint32(hoursMemoizedSerializedSize); + output.writeUInt32NoTag(18); + output.writeUInt32NoTag(hoursMemoizedSerializedSize); } for (int i = 0; i < hours_.size(); i++) { output.writeInt64NoTag(hours_.get(i)); } if (getDurationList().size() > 0) { - output.writeRawVarint32(26); - output.writeRawVarint32(durationMemoizedSerializedSize); + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(durationMemoizedSerializedSize); } for (int i = 0; i < duration_.size(); i++) { output.writeInt64NoTag(duration_.get(i)); diff --git a/warehouse/core/src/main/java/datawave/ingest/util/cache/ReloadableCacheBuilder.java b/warehouse/core/src/main/java/datawave/ingest/util/cache/ReloadableCacheBuilder.java index b91eb838983..c75bef74e79 100644 --- a/warehouse/core/src/main/java/datawave/ingest/util/cache/ReloadableCacheBuilder.java +++ b/warehouse/core/src/main/java/datawave/ingest/util/cache/ReloadableCacheBuilder.java @@ -16,9 +16,9 @@ * Description: Keys consist of objects that are Reloadable, which identify if their underlying value has changed and enable it to reload the value * * Justification: Based upon Loader, which is further based upon CacheLoader. This enables us to have customized techniques for loading GUAVA caches, and - * reloading this elements when necessary + * reloading these elements when necessary */ -public class ReloadableCacheBuilder extends Loader { +public class ReloadableCacheBuilder,V> extends Loader { private static final Logger log = Logger.getLogger(ReloadableCacheBuilder.class); @@ -62,6 +62,7 @@ public ListenableFuture reload(K key, V oldValue) { * @see datawave.ingest.util.cache.Loader#build(java.lang.Object) */ @Override + @SuppressWarnings("unchecked") protected void build(K key) throws Exception { if (null == key) { @@ -69,7 +70,7 @@ protected void build(K key) throws Exception { log.trace("Rebuild all"); Collection watchers = entryCache.keySet(); for (K keyWatcher : watchers) { - Reloadable watcher = Reloadable.class.cast(keyWatcher); + Reloadable watcher = (Reloadable) keyWatcher; if (log.isTraceEnabled()) log.trace("rebuild " + watcher + " ? " + watcher.hasChanged()); @@ -78,13 +79,13 @@ protected void build(K key) throws Exception { if (log.isTraceEnabled()) log.trace("rebuild " + watcher + " ? " + watcher.hasChanged() + " " + watcher.reload()); - entryCache.put(keyWatcher, (V) watcher.reload()); + entryCache.put(keyWatcher, watcher.reload()); } } } } else { - Reloadable watcher = Reloadable.class.cast(key); + Reloadable watcher = (Reloadable) key; synchronized (entryCache) { entryCache.put(key, (V) watcher.reload()); } diff --git a/warehouse/core/src/main/java/datawave/iterators/filter/TokenSpecParser.java b/warehouse/core/src/main/java/datawave/iterators/filter/TokenSpecParser.java index a46c0893109..923c901a907 100644 --- a/warehouse/core/src/main/java/datawave/iterators/filter/TokenSpecParser.java +++ b/warehouse/core/src/main/java/datawave/iterators/filter/TokenSpecParser.java @@ -28,6 +28,7 @@ public abstract class TokenSpecParser { * * @return TokenSpecParser child object */ + @SuppressWarnings("unchecked") public B parse(String configuration) { ParserState parser = new ParserState(configuration); parser.parseTo(this); @@ -176,7 +177,7 @@ protected String expect(ParseTokenType type) { * @param builder * token spec parser */ - protected void parseTo(TokenSpecParser builder) { + protected void parseTo(TokenSpecParser builder) { ParseToken initialToken; while ((initialToken = peek()) != null) { String tokenStr = parseStrliteral(); diff --git a/warehouse/core/src/main/java/datawave/iterators/filter/ageoff/AppliedRule.java b/warehouse/core/src/main/java/datawave/iterators/filter/ageoff/AppliedRule.java index 18919877b2f..a0e3b67ff39 100644 --- a/warehouse/core/src/main/java/datawave/iterators/filter/ageoff/AppliedRule.java +++ b/warehouse/core/src/main/java/datawave/iterators/filter/ageoff/AppliedRule.java @@ -130,7 +130,7 @@ public FilterRule deepCopy(AgeOffPeriod period, IteratorEnvironment iterEnv) { public FilterRule deepCopy(long scanStart, IteratorEnvironment iterEnv) { AppliedRule newFilter; try { - newFilter = (AppliedRule) super.getClass().newInstance(); + newFilter = (AppliedRule) super.getClass().getDeclaredConstructor().newInstance(); FilterOptions newOptions = new FilterOptions(currentOptions); newOptions.setOption(AgeOffConfigParams.SCAN_START_TIMESTAMP, Long.toString(scanStart)); newFilter.iterEnv = iterEnv; @@ -139,7 +139,7 @@ public FilterRule deepCopy(long scanStart, IteratorEnvironment iterEnv) { newFilter.ageOffPeriod = new AgeOffPeriod(scanStart, currentOptions.ttl, currentOptions.ttlUnits); log.trace("Age off is " + newFilter.ageOffPeriod.getCutOffMilliseconds()); return newFilter; - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { log.error(e); } return null; diff --git a/warehouse/core/src/main/java/datawave/mr/bulk/BulkInputFormat.java b/warehouse/core/src/main/java/datawave/mr/bulk/BulkInputFormat.java index 4370cd6099d..b4ae971f111 100644 --- a/warehouse/core/src/main/java/datawave/mr/bulk/BulkInputFormat.java +++ b/warehouse/core/src/main/java/datawave/mr/bulk/BulkInputFormat.java @@ -1060,8 +1060,8 @@ protected static LocationStrategy getLocationStrategy(Configuration conf) { try { Class clazz = Class.forName(conf.get(RACKSTRATEGY, DefaultLocationStrategy.class.getCanonicalName())) .asSubclass(LocationStrategy.class); - return clazz.newInstance(); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { + return clazz.getDeclaredConstructor().newInstance(); + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) { log.error(e); } return new DefaultLocationStrategy(); diff --git a/warehouse/core/src/main/java/datawave/mr/bulk/BulkIteratorEnvironment.java b/warehouse/core/src/main/java/datawave/mr/bulk/BulkIteratorEnvironment.java index e053efc798a..372224b2844 100644 --- a/warehouse/core/src/main/java/datawave/mr/bulk/BulkIteratorEnvironment.java +++ b/warehouse/core/src/main/java/datawave/mr/bulk/BulkIteratorEnvironment.java @@ -26,6 +26,7 @@ public BulkIteratorEnvironment(IteratorScope scope) { } @Override + @Deprecated public AccumuloConfiguration getConfig() { return conf; } @@ -46,6 +47,7 @@ public boolean isUserCompaction() { } @Override + @Deprecated public void registerSideChannel(SortedKeyValueIterator iter) { throw new UnsupportedOperationException(); } @@ -71,12 +73,14 @@ public SamplerConfiguration getSamplerConfiguration() { } @Override + @Deprecated public SortedKeyValueIterator reserveMapFileReader(String mapFileName) throws IOException { // TODO Auto-generated method stub return null; } @Override + @Deprecated public ServiceEnvironment getServiceEnv() { return null; } diff --git a/warehouse/core/src/main/java/datawave/util/ObjectFactory.java b/warehouse/core/src/main/java/datawave/util/ObjectFactory.java index db8e2bfc982..0800a4653db 100644 --- a/warehouse/core/src/main/java/datawave/util/ObjectFactory.java +++ b/warehouse/core/src/main/java/datawave/util/ObjectFactory.java @@ -49,7 +49,7 @@ public static Object create(String className, Object... args) { // Look for exact match try { - constructor = clazz.getConstructor(types.toArray(new Class[0])); + constructor = clazz.getConstructor(types.toArray(new Class[0])); } catch (NoSuchMethodException e) { logger.debug("No constructor for [" + className + "] in ObjectFactory.create())"); } @@ -59,7 +59,7 @@ public static Object create(String className, Object... args) { Constructor[] constructors = clazz.getConstructors(); for (int i = 0; i < constructors.length && constructor == null; i++) { Constructor c = constructors[i]; - Class ctypes[] = c.getParameterTypes(); + Class[] ctypes = c.getParameterTypes(); if (logger.isDebugEnabled()) { logger.debug("Checking:" + className + ", " + clazz); diff --git a/warehouse/core/src/test/java/datawave/data/hash/SnowflakeUIDTest.java b/warehouse/core/src/test/java/datawave/data/hash/SnowflakeUIDTest.java index 5e729ee1bc4..f7a638a77f0 100644 --- a/warehouse/core/src/test/java/datawave/data/hash/SnowflakeUIDTest.java +++ b/warehouse/core/src/test/java/datawave/data/hash/SnowflakeUIDTest.java @@ -74,7 +74,7 @@ public void testBuilder() throws ParseException { SnowflakeUIDBuilder result1 = (SnowflakeUIDBuilder) ((UIDBuilder) SnowflakeUID.builder()); assertNotNull(result1); assertNotNull(result1.toString()); - assertNull(((SnowflakeUID) result1.newId()).getSnowflake()); + assertNull((result1.newId()).getSnowflake()); assertNull(result1.newId(0).getSnowflake()); assertNull(result1.newId(System.currentTimeMillis(), 0).getSnowflake()); assertNull(result1.newId(System.currentTimeMillis()).getSnowflake()); diff --git a/warehouse/core/src/test/java/datawave/data/hash/UIDTest.java b/warehouse/core/src/test/java/datawave/data/hash/UIDTest.java index 70a3a7fecbe..ae56914f6ef 100644 --- a/warehouse/core/src/test/java/datawave/data/hash/UIDTest.java +++ b/warehouse/core/src/test/java/datawave/data/hash/UIDTest.java @@ -477,10 +477,13 @@ public void testMiscellaneous() { * Test subclass akin to the StringUID */ private static class CustomHashUID extends HashUID { + private static final long serialVersionUID = 0L; + public CustomHashUID(HashUID template, String... extras) { super(template, extras); } + @SuppressWarnings("unchecked") public static HashUID parse(String s) { HashUID hashUid = HashUID.parse(s); if (null != hashUid) { @@ -495,10 +498,13 @@ public static HashUID parse(String s) { * Another test subclass akin to the StringUID */ private static class CustomSnowflakeUID extends SnowflakeUID { + private static final long serialVersionUID = 0L; + public CustomSnowflakeUID(SnowflakeUID template, String... extras) { super(template, extras); } + @SuppressWarnings("unchecked") public static SnowflakeUID parse(String s) { SnowflakeUID hashUid = SnowflakeUID.parse(s); if (null != hashUid) { @@ -510,6 +516,8 @@ public static SnowflakeUID parse(String s) { } private class TestUID extends UID { + private static final long serialVersionUID = 0L; + public TestUID(String prefix, boolean isPrefixOptional, String... extras) { super(prefix, isPrefixOptional, extras); } diff --git a/warehouse/core/src/test/java/datawave/edge/util/EdgeValueHelperTest.java b/warehouse/core/src/test/java/datawave/edge/util/EdgeValueHelperTest.java index 3db11340345..5dd691e1408 100644 --- a/warehouse/core/src/test/java/datawave/edge/util/EdgeValueHelperTest.java +++ b/warehouse/core/src/test/java/datawave/edge/util/EdgeValueHelperTest.java @@ -256,7 +256,7 @@ public void testReadOldActivity() { fail("Failed to encode variable length long array: " + e.getMessage()); } List oldAsList = EdgeValueHelper.decodeActivityHistogram(new Value(oldBytes)); - assertEquals(new Long(1l), oldAsList.get(6)); + assertEquals(Long.valueOf(1l), oldAsList.get(6)); } private static final Value NULL_VALUE = new Value(new byte[0]); diff --git a/warehouse/core/src/test/java/datawave/ingest/protobuf/TermWeightPositionTest.java b/warehouse/core/src/test/java/datawave/ingest/protobuf/TermWeightPositionTest.java index 6a8d3b48b77..88605cd799a 100644 --- a/warehouse/core/src/test/java/datawave/ingest/protobuf/TermWeightPositionTest.java +++ b/warehouse/core/src/test/java/datawave/ingest/protobuf/TermWeightPositionTest.java @@ -123,7 +123,7 @@ public void testBuilderReset() { @Test public void testPositionScoreToTermWeightScore() { - Float positionScore = new Float(-.0552721); + Float positionScore = Float.valueOf(-.0552721F); Integer twScore = TermWeightPosition.positionScoreToTermWeightScore(positionScore); Float result = TermWeightPosition.termWeightScoreToPositionScore(twScore); diff --git a/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleDataTypeMergeTest.java b/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleDataTypeMergeTest.java index 242f2ad35f4..bde01066a02 100644 --- a/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleDataTypeMergeTest.java +++ b/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleDataTypeMergeTest.java @@ -1,8 +1,6 @@ package datawave.ingest.util.cache.watch; -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import java.io.IOException; import java.util.Collection; @@ -54,22 +52,22 @@ public void verifyOverridenValues() throws IOException { // // verify original values - assertThat(parentFilter.options.getOption("foo.ttl"), is("600")); - assertThat(parentFilter.options.getOption("bar.ttl"), is("500")); - assertThat(parentFilter.options.getOption("baz.ttl"), is("400")); + assertEquals(parentFilter.options.getOption("foo.ttl"), "600"); + assertEquals(parentFilter.options.getOption("bar.ttl"), "500"); + assertEquals(parentFilter.options.getOption("baz.ttl"), "400"); // check overrides - assertThat(childFilter.options.getOption("bar.ttl"), is("500")); - assertThat(childFilter.options.getOption("baz.ttl"), is("400")); + assertEquals(childFilter.options.getOption("bar.ttl"), "500"); + assertEquals(childFilter.options.getOption("baz.ttl"), "400"); // these are overridden - assertThat(childFilter.options.getOption("foo.ttl"), is("123")); - assertThat(childFilter.options.getOption("zip.ttl"), is("123")); + assertEquals(childFilter.options.getOption("foo.ttl"), "123"); + assertEquals(childFilter.options.getOption("zip.ttl"), "123"); } private static FilterRule loadRulesFromFile(FileRuleWatcher watcher, FileSystem fs, Path filePath) throws IOException { Collection rules = watcher.loadContents(fs.open(filePath)); // should only have the single rule - assertThat(rules.size(), is(1)); + assertEquals(rules.size(), 1); for (FilterRule rule : rules) { assertEquals(TestDataTypeFilter.class, rule.getClass()); } diff --git a/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleFieldMergeTest.java b/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleFieldMergeTest.java index 808e9b0778a..5ab722b6ebe 100644 --- a/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleFieldMergeTest.java +++ b/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleFieldMergeTest.java @@ -41,9 +41,9 @@ public void before() throws IOException { @Test public void verifyIsIndexOnlyForChild() throws IOException { - assertThat(isIndexTable(parentFilter), is(false)); + assertEquals(isIndexTable(parentFilter), false); - assertThat(isIndexTable(childFilter), is(true)); + assertEquals(isIndexTable(childFilter), true); } @Test @@ -52,10 +52,10 @@ public void verifyInheritedParentConfigs() throws IOException { // alpha,beta,gamma,delta // since child is index config, field should be in the column family Key key = new Key("row", "alpha", "cq", "vis", 0); - assertThat(childFilter.accept(key, new Value()), is(false)); + assertEquals(childFilter.accept(key, new Value()), false); key = new Key("row", "beta", "cq", "vis", Long.MAX_VALUE); - assertThat(childFilter.accept(key, new Value()), is(true)); + assertEquals(childFilter.accept(key, new Value()), true); } private Boolean isIndexTable(TestFieldFilter filter) { @@ -65,7 +65,7 @@ private Boolean isIndexTable(TestFieldFilter filter) { private static FilterRule loadRulesFromFile(FileRuleWatcher watcher, FileSystem fs, Path filePath) throws IOException { Collection rules = watcher.loadContents(fs.open(filePath)); // should only have the single rule - assertThat(rules.size(), is(1)); + assertEquals(rules.size(), 1); for (FilterRule rule : rules) { assertEquals(TestFieldFilter.class, rule.getClass()); } diff --git a/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleLoadContentsMergeFiltersTest.java b/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleLoadContentsMergeFiltersTest.java index 6e30690159e..03c236e87fb 100644 --- a/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleLoadContentsMergeFiltersTest.java +++ b/warehouse/core/src/test/java/datawave/ingest/util/cache/watch/FileRuleLoadContentsMergeFiltersTest.java @@ -2,8 +2,8 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.IOException; @@ -104,30 +104,30 @@ public void testNewConfigMaintainsOrder() throws Exception { List childRules = (List) watcher.loadContents(fs.open(childPath)); // should have one extra rule in child - assertThat(childRules.size(), is(equalTo(parentRules.size() + 1))); + assertEquals(childRules.size(), parentRules.size() + 1); // parent classes are // TestTrieFilter // TestFieldFilter // TestFilter // This order should be maintained!!!!! - assertThat(simpleName(parentRules, 0), is("TestTrieFilter")); - assertThat(simpleName(parentRules, 1), is("TestFieldFilter")); - assertThat(simpleName(parentRules, 2), is("TestFilter")); + assertEquals(simpleName(parentRules, 0), "TestTrieFilter"); + assertEquals(simpleName(parentRules, 1), "TestFieldFilter"); + assertEquals(simpleName(parentRules, 2), "TestFilter"); // verify order of filters in child matches parent for (int i = 0; i < parentRules.size(); i++) { FilterRule parent = parentRules.get(i); FilterRule child = childRules.get(i); - assertThat(child.getClass().getSimpleName(), is(equalTo(parent.getClass().getSimpleName()))); + assertEquals(child.getClass().getSimpleName(), parent.getClass().getSimpleName()); } // also verify that child inherited ttl from parent TestTrieFilter mergedParent = (TestTrieFilter) parentRules.get(0); TestTrieFilter mergedChild = (TestTrieFilter) childRules.get(0); - assertThat(mergedChild.options.getTTL(), is(equalTo(mergedParent.options.getTTL()))); - assertThat(mergedChild.options.getTTLUnits(), is(equalTo(mergedParent.options.getTTLUnits()))); + assertEquals(mergedChild.options.getTTL(), mergedParent.options.getTTL()); + assertEquals(mergedChild.options.getTTLUnits(), mergedParent.options.getTTLUnits()); } private String simpleName(List parentRules, int i) { @@ -159,8 +159,8 @@ private void verifyAppliedRule(AppliedRule filter, String data, long offsetInDay long timestamp = anchorTime - (offsetInDays * MILLIS_IN_DAY) + 1; Key key = TestTrieFilter.create(data, timestamp); // @formatter:off - assertThat(failedExpectationMessage(data, offsetInDays, expectation), - filter.accept(filterOptions.getAgeOffPeriod(anchorTime), key, value), is(expectation)); + assertEquals(failedExpectationMessage(data, offsetInDays, expectation), + filter.accept(filterOptions.getAgeOffPeriod(anchorTime), key, value), expectation); // @formatter:on } @@ -188,7 +188,7 @@ public void testTtl() { private static FilterRule loadRulesFromFile(FileRuleWatcher watcher, FileSystem fs, Path filePath, int expectedNumRules) throws IOException { Collection rules = watcher.loadContents(fs.open(filePath)); - assertThat(rules.size(), is(expectedNumRules)); + assertEquals(rules.size(), expectedNumRules); // only return the TestTrieFilter for this test Optional first = rules.stream().filter(r -> r instanceof TestTrieFilter).findFirst(); return first.get(); diff --git a/warehouse/core/src/test/java/datawave/iterators/filter/ColumnVisibilityLabeledFilter.java b/warehouse/core/src/test/java/datawave/iterators/filter/ColumnVisibilityLabeledFilter.java index c1bbff96cb4..9101cb2fe58 100644 --- a/warehouse/core/src/test/java/datawave/iterators/filter/ColumnVisibilityLabeledFilter.java +++ b/warehouse/core/src/test/java/datawave/iterators/filter/ColumnVisibilityLabeledFilter.java @@ -47,7 +47,7 @@ public void init(FilterOptions options, IteratorEnvironment iterEnv) { if (options.getOption(AgeOffConfigParams.MATCHPATTERN) != null) { String[] lines = StringUtils.split(options.getOption(AgeOffConfigParams.MATCHPATTERN), '\n'); - patternToTtl = new HashMap(lines.length); + patternToTtl = new HashMap<>(lines.length); for (String line : lines) { populateMapWithTimeToLiveValue(patternToTtl, line); } diff --git a/warehouse/core/src/test/java/datawave/iterators/filter/ConfigurableAgeOffFilterTest.java b/warehouse/core/src/test/java/datawave/iterators/filter/ConfigurableAgeOffFilterTest.java index fad857d5e55..7b55d7e9dbd 100644 --- a/warehouse/core/src/test/java/datawave/iterators/filter/ConfigurableAgeOffFilterTest.java +++ b/warehouse/core/src/test/java/datawave/iterators/filter/ConfigurableAgeOffFilterTest.java @@ -3,8 +3,8 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; import java.io.IOException; import java.net.URL; @@ -73,9 +73,9 @@ public void testAcceptKeyValue_OnlyUserMajc() throws Exception { filter.init(source, options, env); - assertThat(filter.accept(new Key(), VALUE), is(true)); + assertEquals(filter.accept(new Key(), VALUE), true); // 1970 is older than 30 days, but filter is disable so should be true - assertThat(filter.accept(getKey(0), VALUE), is(true)); + assertEquals(filter.accept(getKey(0), VALUE), true); } @Test @@ -86,9 +86,9 @@ public void testAcceptKeyValue_DisabledFullMajc() throws Exception { filter.init(source, options, env); - assertThat(filter.accept(new Key(), VALUE), is(true)); + assertEquals(filter.accept(new Key(), VALUE), true); // 1970 is older than 30 days, but filter is disable so should be true - assertThat(filter.accept(getKey(0), VALUE), is(true)); + assertEquals(filter.accept(getKey(0), VALUE), true); } @Test @@ -99,9 +99,9 @@ public void testAcceptKeyValue_OnlyTtlNoInnerFilters() throws Exception { // no file or other delegate filters configured, so only the ttl are used filter.init(source, options, env); - assertThat(filter.accept(getKey(daysAgo(10)), VALUE), is(true)); + assertEquals(filter.accept(getKey(daysAgo(10)), VALUE), true); // 100 is older than 30 days - assertThat(filter.accept(getKey(daysAgo(100)), VALUE), is(false)); + assertEquals(filter.accept(getKey(daysAgo(100)), VALUE), false); } @Test @@ -113,8 +113,8 @@ public void testAcceptKeyValue_WithFile() throws Exception { // the file uses TestFilter which always returns false for accept and filter applied // so only ttl is uses for acceptance - assertThat(filter.accept(getKey(daysAgo(15)), VALUE), is(true)); - assertThat(filter.accept(getKey(daysAgo(123)), VALUE), is(false)); + assertEquals(filter.accept(getKey(daysAgo(15)), VALUE), true); + assertEquals(filter.accept(getKey(daysAgo(123)), VALUE), false); } @Test @@ -132,22 +132,22 @@ public void testAcceptKeyValue_TtlSet() throws Exception { filter.initialize(wrapper); // brand new key should be good - assertThat(filter.accept(new Key(), VALUE), is(true)); + assertEquals(filter.accept(new Key(), VALUE), true); // first five will hit the ttl short circuit - assertThat(filter.accept(getKey(daysAgo(1)), VALUE), is(true)); - assertThat(filter.accept(getKey(daysAgo(2)), VALUE), is(true)); - assertThat(filter.accept(getKey(daysAgo(3)), VALUE), is(true)); - assertThat(filter.accept(getKey(daysAgo(4)), VALUE), is(true)); - assertThat("If this fails it may be an edge case due to date rollover, try again in a minute", // - filter.accept(getKey(daysAgo(5)), VALUE), is(true)); + assertEquals(filter.accept(getKey(daysAgo(1)), VALUE), true); + assertEquals(filter.accept(getKey(daysAgo(2)), VALUE), true); + assertEquals(filter.accept(getKey(daysAgo(3)), VALUE), true); + assertEquals(filter.accept(getKey(daysAgo(4)), VALUE), true); + assertEquals("If this fails it may be an edge case due to date rollover, try again in a minute", // + filter.accept(getKey(daysAgo(5)), VALUE), true); // these will not hit the ttl short circuit and the single applied rule - assertThat(filter.accept(getKey("foo", daysAgo(6)), VALUE), is(true)); + assertEquals(filter.accept(getKey("foo", daysAgo(6)), VALUE), true); // will not match so should be true - assertThat(filter.accept(getKey("bar", daysAgo(7)), VALUE), is(true)); - assertThat(filter.accept(getKey("foo", daysAgo(8)), VALUE), is(true)); + assertEquals(filter.accept(getKey("bar", daysAgo(7)), VALUE), true); + assertEquals(filter.accept(getKey("foo", daysAgo(8)), VALUE), true); // this is really old and matches so should not be accepted - assertThat(filter.accept(getKey("foo", daysAgo(365)), VALUE), is(false)); + assertEquals(filter.accept(getKey("foo", daysAgo(365)), VALUE), false); } @@ -185,10 +185,10 @@ public void testAcceptKeyValue_MultipleFilters() throws Exception { Key oldBarTab = getKey("bar", "tab", daysAgo(100)); Key lowBar = getKey("low", "bar", daysAgo(32)); - assertThat(filter.accept(fooWee, VALUE), is(true)); - assertThat(filter.accept(newBarTab, VALUE), is(true)); - assertThat(filter.accept(oldBarTab, VALUE), is(false)); - assertThat(filter.accept(lowBar, VALUE), is(false)); + assertEquals(filter.accept(fooWee, VALUE), true); + assertEquals(filter.accept(newBarTab, VALUE), true); + assertEquals(filter.accept(oldBarTab, VALUE), false); + assertEquals(filter.accept(lowBar, VALUE), false); } @Test(expected = NullPointerException.class) @@ -216,14 +216,14 @@ public void testValidateOptions() { // @formatter:on for (String unit : allUnits) { options.put(AgeOffConfigParams.TTL_UNITS, unit); - assertThat(filter.validateOptions(options), is(true)); + assertEquals(filter.validateOptions(options), true); } options.put(AgeOffConfigParams.TTL_UNITS, "parsecs"); - assertThat(filter.validateOptions(options), is(false)); + assertEquals(filter.validateOptions(options), false); options.put(AgeOffConfigParams.TTL, "0x143"); options.put(AgeOffConfigParams.TTL_UNITS, AgeOffTtlUnits.DAYS); - assertThat(filter.validateOptions(options), is(false)); + assertEquals(filter.validateOptions(options), false); } // -------------------------------------------- diff --git a/warehouse/core/src/test/java/datawave/iterators/filter/TokenTtlTrieTest.java b/warehouse/core/src/test/java/datawave/iterators/filter/TokenTtlTrieTest.java index 1f3febfdcf0..ebe067dd548 100644 --- a/warehouse/core/src/test/java/datawave/iterators/filter/TokenTtlTrieTest.java +++ b/warehouse/core/src/test/java/datawave/iterators/filter/TokenTtlTrieTest.java @@ -120,7 +120,7 @@ public void testParser() { Assert.assertNull(trie.scan("foobar,barbaz;bazfoo".getBytes())); Assert.assertEquals((Long) 2L, trie.scan("foobar,foo;barfoo".getBytes())); Assert.assertEquals((Long) 2L, trie.scan("bar;foo".getBytes())); - Assert.assertEquals((long) AgeOffPeriod.getTtlUnitsFactor("d") * 3L, (long) trie.scan("bar,baz,foobar".getBytes())); + Assert.assertEquals(AgeOffPeriod.getTtlUnitsFactor("d") * 3L, (long) trie.scan("bar,baz,foobar".getBytes())); Assert.assertEquals((Long) (AgeOffPeriod.getTtlUnitsFactor("m") * 4L), trie.scan("buffer,baz".getBytes())); Assert.assertNull(trie.scan("b;ba,banana,bread,apple,pie".getBytes())); } diff --git a/warehouse/core/src/test/java/datawave/iterators/filter/ageoff/FieldAgeOffFilterTest.java b/warehouse/core/src/test/java/datawave/iterators/filter/ageoff/FieldAgeOffFilterTest.java index f1cdbae7099..9f55579a2c7 100644 --- a/warehouse/core/src/test/java/datawave/iterators/filter/ageoff/FieldAgeOffFilterTest.java +++ b/warehouse/core/src/test/java/datawave/iterators/filter/ageoff/FieldAgeOffFilterTest.java @@ -70,11 +70,6 @@ public boolean isUserCompaction() { throw new UnsupportedOperationException(); } - @Override - public void registerSideChannel(SortedKeyValueIterator sortedKeyValueIterator) { - throw new UnsupportedOperationException(); - } - @Override public Authorizations getAuthorizations() { throw new UnsupportedOperationException(); diff --git a/warehouse/core/src/test/java/datawave/util/cli/AccumuloArgsTest.java b/warehouse/core/src/test/java/datawave/util/cli/AccumuloArgsTest.java index 1c6634b59bb..02060611030 100644 --- a/warehouse/core/src/test/java/datawave/util/cli/AccumuloArgsTest.java +++ b/warehouse/core/src/test/java/datawave/util/cli/AccumuloArgsTest.java @@ -1,7 +1,6 @@ package datawave.util.cli; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -29,11 +28,11 @@ public void testNewBuilder() { .parse(argv); // @formatter:on - assertThat(args.user(), is("Bob")); - assertThat(args.password(), is("zekret")); - assertThat(args.instance(), is("instance")); - assertThat(args.zookeepers(), is("localhost:2181")); - assertThat(args.table(), is("testTable")); + assertEquals(args.user(), "Bob"); + assertEquals(args.password(), "zekret"); + assertEquals(args.instance(), "instance"); + assertEquals(args.zookeepers(), "localhost:2181"); + assertEquals(args.table(), "testTable"); } @Test @@ -58,13 +57,13 @@ public void testNewBuilder_WithExtraOpts() { .parse(argv); // @formatter:on - assertThat(args.user(), is("Steve")); - assertThat(args.password(), is("zekret")); - assertThat(args.instance(), is("instance")); - assertThat(args.zookeepers(), is("localhost:2181")); - assertThat(args.table(), is("testTable")); + assertEquals(args.user(), "Steve"); + assertEquals(args.password(), "zekret"); + assertEquals(args.instance(), "instance"); + assertEquals(args.zookeepers(), "localhost:2181"); + assertEquals(args.table(), "testTable"); // make sure extra args are available - assertThat(other.color, is("magenta")); + assertEquals(other.color, "magenta"); } private static class TestArg { diff --git a/warehouse/core/src/test/java/datawave/util/cli/PasswordConverterTest.java b/warehouse/core/src/test/java/datawave/util/cli/PasswordConverterTest.java index 65473776177..a473c14feb1 100644 --- a/warehouse/core/src/test/java/datawave/util/cli/PasswordConverterTest.java +++ b/warehouse/core/src/test/java/datawave/util/cli/PasswordConverterTest.java @@ -1,9 +1,6 @@ package datawave.util.cli; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -33,7 +30,7 @@ public void testConvertEnvPrefixed() { String name = System.getenv().keySet().iterator().next(); argv[1] = "env:" + name; new JCommander(password).parse(argv); - assertThat(password.password, is(equalTo(System.getenv(name)))); + assertEquals(password.password, System.getenv(name)); } @Test @@ -41,7 +38,7 @@ public void testConvertEnvPrefixedEmpty() { // prefix with no var defined should return null argv[1] = "env:"; new JCommander(password).parse(argv); - assertThat(password.password, is(nullValue())); + assertEquals(password.password, null); } @Test @@ -49,12 +46,12 @@ public void testConvertEnvPrefixedUndefinedEnvironmentVar() { // prefix with env var not defined should return null String name = "HighlyUnlikelyThisWillBeDefined"; // make sure it is not defined - assertThat("Expected " + name + " to not be defined but it was!", System.getenv(name), is(nullValue())); + assertEquals("Expected " + name + " to not be defined but it was!", null, System.getenv(name)); argv[1] = "env:" + name; new JCommander(password).parse(argv); - assertThat(password.password, is(nullValue())); + assertEquals(password.password, null); } @Test @@ -62,7 +59,7 @@ public void testConvertNonEnvPrefixed() { String expected = "behavior"; argv[1] = expected; new JCommander(password).parse(argv); - assertThat(password.password, is(equalTo(expected))); + assertEquals(password.password, expected); } } diff --git a/warehouse/index-stats/src/test/java/datawave/mapreduce/shardStats/MockMapDriver.java b/warehouse/index-stats/src/test/java/datawave/mapreduce/shardStats/MockMapDriver.java index aa9b24b1164..213a9a2d491 100644 --- a/warehouse/index-stats/src/test/java/datawave/mapreduce/shardStats/MockMapDriver.java +++ b/warehouse/index-stats/src/test/java/datawave/mapreduce/shardStats/MockMapDriver.java @@ -37,7 +37,7 @@ Configuration getConfiguration() { } void addInput(KEYIN key, VALUEIN value) { - MRPair pair = new MRPair(key, value); + MRPair pair = new MRPair<>(key, value); this.input.add(pair); } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/data/Type.java b/warehouse/ingest-core/src/main/java/datawave/ingest/data/Type.java index 1fc026f1445..81d7dffd857 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/data/Type.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/data/Type.java @@ -104,6 +104,7 @@ public void clearIngestHelper() { * - configuration to set * @return helper interface */ + @Deprecated public IngestHelperInterface newIngestHelper(Configuration conf) { IngestHelperInterface helper = newIngestHelper(); if (helper != null) { @@ -118,6 +119,7 @@ public IngestHelperInterface newIngestHelper(Configuration conf) { * @deprecated * @return helper interface */ + @Deprecated public IngestHelperInterface newIngestHelper() { IngestHelperInterface helper = null; if (helperClass != null) { @@ -134,8 +136,8 @@ public RecordReader newRecordReader() { RecordReader reader = null; if (readerClass != null) { try { - reader = readerClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + reader = readerClass.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { // ignore for now } } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/CompositeIngest.java b/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/CompositeIngest.java index a1f7f437cc1..0db91dd57b9 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/CompositeIngest.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/CompositeIngest.java @@ -293,6 +293,7 @@ private String[] getConfPrefixes(String type) { * a different map of markings * @return the merged markings */ + @SuppressWarnings("unchecked") protected Map mergeMarkings(Map markings1, Map markings2) { if (markings2 != null) { if (markings1 == null) { diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/IngestFieldFilter.java b/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/IngestFieldFilter.java index 06f637925cd..d4b336b3f47 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/IngestFieldFilter.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/IngestFieldFilter.java @@ -47,7 +47,7 @@ public class IngestFieldFilter { private static final Logger logger = Logger.getLogger(IngestFieldFilter.class); - + private static final long serialVersionUID = 0l; @Deprecated public static final String FILTER_FIELD_SUFFIX = ".data.field.filter"; @@ -309,6 +309,7 @@ public Object setValue(Object value) { * A parsed field configuration ***************************************************************************/ class FieldConfiguration extends ArrayList implements List { + private static final long serialVersionUID = 0; public FieldConfiguration() { diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/VirtualIngest.java b/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/VirtualIngest.java index 925a1bea6a1..daae6b13202 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/VirtualIngest.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/data/config/ingest/VirtualIngest.java @@ -347,6 +347,7 @@ private String[] getConfPrefixes(String type, String instance) { * a different map of markings * @return the merged markings */ + @SuppressWarnings("unchecked") protected Map mergeMarkings(Map markings1, Map markings2) { if (markings2 != null) { if (markings1 == null) { diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/data/hash/StringUID.java b/warehouse/ingest-core/src/main/java/datawave/ingest/data/hash/StringUID.java index 390977cf820..6fcb1434c2f 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/data/hash/StringUID.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/data/hash/StringUID.java @@ -15,6 +15,7 @@ public class StringUID extends HashUID { protected String innerUid = null; protected String shardedPortion = null; + private static final long serialVersionUID = 0l; public StringUID(String uid) { innerUid = uid; diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/data/tokenize/TokenizationHelper.java b/warehouse/ingest-core/src/main/java/datawave/ingest/data/tokenize/TokenizationHelper.java index 931b2efa40e..dac97f1c4a6 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/data/tokenize/TokenizationHelper.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/data/tokenize/TokenizationHelper.java @@ -6,6 +6,7 @@ import org.apache.log4j.Logger; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.CharArraySet; +import org.apache.lucene.analysis.en.EnglishAnalyzer; import datawave.ingest.data.config.DataTypeHelper; import datawave.util.ObjectFactory; @@ -373,7 +374,7 @@ public static final CharArraySet getStopWords(DataTypeHelper helper, Configurati } } else { log.warn("Utilizing default stopword set. Tokenization and indexing may generate unwanted data"); - stopWords = org.apache.lucene.analysis.core.StopAnalyzer.ENGLISH_STOP_WORDS_SET; + stopWords = EnglishAnalyzer.ENGLISH_STOP_WORDS_SET; } return stopWords; } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/EventMapper.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/EventMapper.java index edce34ef644..9ab08df9df1 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/EventMapper.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/EventMapper.java @@ -243,7 +243,7 @@ public void setup(Context context) throws IOException, InterruptedException { if (lastFilter != null) { try { - KeyValueFilter filter = lastFilter.newInstance(); + KeyValueFilter filter = lastFilter.getDeclaredConstructor().newInstance(); filter.configureChainedContextWriter(filterConf, contextWriterClass); } catch (Exception e) { throw new IOException("Unable to configure " + contextWriterClass + " on " + lastFilter, e); @@ -321,12 +321,12 @@ private List> loadDataType(String typeStr, Context context) for (String validatorClass : validatorClasses) { try { Class clazz = Class.forName(validatorClass).asSubclass(FieldValidator.class); - FieldValidator validator = clazz.newInstance(); + FieldValidator validator = clazz.getDeclaredConstructor().newInstance(); validator.init(t, context.getConfiguration()); validators.put(typeStr, validator); } catch (ClassNotFoundException e) { log.error("Error finding validator " + validatorClass, e); - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { log.error("Error creating validator " + validatorClass, e); } } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/handler/facet/FacetHandler.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/handler/facet/FacetHandler.java index cd72c72acee..41bc34628a4 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/handler/facet/FacetHandler.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/handler/facet/FacetHandler.java @@ -1,6 +1,7 @@ package datawave.ingest.mapreduce.handler.facet; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -142,8 +143,8 @@ public void setup(TaskAttemptContext context) { // Will throw RuntimeException if class can't be coerced into Predicate @SuppressWarnings("unchecked") Class> projClazz = (Class>) Class.forName(predClazzStr).asSubclass(Predicate.class); - fieldFilterPredicate = projClazz.newInstance(); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + fieldFilterPredicate = projClazz.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) { throw new RuntimeException(e); } } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/ConstraintChecker.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/ConstraintChecker.java index 7805bd98e74..d4bbb68d45c 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/ConstraintChecker.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/ConstraintChecker.java @@ -38,7 +38,8 @@ public static ConstraintChecker create(Configuration conf) { } try { - ConstraintInitializer initializer = Class.forName(initializerClass).asSubclass(ConstraintInitializer.class).newInstance(); + ConstraintInitializer initializer = Class.forName(initializerClass).asSubclass(ConstraintInitializer.class).getDeclaredConstructor() + .newInstance(); initializer.addConstraints(conf, constraints); } catch (Exception e) { @@ -99,6 +100,8 @@ public void check(Text table, byte[] visibility) throws ConstraintViolationExcep * Thrown when a violation is encountered. */ public static class ConstraintViolationException extends RuntimeException { + private static final long serialVersionUID = 0l; + public ConstraintViolationException(Text table, VisibilityConstraint constraint) { super(String.format("Visibility constraint '%s' violated for table '%s'", constraint, table)); } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/IngestJob.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/IngestJob.java index 3945fcd6e66..372dd32573f 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/IngestJob.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/IngestJob.java @@ -741,10 +741,10 @@ protected Configuration parseArguments(String[] args, Configuration conf) throws for (String jobObserverClass : classes) { log.info("Adding job observer: " + jobObserverClass); Class clazz = Class.forName(jobObserverClass); - Observer o = (Observer) clazz.newInstance(); + Observer o = (Observer) clazz.getDeclaredConstructor().newInstance(); jobObservers.add(o); } - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) { log.error("cannot instantiate job observer class '" + jobObserverClasses + "'", e); System.exit(-2); } catch (ClassCastException e) { diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatter.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatter.java index daef981a8f3..8a08d92b016 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatter.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatter.java @@ -146,7 +146,7 @@ public static void setCompressionTableDisallowList(Configuration conf, Set getCompressionTableDisallowList(Configuration conf) { String tableListString = conf.get(COMPRESSION_DISALLOWLIST); if (tableListString == null) { - return Collections.EMPTY_SET; + return Collections.emptySet(); } else { String[] tables = StringUtils.split(tableListString, ','); return new HashSet<>(Arrays.asList(tables)); @@ -398,7 +398,7 @@ protected void setTableIdsAndConfigs() throws IOException { TableConfigurationUtil tcu = new TableConfigurationUtil(conf); - tableIds = tcu.getJobOutputTableNames(conf); + tableIds = TableConfigurationUtil.getJobOutputTableNames(conf); Set compressionTableDisallowList = getCompressionTableDisallowList(conf); String compressionType = getCompressionType(conf); for (String tableName : tableIds) { diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/PartitionerCache.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/PartitionerCache.java index ff352acc2a7..c61ec2bc399 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/PartitionerCache.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/PartitionerCache.java @@ -240,7 +240,7 @@ private Class> getPartitionerClass(St // that private Partitioner createConfiguredPartitioner(Class> clazz, String prefix) { try { - Partitioner partitioner = clazz.newInstance(); + Partitioner partitioner = clazz.getDeclaredConstructor().newInstance(); if (partitioner instanceof Configurable) { ((Configurable) partitioner).setConf(conf); } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TableConfigurationUtil.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TableConfigurationUtil.java index 6e171eea26c..2712dfe27aa 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TableConfigurationUtil.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TableConfigurationUtil.java @@ -143,8 +143,8 @@ public static Set extractTableNames(Configuration conf) throws IllegalAr } DataTypeHandler handler; try { - handler = handlerClass.newInstance(); - } catch (InstantiationException e) { + handler = handlerClass.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | NoSuchMethodException | InvocationTargetException e) { throw new IllegalArgumentException("Unable to instantiate " + handlerClassName, e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Unable to access default constructor for " + handlerClassName, e); @@ -364,8 +364,8 @@ public static Map getTablePriorities(Configuration conf) { } DataTypeHandler handler; try { - handler = handlerClass.newInstance(); - } catch (InstantiationException e) { + handler = handlerClass.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | NoSuchMethodException | InvocationTargetException e) { throw new IllegalArgumentException("Unable to instantiate " + handlerClassName, e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Unable to access default constructor for " + handlerClassName, e); diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TablePartitionerOffsets.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TablePartitionerOffsets.java index 580aa31930b..c33ab400742 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TablePartitionerOffsets.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/TablePartitionerOffsets.java @@ -19,6 +19,7 @@ public class TablePartitionerOffsets extends HashMap { private final Configuration conf; private final PartitionerCache partitionerCache; private final int reduceTasks; + private static final long serialVersionUID = 0l; public TablePartitionerOffsets(Configuration conf, List tableNames, PartitionerCache partitionerCache) throws ClassNotFoundException { super(); diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/metrics/MetricsConfiguration.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/metrics/MetricsConfiguration.java index 9f343a0d45f..df1a25b8dfa 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/metrics/MetricsConfiguration.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/metrics/MetricsConfiguration.java @@ -65,7 +65,7 @@ public static Collection getReceivers(Configuration conf) { try { receiverClass = receiverClass.trim(); Class clazz = (Class) Class.forName(receiverClass); - receivers.add(clazz.newInstance()); + receivers.add(clazz.getDeclaredConstructor().newInstance()); } catch (Exception e) { logger.error("Could not instantiate receiver: " + receiverClass + ", skipping...", e); } diff --git a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/writer/AbstractChainedContextWriter.java b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/writer/AbstractChainedContextWriter.java index 842c028da10..adfe8429a8a 100644 --- a/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/writer/AbstractChainedContextWriter.java +++ b/warehouse/ingest-core/src/main/java/datawave/ingest/mapreduce/job/writer/AbstractChainedContextWriter.java @@ -42,7 +42,7 @@ public void setup(Configuration conf, boolean outputTableCounters) throws IOExce + getChainedContextWriterOption()); } try { - contextWriter = contextWriterClass.newInstance(); + contextWriter = contextWriterClass.getDeclaredConstructor().newInstance(); contextWriter.setup(conf, outputTableCounters); } catch (Exception e) { throw new IOException("Failed to initialized " + contextWriterClass + " from property " + getChainedContextWriterOption(), e); diff --git a/warehouse/ingest-core/src/main/java/datawave/iterators/StatsLinksEdgeCombiner.java b/warehouse/ingest-core/src/main/java/datawave/iterators/StatsLinksEdgeCombiner.java index 7b02b0c1d11..b48b3376d01 100644 --- a/warehouse/ingest-core/src/main/java/datawave/iterators/StatsLinksEdgeCombiner.java +++ b/warehouse/ingest-core/src/main/java/datawave/iterators/StatsLinksEdgeCombiner.java @@ -154,7 +154,7 @@ public void seek(final Range range, final Collection columnFamilie @Override public SortedKeyValueIterator deepCopy(final IteratorEnvironment env) { try { - final StatsLinksEdgeCombiner newInstance = this.getClass().newInstance(); + final StatsLinksEdgeCombiner newInstance = this.getClass().getDeclaredConstructor().newInstance(); newInstance.setSource(getSource().deepCopy(env)); return (newInstance); diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/EventMapperTest.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/EventMapperTest.java index b0248906afa..4f5b783a675 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/EventMapperTest.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/EventMapperTest.java @@ -110,7 +110,7 @@ record = new SimpleRawRecord(); TaskAttemptID id = new TaskAttemptID(); expect(mapContext.getTaskAttemptID()).andReturn(id).anyTimes(); - StandaloneTaskAttemptContext standaloneContext = new StandaloneTaskAttemptContext(conf, new StandaloneStatusReporter()); + StandaloneTaskAttemptContext standaloneContext = new StandaloneTaskAttemptContext<>(conf, new StandaloneStatusReporter()); expect(mapContext.getCounter(anyObject())).andDelegateTo(standaloneContext).anyTimes(); expect(mapContext.getCounter(anyString(), anyString())).andDelegateTo(standaloneContext).anyTimes(); diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/SimpleDataTypeHelper.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/SimpleDataTypeHelper.java index 6dfd7758664..a5dbe4bdd1a 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/SimpleDataTypeHelper.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/SimpleDataTypeHelper.java @@ -38,7 +38,7 @@ public static void registerFields(Multimap f) */ public static IngestHelperInterface create() { ClassLoader cl = SimpleDataTypeHelper.class.getClassLoader(); - return (IngestHelperInterface) Proxy.newProxyInstance(cl, new Class[] {IngestHelperInterface.class}, new SimpleDataTypeHelper()); + return (IngestHelperInterface) Proxy.newProxyInstance(cl, new Class[] {IngestHelperInterface.class}, new SimpleDataTypeHelper()); } @Override diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/TablePropertiesMap.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/TablePropertiesMap.java index 10d4638b34f..7e688c9ab09 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/TablePropertiesMap.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/TablePropertiesMap.java @@ -11,6 +11,8 @@ * The Accumulo table properties represented as a Map. */ public class TablePropertiesMap extends TreeMap { + private static final long serialVersionUID = 0l; + public TablePropertiesMap(TableOperations tops, String tableName) throws AccumuloException, TableNotFoundException { for (Map.Entry entry : tops.getProperties(tableName)) { put(entry.getKey(), entry.getValue()); diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/statsd/CounterToStatsDConfigurationTest.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/statsd/CounterToStatsDConfigurationTest.java index fffa0467cf9..01c207b180d 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/statsd/CounterToStatsDConfigurationTest.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/statsd/CounterToStatsDConfigurationTest.java @@ -163,6 +163,7 @@ public TestCounter(String name) { } @Override + @Deprecated public void setDisplayName(String displayName) { } diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LimitedKeyPartitionerTest.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LimitedKeyPartitionerTest.java index ce1714b39cc..52ac8ec4222 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LimitedKeyPartitionerTest.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LimitedKeyPartitionerTest.java @@ -15,11 +15,11 @@ public class LimitedKeyPartitionerTest { private static final int NUM_REDUCERS = 1000; @Test - public void testLimitedRangeSetViaGenericConfig() throws IllegalAccessException, InstantiationException { + public void testLimitedRangeSetViaGenericConfig() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { Configuration conf = new Configuration(); conf.setInt(PartitionLimiter.MAX_PARTITIONS_PROPERTY, 8); - LimitedKeyPartitioner partitioner = LimitedKeyPartitioner.class.newInstance(); + LimitedKeyPartitioner partitioner = LimitedKeyPartitioner.class.getDeclaredConstructor().newInstance(); partitioner.setConf(conf); assertPartitionsUnderMax(partitioner, 8); @@ -47,11 +47,11 @@ private void assertPartitionsUnderMax(LimitedKeyPartitioner partitioner, int exp } @Test - public void testHigherMaxThanReducers() throws IllegalAccessException, InstantiationException { + public void testHigherMaxThanReducers() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { Configuration conf = new Configuration(); conf.setInt(PartitionLimiter.MAX_PARTITIONS_PROPERTY, NUM_REDUCERS + 1); - LimitedKeyPartitioner partitioner = LimitedKeyPartitioner.class.newInstance(); + LimitedKeyPartitioner partitioner = LimitedKeyPartitioner.class.getDeclaredConstructor().newInstance(); partitioner.setConf(conf); assertPartitionsUnderMax(partitioner, NUM_REDUCERS); } diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LocalityGroupPartitionerTest.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LocalityGroupPartitionerTest.java index 0a7a932c14c..5d14164c164 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LocalityGroupPartitionerTest.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/LocalityGroupPartitionerTest.java @@ -42,7 +42,7 @@ public void testGetPartitionNewColFam() throws Exception { String tableName = "tableX"; conf.set(tableName + "." + LocalityGroupPartitioner.COLUMN_FAMILIES, "CITY,STATE"); - LocalityGroupPartitioner partitioner = LocalityGroupPartitioner.class.newInstance(); + LocalityGroupPartitioner partitioner = LocalityGroupPartitioner.class.getDeclaredConstructor().newInstance(); partitioner.setConf(conf); partitioner.configureWithPrefix(tableName); diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/RowHashingPartitionerTest.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/RowHashingPartitionerTest.java index bbd7e2f0a5d..63c80b7b624 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/RowHashingPartitionerTest.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/partition/RowHashingPartitionerTest.java @@ -67,12 +67,12 @@ public void testConfigureByTable() throws IllegalAccessException, InstantiationE } @Test - public void testMultipleColFamiliesPerRow() throws IllegalAccessException, InstantiationException { + public void testMultipleColFamiliesPerRow() throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { Configuration conf = new Configuration(); String tableName = "tableX"; conf.set(tableName + "." + RowHashingPartitioner.COLUMN_FAMILIES, "CITY,STATE"); - RowHashingPartitioner partitioner = RowHashingPartitioner.class.newInstance(); + RowHashingPartitioner partitioner = RowHashingPartitioner.class.getDeclaredConstructor().newInstance(); partitioner.setConf(conf); partitioner.configureWithPrefix(tableName); diff --git a/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/TableConfigurationUtilTest.java b/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/TableConfigurationUtilTest.java index 8c6afcf9d63..3d79e5d41ab 100644 --- a/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/TableConfigurationUtilTest.java +++ b/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/TableConfigurationUtilTest.java @@ -178,9 +178,9 @@ public void testDeserializeOutputTableNotInCache() throws AccumuloSecurityExcept tcu.serializeTableConfgurationIntoConf(conf); TableConfigCache.getCurrentCache(conf).clear(); - tcu.addOutputTables("audit", conf); + TableConfigurationUtil.addOutputTables("audit", conf); - tcu.deserializeTableConfigs(conf); + TableConfigurationUtil.deserializeTableConfigs(conf); } @@ -196,7 +196,7 @@ public void testOutputTableNotInCache() throws AccumuloSecurityException, Accumu tcu.updateCacheFile(); - tcu.addOutputTables("nonexistent_table", conf); + TableConfigurationUtil.addOutputTables("nonexistent_table", conf); try { tcu.serializeTableConfgurationIntoConf(conf); } finally { diff --git a/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/mr/handler/ContentCSVIndexingColumnBasedHandlerTest.java b/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/mr/handler/ContentCSVIndexingColumnBasedHandlerTest.java index 323b8045559..426fdf7ec77 100644 --- a/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/mr/handler/ContentCSVIndexingColumnBasedHandlerTest.java +++ b/warehouse/ingest-csv/src/test/java/datawave/ingest/csv/mr/handler/ContentCSVIndexingColumnBasedHandlerTest.java @@ -41,9 +41,9 @@ public class ContentCSVIndexingColumnBasedHandlerTest { private Configuration conf; - private static Path edgeKeyVersionCachePath = Paths.get(System.getProperty("user.dir"), "edge-key-version.txt"); + private static final Path edgeKeyVersionCachePath = Paths.get(System.getProperty("user.dir"), "edge-key-version.txt"); private static Logger log = Logger.getLogger(ContentCSVIndexingColumnBasedHandlerTest.class); - private static Enumeration rootAppenders = Logger.getRootLogger().getAllAppenders(); + private static final Enumeration rootAppenders = Logger.getRootLogger().getAllAppenders(); @BeforeClass public static void setupSystemSettings() throws Exception { diff --git a/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonDataTypeHelper.java b/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonDataTypeHelper.java index c9e55e94227..a131e6a0107 100644 --- a/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonDataTypeHelper.java +++ b/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonDataTypeHelper.java @@ -73,13 +73,13 @@ public JsonObjectFlattener newFlattener() { } else if (null != this.getFieldAllowlist()) { allowlistFields = this.getFieldAllowlist(); } else { - allowlistFields = Collections.EMPTY_SET; + allowlistFields = Collections.emptySet(); } if (null != this.getFieldDisallowlist()) { disallowlistFields = this.getFieldDisallowlist(); } else { - disallowlistFields = Collections.EMPTY_SET; + disallowlistFields = Collections.emptySet(); } return new JsonIngestFlattener.Builder().jsonDataTypeHelper(this).mapKeyAllowlist(allowlistFields).mapKeyDisallowlist(disallowlistFields) diff --git a/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestFlattener.java b/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestFlattener.java index a38b8e21580..1d6dad7daf3 100644 --- a/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestFlattener.java +++ b/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestFlattener.java @@ -287,8 +287,7 @@ private void flattenAndPrint(JsonObject jsonObject) { } private void setupIterator(JsonReader reader) { - JsonParser parser = new JsonParser(); - JsonElement root = parser.parse(reader); + JsonElement root = JsonParser.parseReader(reader); if (root.isJsonArray()) { // Currently positioned to read a set of objects diff --git a/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestHelper.java b/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestHelper.java index d85b211f075..7089e742a58 100644 --- a/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestHelper.java +++ b/warehouse/ingest-json/src/main/java/datawave/ingest/json/config/helper/JsonIngestHelper.java @@ -47,8 +47,7 @@ public Multimap getEventFields(RawRecordConta HashMultimap fields = HashMultimap.create(); String jsonString = new String(event.getRawData()); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(jsonString); + JsonElement jsonElement = JsonParser.parseString(jsonString); flattener.flatten(jsonElement.getAsJsonObject(), fields); return normalizeMap(getGroupNormalizedMap(fields)); diff --git a/warehouse/ingest-json/src/main/java/datawave/ingest/json/mr/input/JsonRecordReader.java b/warehouse/ingest-json/src/main/java/datawave/ingest/json/mr/input/JsonRecordReader.java index 520b8f55337..ac8962b5ed3 100644 --- a/warehouse/ingest-json/src/main/java/datawave/ingest/json/mr/input/JsonRecordReader.java +++ b/warehouse/ingest-json/src/main/java/datawave/ingest/json/mr/input/JsonRecordReader.java @@ -155,8 +155,7 @@ protected void setupReader(InputStream is) { } protected void setupIterator(JsonReader reader) { - JsonParser parser = new JsonParser(); - JsonElement root = parser.parse(reader); + JsonElement root = JsonParser.parseReader(reader); if (root.isJsonArray()) { // Currently positioned to read a set of objects diff --git a/warehouse/ingest-json/src/test/java/datawave/ingest/json/config/helper/JsonIngestFlattenerTest.java b/warehouse/ingest-json/src/test/java/datawave/ingest/json/config/helper/JsonIngestFlattenerTest.java index fd808e0c60e..8e5bcbd9782 100644 --- a/warehouse/ingest-json/src/test/java/datawave/ingest/json/config/helper/JsonIngestFlattenerTest.java +++ b/warehouse/ingest-json/src/test/java/datawave/ingest/json/config/helper/JsonIngestFlattenerTest.java @@ -35,8 +35,7 @@ public static void setup() throws URISyntaxException, IOException { public void testFlattenGROUPED() throws Exception { JsonObjectFlattener flattener = new JsonIngestFlattener.Builder().flattenMode(FlattenMode.GROUPED).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -55,8 +54,7 @@ public void testFlattenGROUPED() throws Exception { public void testFlattenGROUPED_AND_NORMAL() throws Exception { JsonObjectFlattener flattener = new JsonIngestFlattener.Builder().flattenMode(FlattenMode.GROUPED_AND_NORMAL).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); diff --git a/warehouse/ingest-json/src/test/java/datawave/ingest/json/mr/handler/ContentJsonColumnBasedHandlerTest.java b/warehouse/ingest-json/src/test/java/datawave/ingest/json/mr/handler/ContentJsonColumnBasedHandlerTest.java index 0b199c5da57..555eddaeb53 100644 --- a/warehouse/ingest-json/src/test/java/datawave/ingest/json/mr/handler/ContentJsonColumnBasedHandlerTest.java +++ b/warehouse/ingest-json/src/test/java/datawave/ingest/json/mr/handler/ContentJsonColumnBasedHandlerTest.java @@ -46,9 +46,9 @@ public class ContentJsonColumnBasedHandlerTest { private static final boolean PRINT_GENERATED_KEYS_ONLY_ON_FAIL = true; private Configuration conf; - private static Path edgeKeyVersionCachePath = Paths.get(System.getProperty("user.dir"), "edge-key-version.txt"); + private static final Path edgeKeyVersionCachePath = Paths.get(System.getProperty("user.dir"), "edge-key-version.txt"); private static Logger log = Logger.getLogger(ContentJsonColumnBasedHandlerTest.class); - private static Enumeration rootAppenders = Logger.getRootLogger().getAllAppenders(); + private static final Enumeration rootAppenders = Logger.getRootLogger().getAllAppenders(); @BeforeClass public static void setupSystemSettings() throws Exception { diff --git a/warehouse/ingest-json/src/test/java/datawave/ingest/json/util/JsonObjectFlattenerImplTest.java b/warehouse/ingest-json/src/test/java/datawave/ingest/json/util/JsonObjectFlattenerImplTest.java index c5c7f7b0112..e4233d58ee6 100644 --- a/warehouse/ingest-json/src/test/java/datawave/ingest/json/util/JsonObjectFlattenerImplTest.java +++ b/warehouse/ingest-json/src/test/java/datawave/ingest/json/util/JsonObjectFlattenerImplTest.java @@ -63,8 +63,7 @@ public static void setup() throws URISyntaxException, IOException { public void testFlattenAndForceUpperCaseKeys() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().pathDelimiter(".").mapKeyValueNormalizer(toUpperCaseNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -80,8 +79,7 @@ public void testFlattenAndForceLowerCaseKeys() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().pathDelimiter(".").mapKeyValueNormalizer(toLowerCaseNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -99,8 +97,7 @@ public void testFlattenWithDisallowlist() throws Exception { .mapKeyDisallowlist(new HashSet<>(Arrays.asList("ROOTOBJECT.NUMBER2", "ROOTOBJECT.STRING2"))).pathDelimiter(".") .mapKeyValueNormalizer(toUpperCaseNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -118,8 +115,7 @@ public void testFlattenWithAllowlist() throws Exception { .mapKeyAllowlist(new HashSet<>(Arrays.asList("ROOTOBJECT.NUMBER2", "ROOTOBJECT.STRING2"))).pathDelimiter(".") .mapKeyValueNormalizer(toUpperCaseNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -137,8 +133,7 @@ public void testFlattenWithAllowlistDisallowlistConflict() throws Exception { .mapKeyDisallowlist(new HashSet<>(Arrays.asList("ROOTOBJECT.NUMBER2"))).pathDelimiter(".").mapKeyValueNormalizer(toUpperCaseNormalizer) .build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -151,8 +146,7 @@ public void testFlattenWithAllowlistDisallowlistConflict() throws Exception { public void testFlattenPreserveCaseIncludingPrefix() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().pathDelimiter("_").mapKeyValueNormalizer(noOpNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -167,8 +161,7 @@ public void testFlattenPreserveCaseIncludingPrefix() throws Exception { public void testFlattenModeSIMPLE() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().flattenMode(FlattenMode.SIMPLE).mapKeyValueNormalizer(noOpNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -188,8 +181,7 @@ public void testFlattenWithGroupingContext() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().flattenMode(FlattenMode.GROUPED).occurrenceInGroupDelimiter("#") .mapKeyValueNormalizer(noOpNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -209,8 +201,7 @@ public void testFlattenGROUPED_AND_NORMAL() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().flattenMode(FlattenMode.GROUPED_AND_NORMAL).occurrenceInGroupDelimiter("_") .pathDelimiter(".").mapKeyValueNormalizer(noOpNormalizer).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); Multimap fieldMap = flattener.flatten(jsonElement.getAsJsonObject()); // printJson(json); @@ -237,8 +228,7 @@ public void testFlattenGROUPED_AND_NORMAL() throws Exception { public void testGroupingContextWithBadJson() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().flattenMode(FlattenMode.GROUPED).occurrenceInGroupDelimiter("#").build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); JsonObject job = jsonElement.getAsJsonObject(); job.addProperty("illegal.key.format", "key name already has our path delimiter!"); @@ -255,8 +245,7 @@ public void testGroupingContextWithBadDelimiterConfig() throws Exception { JsonObjectFlattener flattener = new JsonObjectFlattenerImpl.Builder().pathDelimiter(".").occurrenceInGroupDelimiter(".") .flattenMode(FlattenMode.GROUPED).build(); - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(json); + JsonElement jsonElement = JsonParser.parseString(json); JsonObject job = jsonElement.getAsJsonObject(); try { diff --git a/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaDataTypeHandler.java b/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaDataTypeHandler.java index 7acfa9ddc6e..41ad90dbabb 100644 --- a/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaDataTypeHandler.java +++ b/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaDataTypeHandler.java @@ -472,7 +472,7 @@ protected void processTerm(RawRecordContainer event, int position, String term, // Now add the offset to the token offset queue, and if we overflow then output the overflow if (tokenOffsetCache != null) { - OffsetList overflow = tokenOffsetCache.addOffset(indexedTermAndZone, position); + OffsetList overflow = tokenOffsetCache.addOffset(indexedTermAndZone, position); if (overflow != null) { // no need to normalize as that was already done upon insertion into the token offset cache NormalizedFieldAndValue overflowNfv = new NormalizedFieldAndValue(overflow.termAndZone.zone, overflow.termAndZone.term); diff --git a/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaIngestHelper.java b/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaIngestHelper.java index e989eecee48..b50d2963317 100644 --- a/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaIngestHelper.java +++ b/warehouse/ingest-wikipedia/src/main/java/datawave/ingest/wikipedia/WikipediaIngestHelper.java @@ -20,7 +20,6 @@ import datawave.ingest.data.RawDataErrorNames; import datawave.ingest.data.RawRecordContainer; import datawave.ingest.data.config.NormalizedContentInterface; -import datawave.ingest.data.config.ingest.BaseIngestHelper; import datawave.ingest.data.config.ingest.IndexOnlyIngestHelperInterface; import datawave.ingest.data.config.ingest.TermFrequencyIngestHelperInterface; import datawave.ingest.mapreduce.handler.tokenize.ExtendedContentIngestHelper; diff --git a/warehouse/metrics-core/src/main/java/datawave/metrics/mapreduce/MetricsIngester.java b/warehouse/metrics-core/src/main/java/datawave/metrics/mapreduce/MetricsIngester.java index 7f9f2393162..9c18d2ccd45 100644 --- a/warehouse/metrics-core/src/main/java/datawave/metrics/mapreduce/MetricsIngester.java +++ b/warehouse/metrics-core/src/main/java/datawave/metrics/mapreduce/MetricsIngester.java @@ -31,6 +31,7 @@ import org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormat; import org.apache.accumulo.hadoop.mapreduce.AccumuloOutputFormat; import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.Option; import org.apache.commons.cli.ParseException; @@ -342,7 +343,7 @@ protected int launchErrorsJob(Job job, Configuration conf) * Goes through the arguments and attempts to add relevant values to the configuration */ private void _configure(String[] args) { - GnuParser parser = new GnuParser(); + DefaultParser parser = new DefaultParser(); CommandLine cmd; try { cmd = parser.parse(new MetricsOptions(), args); diff --git a/warehouse/ops-tools/index-validation/src/main/java/datawave/index/validation/AccumuloIndexAgeDisplay.java b/warehouse/ops-tools/index-validation/src/main/java/datawave/index/validation/AccumuloIndexAgeDisplay.java index 6172d9dbae9..b368387c2cf 100644 --- a/warehouse/ops-tools/index-validation/src/main/java/datawave/index/validation/AccumuloIndexAgeDisplay.java +++ b/warehouse/ops-tools/index-validation/src/main/java/datawave/index/validation/AccumuloIndexAgeDisplay.java @@ -44,7 +44,7 @@ public class AccumuloIndexAgeDisplay implements AutoCloseable { private Integer buckets[] = {180, 90, 60, 30, 14, 7, 2}; - private ArrayList[] dataBuckets; + private ArrayList> dataBuckets; public AccumuloIndexAgeDisplay(AccumuloClient accumuloClient, String tableName, String columns, Integer[] buckets) { this.tableName = tableName; @@ -163,9 +163,10 @@ private Scanner addColumnsToScanner(Scanner scanner) { * Pull data from accumulo, create a collection of delete cmds for th accumulo script for {@code indexes > 1 day} */ public void extractDataFromAccumulo() { - dataBuckets = new ArrayList[buckets.length]; - for (int ii = 0; ii < dataBuckets.length; ii++) { - dataBuckets[ii] = new ArrayList<>(); + dataBuckets = new ArrayList<>(); + + for (int ii = 0; ii < buckets.length; ii++) { + dataBuckets.add(new ArrayList<>()); } Scanner scanner = null; @@ -187,7 +188,7 @@ public void extractDataFromAccumulo() { // separate the data according to the bucket they will be dropped into for (int age : buckets) { if (rowAge <= (currentTime - (age * MILLIS_IN_DAY))) { // don't delete indexes < 1 day old - dataBuckets[bucketIndex].add((deleteCommand.toString()).replace("\0", "\\x00")); + dataBuckets.get(bucketIndex).add((deleteCommand.toString()).replace("\0", "\\x00")); break; } bucketIndex++; @@ -236,7 +237,7 @@ public String logAgeSummary() { StringBuilder sb = new StringBuilder(); for (int ii = buckets.length - 1; ii >= 0; --ii) { - sb.append(String.format("\nIndexes older than %1$-3d %2$-6s %3$10d", buckets[ii], "days:", dataBuckets[ii].size())); + sb.append(String.format("\nIndexes older than %1$-3d %2$-6s %3$10d", buckets[ii], "days:", dataBuckets.get(ii).size())); } sb.append("\n"); @@ -263,7 +264,7 @@ public void createAccumuloShellScript(String fileName) { for (int ii = 0; ii < buckets.length; ii++) { pw.println("# Indexes older than " + buckets[ii] + " days:"); - ArrayList al = dataBuckets[ii]; + ArrayList al = dataBuckets.get(ii); for (String row : al) { pw.println(row); } diff --git a/warehouse/pom.xml b/warehouse/pom.xml index b0fcd087149..1da518bb71e 100644 --- a/warehouse/pom.xml +++ b/warehouse/pom.xml @@ -54,12 +54,6 @@ - - com.cenqua.clover - clover - 3.1.4 - compile - com.clearspring.analytics stream @@ -366,6 +360,12 @@ jetty ${version.jetty} + + org.openclover + clover + 4.5.1 + compile + org.ow2.asm asm diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/ColumnRangeIterator.java b/warehouse/query-core/src/main/java/datawave/core/iterators/ColumnRangeIterator.java index 2719226f521..b94ece69af5 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/ColumnRangeIterator.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/ColumnRangeIterator.java @@ -194,6 +194,7 @@ protected Text getColumnStart() { } public static class ScanLimitReached extends RuntimeException { + private static final long serialVersionUID = 0l; private final Key lastKey; public ScanLimitReached(Key key, String message) { diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexListIteratorJexl.java b/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexListIteratorJexl.java index fa232bb83b4..a3c541b5c04 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexListIteratorJexl.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexListIteratorJexl.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -247,11 +248,15 @@ public static FST loadFSTFromFile(Path filename, String compressionCodec throw new IllegalArgumentException("Compression codec " + compressionCodec + " in not a subclass of CompressionCodec.", e); } try { - codec = codecClass.newInstance(); + codec = codecClass.getDeclaredConstructor().newInstance(); } catch (InstantiationException e) { throw new IllegalArgumentException("Compression codec " + compressionCodec + " could not be instantiated.", e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Compression codec " + compressionCodec + " could not be accessed.", e); + } catch (InvocationTargetException e) { + throw new IllegalArgumentException("Compression code " + compressionCodec + " could not be invoked.", e); + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException("Comporession code " + compressionCodec + " method not found. ", e); } } diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/EnrichingIterator.java b/warehouse/query-core/src/main/java/datawave/core/iterators/EnrichingIterator.java index a49f129e765..7a383ad9c0f 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/EnrichingIterator.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/EnrichingIterator.java @@ -128,13 +128,17 @@ public void init(SortedKeyValueIterator source, Map op try { @SuppressWarnings("unchecked") Class> iterClz = (Class>) Class.forName(subClass); - subIter = iterClz.newInstance(); + subIter = iterClz.getDeclaredConstructor().newInstance(); } catch (ClassNotFoundException e) { log.error("ClassNotFoundException when trying to instantiate the sub iterator.", e); } catch (InstantiationException e) { log.error("InstantiationException when trying to instantiate the sub iterator.", e); } catch (IllegalAccessException e) { log.error("IllegalAccessException when trying to instantiate the sub iterator.", e); + } catch (InvocationTargetException e) { + log.error("InvocationTargetException when trying to instantiate the sub iterator.", e); + } catch (NoSuchMethodException e) { + log.error("NoSuchMethodException when trying to instantiate the sub iterator", e); } if (subIter == null) { diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/querylock/ZookeeperQueryLock.java b/warehouse/query-core/src/main/java/datawave/core/iterators/querylock/ZookeeperQueryLock.java index 6fcd2ed4131..5e038d2a7bf 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/querylock/ZookeeperQueryLock.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/querylock/ZookeeperQueryLock.java @@ -233,6 +233,7 @@ protected void finalize() throws Throwable { } public static class ZookeeperLockException extends Exception { + private static final long serialVersionUID = 0l; public ZookeeperLockException() { super(); diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/AttributeFactory.java b/warehouse/query-core/src/main/java/datawave/query/attributes/AttributeFactory.java index 49b74b3c194..01b7f3026bf 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/AttributeFactory.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/AttributeFactory.java @@ -133,7 +133,7 @@ public Class apply(@Nullable String s) { } protected Attribute getAttribute(Class dataTypeClass, String fieldName, String data, Key key, boolean toKeep) throws Exception { - Type type = (Type) dataTypeClass.newInstance(); + Type type = (Type) dataTypeClass.getDeclaredConstructor().newInstance(); try { type.setDelegateFromString(data); return new TypeAttribute(type, key, toKeep); diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/Attributes.java b/warehouse/query-core/src/main/java/datawave/query/attributes/Attributes.java index 50a2e5ea684..6a5d887d66d 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/Attributes.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/Attributes.java @@ -329,8 +329,8 @@ public void read(Kryo kryo, Input input) { // Get the Class for the name of the class of the concrete Attribute Attribute attr; try { - attr = (Attribute) clz.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + attr = (Attribute) clz.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new RuntimeException(e); } diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/Document.java b/warehouse/query-core/src/main/java/datawave/query/attributes/Document.java index 2edaa426da2..8db37e8c8f9 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/Document.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/Document.java @@ -855,8 +855,8 @@ public void read(Kryo kryo, Input input) { if (Attribute.class.isAssignableFrom(clz)) { // Get an instance of the concrete Attribute try { - attr = (Attribute) clz.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + attr = (Attribute) clz.getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new RuntimeException(e); } diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/ExcerptFields.java b/warehouse/query-core/src/main/java/datawave/query/attributes/ExcerptFields.java index a85e70d4253..d96d4e5904c 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/ExcerptFields.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/ExcerptFields.java @@ -163,7 +163,9 @@ public void put(String field, Integer offset, String direction) { * Replace a field mapping with another field * * @param field + * the field * @param replacement + * the replacement field */ public void replace(String field, String replacement) { SortedMap value = fieldMap.remove(field); diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/Metadata.java b/warehouse/query-core/src/main/java/datawave/query/attributes/Metadata.java index 32766ba9dc3..e3fb3c3935a 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/Metadata.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/Metadata.java @@ -1,3 +1,5 @@ package datawave.query.attributes; -public class Metadata extends Document {} +public class Metadata extends Document { + private static final long serialVersionUID = 0l; +} diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/TimingMetadata.java b/warehouse/query-core/src/main/java/datawave/query/attributes/TimingMetadata.java index 97d851bbaad..e144baac63e 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/TimingMetadata.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/TimingMetadata.java @@ -7,6 +7,7 @@ * Holds timing information for query iterator next, source, seek, and yield counts. */ public class TimingMetadata extends Metadata { + private static final long serialVersionUID = 0l; private static final String NEXT_COUNT = "NEXT_COUNT"; private static final String SOURCE_COUNT = "SOURCE_COUNT"; diff --git a/warehouse/query-core/src/main/java/datawave/query/attributes/UniqueFields.java b/warehouse/query-core/src/main/java/datawave/query/attributes/UniqueFields.java index afbed40cfa6..121025e5580 100644 --- a/warehouse/query-core/src/main/java/datawave/query/attributes/UniqueFields.java +++ b/warehouse/query-core/src/main/java/datawave/query/attributes/UniqueFields.java @@ -27,6 +27,7 @@ * {@link UniqueFields#from(String)}. */ public class UniqueFields implements Serializable, Cloneable { + private static final long serialVersionUID = 1l; private final SortedSetMultimap fieldMap = TreeMultimap.create(); private boolean mostRecent = false; @@ -203,7 +204,9 @@ public UniqueFields putAll(Multimap fieldMap) { * Replace a field mapping with another field * * @param field + * the field * @param replacement + * the replacement field */ public void replace(String field, String replacement) { Collection value = fieldMap.removeAll(field); diff --git a/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupFields.java b/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupFields.java index b96d64d4409..6477d0108b7 100644 --- a/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupFields.java +++ b/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupFields.java @@ -30,6 +30,7 @@ * {@link GroupFields#from(String)}. */ public class GroupFields implements Serializable { + private static final long serialVersionUID = 1l; private static final String GROUP = "GROUP"; private static final String SUM = "SUM"; diff --git a/warehouse/query-core/src/main/java/datawave/query/common/grouping/Grouping.java b/warehouse/query-core/src/main/java/datawave/query/common/grouping/Grouping.java index 736dbb4c0da..ca650641439 100644 --- a/warehouse/query-core/src/main/java/datawave/query/common/grouping/Grouping.java +++ b/warehouse/query-core/src/main/java/datawave/query/common/grouping/Grouping.java @@ -11,6 +11,7 @@ * calculating the hashcode each time a search operation is performed on the keys of the maps. */ public class Grouping extends HashSet> { + private static final long serialVersionUID = 0l; public static final Grouping EMPTY_GROUPING = new Grouping(Collections.emptySet()); diff --git a/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupingAttribute.java b/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupingAttribute.java index 54db8ddf715..359e95e3bac 100644 --- a/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupingAttribute.java +++ b/warehouse/query-core/src/main/java/datawave/query/common/grouping/GroupingAttribute.java @@ -15,6 +15,7 @@ * the delegate type */ public class GroupingAttribute> extends TypeAttribute { + private static final long serialVersionUID = 0l; public GroupingAttribute(Type type, Key key, boolean toKeep) { super(type, key, toKeep); diff --git a/warehouse/query-core/src/main/java/datawave/query/common/grouping/ImmutableGrouping.java b/warehouse/query-core/src/main/java/datawave/query/common/grouping/ImmutableGrouping.java index a66a9e634de..58f51190786 100644 --- a/warehouse/query-core/src/main/java/datawave/query/common/grouping/ImmutableGrouping.java +++ b/warehouse/query-core/src/main/java/datawave/query/common/grouping/ImmutableGrouping.java @@ -7,6 +7,7 @@ * This class represents an immutable version of {@link Grouping} that cannot be modified. */ public class ImmutableGrouping extends Grouping { + private static final long serialVersionUID = 0l; public ImmutableGrouping(Collection> collection) { super(); diff --git a/warehouse/query-core/src/main/java/datawave/query/composite/CompositeUtils.java b/warehouse/query-core/src/main/java/datawave/query/composite/CompositeUtils.java index 2a6abee4a78..746b78ee08e 100644 --- a/warehouse/query-core/src/main/java/datawave/query/composite/CompositeUtils.java +++ b/warehouse/query-core/src/main/java/datawave/query/composite/CompositeUtils.java @@ -36,7 +36,7 @@ public static Map> getFieldToDiscreteIndexTypeMap(Mu type = (Type) typeObj; } else if (typeObj instanceof String) { try { - type = Class.forName(typeObj.toString()).asSubclass(Type.class).newInstance(); + type = Class.forName(typeObj.toString()).asSubclass(Type.class).getDeclaredConstructor().newInstance(); } catch (Exception e) { if (log.isTraceEnabled()) log.trace("Could not instantiate object for class [" + typeObj.toString() + "]"); diff --git a/warehouse/query-core/src/main/java/datawave/query/discovery/DiscoveryQueryConfiguration.java b/warehouse/query-core/src/main/java/datawave/query/discovery/DiscoveryQueryConfiguration.java index 57828ae33f7..4f688ec50e9 100644 --- a/warehouse/query-core/src/main/java/datawave/query/discovery/DiscoveryQueryConfiguration.java +++ b/warehouse/query-core/src/main/java/datawave/query/discovery/DiscoveryQueryConfiguration.java @@ -11,6 +11,7 @@ * Adds the ability to hold on to two multimaps. They map literals and patterns to the fields they were associated with in the query. */ public class DiscoveryQueryConfiguration extends ShardIndexQueryConfiguration { + private static final long serialVersionUID = 0l; private Multimap literals, patterns; private Multimap> ranges; private Boolean separateCountsByColVis = false; diff --git a/warehouse/query-core/src/main/java/datawave/query/exceptions/BooleanLogicFatalQueryException.java b/warehouse/query-core/src/main/java/datawave/query/exceptions/BooleanLogicFatalQueryException.java index e906c806a10..9bbbb5ce88d 100644 --- a/warehouse/query-core/src/main/java/datawave/query/exceptions/BooleanLogicFatalQueryException.java +++ b/warehouse/query-core/src/main/java/datawave/query/exceptions/BooleanLogicFatalQueryException.java @@ -5,6 +5,7 @@ * */ public class BooleanLogicFatalQueryException extends Exception { + private static final long serialVersionUID = 0l; private String query = ""; private String reason = ""; diff --git a/warehouse/query-core/src/main/java/datawave/query/exceptions/FieldNotMutableException.java b/warehouse/query-core/src/main/java/datawave/query/exceptions/FieldNotMutableException.java index 75420d4162c..a53a330edfd 100644 --- a/warehouse/query-core/src/main/java/datawave/query/exceptions/FieldNotMutableException.java +++ b/warehouse/query-core/src/main/java/datawave/query/exceptions/FieldNotMutableException.java @@ -5,6 +5,7 @@ * */ public class FieldNotMutableException extends Exception { + private static final long serialVersionUID = 0l; private String fieldName = ""; private String dataType = ""; diff --git a/warehouse/query-core/src/main/java/datawave/query/exceptions/InvalidQueryTreeException.java b/warehouse/query-core/src/main/java/datawave/query/exceptions/InvalidQueryTreeException.java index 54f66db58cf..09126427d66 100644 --- a/warehouse/query-core/src/main/java/datawave/query/exceptions/InvalidQueryTreeException.java +++ b/warehouse/query-core/src/main/java/datawave/query/exceptions/InvalidQueryTreeException.java @@ -4,6 +4,7 @@ * Thrown when an invalid query tree is encountered */ public class InvalidQueryTreeException extends Exception { + private static final long serialVersionUID = 0l; public InvalidQueryTreeException() { super(); diff --git a/warehouse/query-core/src/main/java/datawave/query/exceptions/LoadAverageWatchException.java b/warehouse/query-core/src/main/java/datawave/query/exceptions/LoadAverageWatchException.java index 7e04364aa2f..7dbc9e5f8c1 100644 --- a/warehouse/query-core/src/main/java/datawave/query/exceptions/LoadAverageWatchException.java +++ b/warehouse/query-core/src/main/java/datawave/query/exceptions/LoadAverageWatchException.java @@ -3,5 +3,5 @@ import java.io.IOException; public class LoadAverageWatchException extends IOException { - + private static final long serialVersionUID = 0l; } diff --git a/warehouse/query-core/src/main/java/datawave/query/function/LimitFields.java b/warehouse/query-core/src/main/java/datawave/query/function/LimitFields.java index c02016fae58..480a5bca356 100644 --- a/warehouse/query-core/src/main/java/datawave/query/function/LimitFields.java +++ b/warehouse/query-core/src/main/java/datawave/query/function/LimitFields.java @@ -295,7 +295,7 @@ private boolean isHit(String keyWithGrouping, Attribute attr, Multimap thing = (Type) clazz.newInstance(); + Type thing = (Type) clazz.getDeclaredConstructor().newInstance(); thing.setDelegateFromString(String.valueOf(hitValue)); hitValue = thing; } else { // otherwise, s is not a Type, just compare as string values @@ -377,6 +377,7 @@ protected String removeGrouping(String key) { * A map that assumes a value for missing keys. */ public static class CountMap extends HashMap { + private static final long serialVersionUID = 0l; private static final Integer ZERO = Integer.valueOf(0); @Override diff --git a/warehouse/query-core/src/main/java/datawave/query/iterator/CloseableListIterable.java b/warehouse/query-core/src/main/java/datawave/query/iterator/CloseableListIterable.java index 4d9c79d94aa..30647a50ccf 100644 --- a/warehouse/query-core/src/main/java/datawave/query/iterator/CloseableListIterable.java +++ b/warehouse/query-core/src/main/java/datawave/query/iterator/CloseableListIterable.java @@ -7,6 +7,7 @@ import datawave.query.CloseableIterable; public class CloseableListIterable extends ArrayList implements CloseableIterable { + private static final long serialVersionUID = 0l; public CloseableListIterable(Collection iter) { super(iter); diff --git a/warehouse/query-core/src/main/java/datawave/query/iterator/QueryOptions.java b/warehouse/query-core/src/main/java/datawave/query/iterator/QueryOptions.java index 0f108147785..d247e39a7e8 100644 --- a/warehouse/query-core/src/main/java/datawave/query/iterator/QueryOptions.java +++ b/warehouse/query-core/src/main/java/datawave/query/iterator/QueryOptions.java @@ -730,8 +730,8 @@ public List getDocumentPermutations() { throw new IllegalArgumentException("Unable to construct " + classname + " as a DocumentPermutation", e); } catch (NoSuchMethodException e) { try { - list.add(clazz.newInstance()); - } catch (InstantiationException | IllegalAccessException e2) { + list.add(clazz.getDeclaredConstructor().newInstance()); + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e2) { log.error("Unable to construct " + classname + " as a DocumentPermutation", e2); throw new IllegalArgumentException("Unable to construct " + classname + " as a DocumentPermutation", e2); } diff --git a/warehouse/query-core/src/main/java/datawave/query/jexl/DatawaveInterpreter.java b/warehouse/query-core/src/main/java/datawave/query/jexl/DatawaveInterpreter.java index 27d8461dcac..7456aa6cac2 100644 --- a/warehouse/query-core/src/main/java/datawave/query/jexl/DatawaveInterpreter.java +++ b/warehouse/query-core/src/main/java/datawave/query/jexl/DatawaveInterpreter.java @@ -148,7 +148,8 @@ public Object visit(ASTFunctionNode node, Object data) { * the variable name * @param undef * whether the variable is undefined or null - * @return + * + * @return null if it cannot be solved */ @Override protected Object unsolvableVariable(JexlNode node, String var, boolean undef) { @@ -168,7 +169,7 @@ protected Object unsolvableVariable(JexlNode node, String var, boolean undef) { * the method/function name * @param xany * the cause - * @return + * @return the JexlException */ @Override protected JexlException invocationException(JexlNode node, String methodName, Throwable xany) { diff --git a/warehouse/query-core/src/main/java/datawave/query/jexl/functions/EventFieldAggregator.java b/warehouse/query-core/src/main/java/datawave/query/jexl/functions/EventFieldAggregator.java index 81264fb192c..49bb9941d39 100644 --- a/warehouse/query-core/src/main/java/datawave/query/jexl/functions/EventFieldAggregator.java +++ b/warehouse/query-core/src/main/java/datawave/query/jexl/functions/EventFieldAggregator.java @@ -34,7 +34,7 @@ public class EventFieldAggregator extends IdentityAggregator { @Override public Type load(String clazz) throws Exception { Class c = Class.forName(clazz); - return (Type) c.newInstance(); + return (Type) c.getDeclaredConstructor().newInstance(); } }); diff --git a/warehouse/query-core/src/main/java/datawave/query/jexl/functions/JexlFunctionNamespaceRegistry.java b/warehouse/query-core/src/main/java/datawave/query/jexl/functions/JexlFunctionNamespaceRegistry.java index d67fcdc60a3..f1a15d5a8b4 100644 --- a/warehouse/query-core/src/main/java/datawave/query/jexl/functions/JexlFunctionNamespaceRegistry.java +++ b/warehouse/query-core/src/main/java/datawave/query/jexl/functions/JexlFunctionNamespaceRegistry.java @@ -1,5 +1,6 @@ package datawave.query.jexl.functions; +import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -72,10 +73,10 @@ public static Map getConfiguredFunctions() { log.debug(JEXL_FUNCTION_NAMESPACE_PROPERTY + "=" + className); if (className != null) { try { - JexlFunctionNamespaceRegistry base = (JexlFunctionNamespaceRegistry) Class.forName(className).newInstance(); + JexlFunctionNamespaceRegistry base = (JexlFunctionNamespaceRegistry) Class.forName(className).getDeclaredConstructor().newInstance(); return base.getRegisteredFunctions(); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) { log.warn("unable to create " + className + " with property " + JEXL_FUNCTION_NAMESPACE_PROPERTY, e); throw new RuntimeException("Could not create Jexl Function Registry object"); } diff --git a/warehouse/query-core/src/main/java/datawave/query/jexl/lookups/IndexLookupMap.java b/warehouse/query-core/src/main/java/datawave/query/jexl/lookups/IndexLookupMap.java index 9b7eafc5e89..caab414d0e9 100644 --- a/warehouse/query-core/src/main/java/datawave/query/jexl/lookups/IndexLookupMap.java +++ b/warehouse/query-core/src/main/java/datawave/query/jexl/lookups/IndexLookupMap.java @@ -12,6 +12,7 @@ */ @SuppressWarnings("serial") public class IndexLookupMap implements Map, Serializable { + private static final long serialVersionUID = 1l; private Set patterns = new HashSet<>(); private Map index = new HashMap<>(); private boolean exceededKeyThreshold = false; diff --git a/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/BaseIndexExpansionVisitor.java b/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/BaseIndexExpansionVisitor.java index c969eafdb26..bea77a68d37 100644 --- a/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/BaseIndexExpansionVisitor.java +++ b/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/BaseIndexExpansionVisitor.java @@ -195,6 +195,7 @@ protected void rebuildFutureJexlNodes() { * Serves as a placeholder Jexl node which can eventually be replaced with an expanded Jexl node once the Index Lookup has finished */ protected static class FutureJexlNode extends JexlNode { + private static final long serialVersionUID = 0l; private final JexlNode origNode; private final IndexLookup lookup; private final boolean ignoreComposites; diff --git a/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/whindex/DistributeAndedNodesVisitor.java b/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/whindex/DistributeAndedNodesVisitor.java index f2f7b6455e6..c827f400e74 100644 --- a/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/whindex/DistributeAndedNodesVisitor.java +++ b/warehouse/query-core/src/main/java/datawave/query/jexl/visitors/whindex/DistributeAndedNodesVisitor.java @@ -56,6 +56,7 @@ private DistributeAndedNodesVisitor(List andedNodes, Map candidates = p.findCandidateComponents("datawave.query.language.functions.jexl"); DEFAULT_ALLOWED_FUNCTION_LIST = candidates.stream().map(b -> { try { - return (JexlQueryFunction) (Class.forName(b.getBeanClassName()).newInstance()); + return (JexlQueryFunction) (Class.forName(b.getBeanClassName()).getDeclaredConstructor().newInstance()); } catch (Exception e) { return null; } diff --git a/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/AccumuloSyntaxParser.java b/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/AccumuloSyntaxParser.java index b9dd081637c..f8f1323c03b 100644 --- a/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/AccumuloSyntaxParser.java +++ b/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/AccumuloSyntaxParser.java @@ -725,7 +725,9 @@ final private Token jj_consume_token(int kind) throws ParseException { throw generateParseException(); } - static private final class LookaheadSuccess extends java.lang.Error {} + static private final class LookaheadSuccess extends java.lang.Error { + private static final long serialVersionUID = 0l; + } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); diff --git a/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/TokenMgrError.java b/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/TokenMgrError.java index 075b6c29095..52b4bfde040 100644 --- a/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/TokenMgrError.java +++ b/warehouse/query-core/src/main/java/datawave/query/language/parser/lucene/TokenMgrError.java @@ -2,6 +2,8 @@ package datawave.query.language.parser.lucene; public class TokenMgrError extends Error { + private static final long serialVersionUID = 0l; + /* * Ordinals for various reasons why an Error of this type can be thrown. */ diff --git a/warehouse/query-core/src/main/java/datawave/query/model/edge/EdgeQueryModel.java b/warehouse/query-core/src/main/java/datawave/query/model/edge/EdgeQueryModel.java index bbe67a4444a..dbf72a5934b 100644 --- a/warehouse/query-core/src/main/java/datawave/query/model/edge/EdgeQueryModel.java +++ b/warehouse/query-core/src/main/java/datawave/query/model/edge/EdgeQueryModel.java @@ -28,6 +28,7 @@ * (3) Additionally, index-only/unevaluated fields are ignored, as this concept is not applicable to edges. */ public class EdgeQueryModel extends QueryModel implements EdgeModelAware { + private static final long serialVersionUID = 0l; /** * This constructor allows the class to be used in conjunction with existing QueryModel loaders. diff --git a/warehouse/query-core/src/main/java/datawave/query/util/SortedKeyValueIteratorToIterator.java b/warehouse/query-core/src/main/java/datawave/query/util/SortedKeyValueIteratorToIterator.java index f5d5aeae046..711af5c2139 100644 --- a/warehouse/query-core/src/main/java/datawave/query/util/SortedKeyValueIteratorToIterator.java +++ b/warehouse/query-core/src/main/java/datawave/query/util/SortedKeyValueIteratorToIterator.java @@ -81,6 +81,7 @@ private Map.Entry findNext() { } public static class IteratorException extends RuntimeException implements Serializable { + private static final long serialVersionUID = 1l; public IteratorException() { super(); diff --git a/warehouse/query-core/src/main/java/datawave/query/util/cache/DatatypeLoader.java b/warehouse/query-core/src/main/java/datawave/query/util/cache/DatatypeLoader.java index 34752b15c94..130eed48c23 100644 --- a/warehouse/query-core/src/main/java/datawave/query/util/cache/DatatypeLoader.java +++ b/warehouse/query-core/src/main/java/datawave/query/util/cache/DatatypeLoader.java @@ -130,7 +130,7 @@ protected boolean store(String storeKey, Key key, Value value) { @SuppressWarnings("unchecked") Class> clazz = (Class>) Class.forName(colq.substring(idx + 1)); - Type normalizer = clazz.newInstance(); + Type normalizer = clazz.getDeclaredConstructor().newInstance(); typedNormalizers.put(type, normalizer); diff --git a/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerConfigLoader.java b/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerConfigLoader.java index c202ed628fc..bab4910b169 100644 --- a/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerConfigLoader.java +++ b/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerConfigLoader.java @@ -7,6 +7,7 @@ import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Map.Entry; @@ -138,8 +139,8 @@ protected void readFields(DataInput in) throws IOException { Class> clazz = (Class>) Class.forName(className); - normalizerMap.put(dataType, clazz.newInstance()); - } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) { + normalizerMap.put(dataType, clazz.getDeclaredConstructor().newInstance()); + } catch (InstantiationException | ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { log.error(e); } } diff --git a/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerLoader.java b/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerLoader.java index 3c65f6c5fb6..9a7a8d1f6f4 100644 --- a/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerLoader.java +++ b/warehouse/query-core/src/main/java/datawave/query/util/cache/NormalizerLoader.java @@ -133,7 +133,7 @@ protected boolean store(String storeKey, Key key, Value value) { @SuppressWarnings("unchecked") Class> clazz = (Class>) Class.forName(colq.substring(idx + 1)); - Type normalizer = clazz.newInstance(); + Type normalizer = clazz.getDeclaredConstructor().newInstance(); typedNormalizers.put(type, normalizer); diff --git a/warehouse/query-core/src/main/java/datawave/query/util/ssdeep/NGramScoreTuple.java b/warehouse/query-core/src/main/java/datawave/query/util/ssdeep/NGramScoreTuple.java index b6de2e012cf..a9773f96312 100644 --- a/warehouse/query-core/src/main/java/datawave/query/util/ssdeep/NGramScoreTuple.java +++ b/warehouse/query-core/src/main/java/datawave/query/util/ssdeep/NGramScoreTuple.java @@ -5,6 +5,7 @@ import datawave.util.ssdeep.SSDeepHash; public class NGramScoreTuple implements Serializable, Comparable { + private static final long serialVersionUID = 0l; final SSDeepHash ssDeepHash; final float baseScore; final int weightedScore; diff --git a/warehouse/query-core/src/test/java/datawave/query/RebuildingScannerTestHelper.java b/warehouse/query-core/src/test/java/datawave/query/RebuildingScannerTestHelper.java index ff5396df4d6..36ea93bedaf 100644 --- a/warehouse/query-core/src/test/java/datawave/query/RebuildingScannerTestHelper.java +++ b/warehouse/query-core/src/test/java/datawave/query/RebuildingScannerTestHelper.java @@ -1,6 +1,7 @@ package datawave.query; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.nio.ByteBuffer; import java.util.Collection; import java.util.Iterator; @@ -86,11 +87,15 @@ public enum INTERRUPT { public InterruptListener instance() { try { - return iclass.newInstance(); + return iclass.getDeclaredConstructor().newInstance(); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); } } } diff --git a/warehouse/query-core/src/test/java/datawave/query/edge/ExtendedEdgeQueryLogicTest.java b/warehouse/query-core/src/test/java/datawave/query/edge/ExtendedEdgeQueryLogicTest.java index b84c41eb4a5..d94d649fe0a 100644 --- a/warehouse/query-core/src/test/java/datawave/query/edge/ExtendedEdgeQueryLogicTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/edge/ExtendedEdgeQueryLogicTest.java @@ -177,7 +177,7 @@ public void testSelectorExtractor() throws Exception { q.addParameter("delimiter", ","); q.addParameter("query.syntax", "LIST"); - List expected = new ArrayList(); + List expected = new ArrayList<>(); expected.add("MARS"); expected.add("JUPITER"); expected.add("VENUS"); diff --git a/warehouse/query-core/src/test/java/datawave/query/iterator/CommaFreeType.java b/warehouse/query-core/src/test/java/datawave/query/iterator/CommaFreeType.java index 4e336e954b9..41c2daad560 100644 --- a/warehouse/query-core/src/test/java/datawave/query/iterator/CommaFreeType.java +++ b/warehouse/query-core/src/test/java/datawave/query/iterator/CommaFreeType.java @@ -7,11 +7,14 @@ * Purely testing type to remove all commas from a string. */ public class CommaFreeType extends BaseType { + private static final long serialVersionUID = 0l; + public CommaFreeType() { super(new CommaNormalizer()); } public static class CommaNormalizer extends AbstractNormalizer { + private static final long serialVersionUID = 0l; @Override public String normalize(String s) { diff --git a/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExpandCompositeTermsTest.java b/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExpandCompositeTermsTest.java index f7ac5d0e1fe..64f67fcf9e1 100644 --- a/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExpandCompositeTermsTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExpandCompositeTermsTest.java @@ -1253,6 +1253,7 @@ void showIt(String message, ASTJexlScript script) { } private static class MockDiscreteIndexType extends BaseType implements DiscreteIndexType { + private static final long serialVersionUID = 0l; public MockDiscreteIndexType() { super(new NoOpNormalizer()); diff --git a/warehouse/query-core/src/test/java/datawave/query/predicate/DocumentKeyToFieldNameTest.java b/warehouse/query-core/src/test/java/datawave/query/predicate/DocumentKeyToFieldNameTest.java index 5fdae865767..a308ec18408 100644 --- a/warehouse/query-core/src/test/java/datawave/query/predicate/DocumentKeyToFieldNameTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/predicate/DocumentKeyToFieldNameTest.java @@ -122,6 +122,7 @@ private Iterator>>>> tr } private static class TestDatatype extends BaseType { + private static final long serialVersionUID = 0l; public TestDatatype(String delegateString, Normalizer normalizer) { super(delegateString, normalizer); diff --git a/warehouse/query-core/src/test/java/datawave/query/testframework/AbstractFunctionalQuery.java b/warehouse/query-core/src/test/java/datawave/query/testframework/AbstractFunctionalQuery.java index a6ac089850a..bf96e096195 100644 --- a/warehouse/query-core/src/test/java/datawave/query/testframework/AbstractFunctionalQuery.java +++ b/warehouse/query-core/src/test/java/datawave/query/testframework/AbstractFunctionalQuery.java @@ -470,7 +470,7 @@ protected void runCountTest(String query) throws Exception { RunningQuery runner = new RunningQuery(client, AccumuloConnectionFactory.Priority.NORMAL, this.countLogic, q, "", principal, new QueryMetricFactoryImpl()); - TransformIterator it = runner.getTransformIterator(); + TransformIterator it = runner.getTransformIterator(); ShardQueryCountTableTransformer ctt = (ShardQueryCountTableTransformer) it.getTransformer(); EventQueryResponseBase resp = (EventQueryResponseBase) ctt.createResponse(runner.next()); @@ -481,7 +481,7 @@ protected void runCountTest(String query) throws Exception { EventBase event = events.get(0); List fields = event.getFields(); Assert.assertEquals(1, fields.size()); - FieldBase count = (FieldBase) fields.get(0); + FieldBase count = (FieldBase) fields.get(0); String val = count.getValueString(); if (log.isDebugEnabled()) { log.debug("expected count(" + expect.size() + ") actual count(" + val + ")"); diff --git a/warehouse/query-core/src/test/java/datawave/query/testframework/RawDataManager.java b/warehouse/query-core/src/test/java/datawave/query/testframework/RawDataManager.java index 373e8e5cfc7..d833a0cfdfb 100644 --- a/warehouse/query-core/src/test/java/datawave/query/testframework/RawDataManager.java +++ b/warehouse/query-core/src/test/java/datawave/query/testframework/RawDataManager.java @@ -88,7 +88,7 @@ public interface RawDataManager { * name of header field * @return normalizer for valid field name */ - Normalizer getNormalizer(String field); + Normalizer getNormalizer(String field); /** * Converts part of a query using ANY_FIELD into an equivalent string that includes all of the indexed fields. This is performed before the JEXL expression diff --git a/warehouse/query-core/src/test/java/datawave/query/util/CompositeTestingIngest.java b/warehouse/query-core/src/test/java/datawave/query/util/CompositeTestingIngest.java index c3905ac2eba..eeb58ad7cd0 100644 --- a/warehouse/query-core/src/test/java/datawave/query/util/CompositeTestingIngest.java +++ b/warehouse/query-core/src/test/java/datawave/query/util/CompositeTestingIngest.java @@ -391,6 +391,7 @@ private static Value getValueForNuthinAndYourHitsForFree() { } public static class PigLatinNormalizer extends AbstractNormalizer { + private static final long serialVersionUID = 0l; final String vowels = "aeiou"; @@ -446,6 +447,7 @@ public PigLatinType(String delegateString) { } public static class UcNormalizer extends AbstractNormalizer { + private static final long serialVersionUID = 0l; public String normalize(String fieldValue) { return fieldValue.toUpperCase(Locale.ENGLISH); diff --git a/warehouse/query-core/src/test/java/datawave/query/util/MockMetadataHelper.java b/warehouse/query-core/src/test/java/datawave/query/util/MockMetadataHelper.java index ec2e9d4db74..c8f1fdaf8ce 100644 --- a/warehouse/query-core/src/test/java/datawave/query/util/MockMetadataHelper.java +++ b/warehouse/query-core/src/test/java/datawave/query/util/MockMetadataHelper.java @@ -126,8 +126,8 @@ public void addFieldsToDatatypes(Multimap fieldsToDatatype) { getMetadata().allFields.addAll(fieldsToDatatype.keySet()); for (Map.Entry field : fieldsToDatatype.entries()) { try { - this.dataTypes.put(field.getKey(), Class.forName(field.getValue()).asSubclass(Type.class).newInstance()); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + this.dataTypes.put(field.getKey(), Class.forName(field.getValue()).asSubclass(Type.class).getDeclaredConstructor().newInstance()); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) { this.fieldsToDatatype.putAll(fieldsToDatatype); } } diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/ChunkSizeEncoding.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/ChunkSizeEncoding.java index b3d46b7d226..ddf9e411160 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/ChunkSizeEncoding.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/ChunkSizeEncoding.java @@ -27,6 +27,8 @@ //@formatter:on public class ChunkSizeEncoding implements Serializable { + private static final long serialVersionUID = 1L; + public static final int SPAMSUM_LENGTH = 64; public static final int MIN_CHUNK_SIZE = 3; diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/IntegerEncoding.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/IntegerEncoding.java index f3ff4393e1b..6a5867f9b63 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/IntegerEncoding.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/IntegerEncoding.java @@ -8,6 +8,8 @@ */ public class IntegerEncoding implements Serializable { + private static final long serialVersionUID = 1L; + // The number of distinct characters used for encoding final int base; // the target length of the encoding diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramGenerator.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramGenerator.java index e8cb81f8b10..03b80ada831 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramGenerator.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramGenerator.java @@ -26,6 +26,8 @@ public class NGramGenerator implements Serializable { */ public static final int DEFAULT_MIN_HASH_SIZE = 64; + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(NGramGenerator.class); final int ngramSize; diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramTuple.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramTuple.java index 3dbab4b2f70..532f83a6012 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramTuple.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/NGramTuple.java @@ -11,6 +11,8 @@ */ public class NGramTuple implements Serializable, Comparable { + private static final long serialVersionUID = 1L; + public static final String CHUNK_DELIMITER = ":"; final int chunkSize; diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepEncoding.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepEncoding.java index 9ca7a1fe5bb..ac3acc9a43f 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepEncoding.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepEncoding.java @@ -8,6 +8,8 @@ * characters here. As a result this implementation is more performant than alternatives built into java like 'String.getBytes()'. */ public class SSDeepEncoding implements Serializable { + private static final long serialVersionUID = 1L; + public byte[] encode(String ngram) { return encodeToBytes(ngram, new byte[ngram.length()], 0); } diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHash.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHash.java index bb00e6eb3d0..f561f4945b1 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHash.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHash.java @@ -9,6 +9,8 @@ /** An Immutable SSDeepHash object */ public final class SSDeepHash implements Serializable, Comparable { + private static final long serialVersionUID = 1L; + /** * The paper on Optimizing ssDeep for use at Scale" suggested that any hash with more than this many repeated characters should have that run of characters * reduced to this number of characters and suggested that 3 was a good number. This works well for our purposes as well. diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHashEditDistanceScorer.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHashEditDistanceScorer.java index ac207314e1d..59e87f46da4 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHashEditDistanceScorer.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepHashEditDistanceScorer.java @@ -76,6 +76,15 @@ public Integer apply(SSDeepHash signature1, SSDeepHash signature2) { /** * This is the low level chunk scoring algorithm. It takes two chunks and scores them on a scale of 0-100 where 0 is a terrible match and 100 is a great * match. The chunkSize is used to cope with very small messages. + * + * @param s1 + * the first chunk + * @param s2 + * the second chunk + * @param chunkSize + * size of the chunk + * + * @return the new score */ private static int scoreChunks(final String s1, final String s2, final int chunkSize) { final int len1 = s1.length(); @@ -113,7 +122,7 @@ private static int scoreChunks(final String s1, final String s2, final int chunk score = 100 - score; // When the chunk size is small we don't want to exaggerate the match. - final int threshold = (int) (chunkSize / SSDeepHash.MIN_CHUNK_SIZE * Math.min(len1, len2)); + final int threshold = (chunkSize / SSDeepHash.MIN_CHUNK_SIZE * Math.min(len1, len2)); if (score > threshold) { score = threshold; } diff --git a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepParseException.java b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepParseException.java index 49602d5a511..ca3fce77eaf 100644 --- a/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepParseException.java +++ b/warehouse/ssdeep-common/src/main/java/datawave/util/ssdeep/SSDeepParseException.java @@ -3,6 +3,9 @@ import java.nio.charset.StandardCharsets; public class SSDeepParseException extends RuntimeException { + + private static final long serialVersionUID = 1L; + final String message; final String input; diff --git a/web-services/atom/pom.xml b/web-services/atom/pom.xml index cc402a89e79..959960380f5 100644 --- a/web-services/atom/pom.xml +++ b/web-services/atom/pom.xml @@ -57,6 +57,10 @@ org.apache.ws.commons.axiom axiom-impl + + org.jboss.logging + jboss-logging + com.fasterxml.woodstox woodstox-core @@ -67,11 +71,6 @@ cdi-api provided - - org.jboss.logging - jboss-logging - provided - org.jboss.resteasy resteasy-jaxrs diff --git a/web-services/atom/src/test/java/datawave/webservice/atom/AtomKeyValueParserTest.java b/web-services/atom/src/test/java/datawave/webservice/atom/AtomKeyValueParserTest.java index 305671a4b47..849e6f82f97 100644 --- a/web-services/atom/src/test/java/datawave/webservice/atom/AtomKeyValueParserTest.java +++ b/web-services/atom/src/test/java/datawave/webservice/atom/AtomKeyValueParserTest.java @@ -1,5 +1,8 @@ package datawave.webservice.atom; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import org.apache.abdera.Abdera; @@ -11,17 +14,12 @@ import org.apache.hadoop.io.Text; import org.junit.Assert; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class AtomKeyValueParserTest { public AtomKeyValueParser kv; - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Before public void before() { kv = new AtomKeyValueParser(); @@ -43,8 +41,8 @@ public void testGettersAndSetters() { @Test public void testIDEncodeDecode() throws IOException { String id = "idForTests"; - String encodedID = kv.encodeId(id); - String decodedID = kv.decodeId(encodedID); + String encodedID = AtomKeyValueParser.encodeId(id); + String decodedID = AtomKeyValueParser.decodeId(encodedID); Assert.assertNotEquals(id, encodedID); Assert.assertNotEquals(decodedID, encodedID); @@ -72,10 +70,10 @@ public void testGoodParse() throws IOException { byte[] vals = new byte[4]; Value value = new Value(vals); - AtomKeyValueParser resultKV = kv.parse(key, value); + AtomKeyValueParser resultKV = AtomKeyValueParser.parse(key, value); Assert.assertEquals("row1", resultKV.getCollectionName()); - Assert.assertNotEquals(resultKV.getId(), kv.decodeId(resultKV.getId())); + Assert.assertNotEquals(resultKV.getId(), AtomKeyValueParser.decodeId(resultKV.getId())); Assert.assertEquals("color", resultKV.getUuid()); Assert.assertEquals("fi", resultKV.getValue()); } @@ -86,13 +84,8 @@ public void testMissingRowParts() { Key key = new Key(new Text("row1"), new Text("fi\0color"), new Text("red\0truck\0t-uid001")); byte[] vals = new byte[4]; Value value = new Value(vals); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Atom entry is missing row parts: row1 fi%00;color:red%00;truck%00;t-uid001 [] 9223372036854775807 false"); - try { - kv.parse(key, value); - } catch (IOException e) { - // Empty on purpose - } + Exception expectedEx = assertThrows(IllegalArgumentException.class, () -> AtomKeyValueParser.parse(key, value)); + assertTrue(expectedEx.getMessage().equals("Atom entry is missing row parts: row1 fi%00;color:red%00;truck%00;t-uid001 [] 9223372036854775807 false")); } @SuppressWarnings("static-access") @@ -102,7 +95,7 @@ public void testTooManyRowParts() { byte[] vals = new byte[4]; Value value = new Value(vals); try { - kv.parse(key, value); + AtomKeyValueParser.parse(key, value); } catch (IOException e) { // Empty on purpose } @@ -114,13 +107,8 @@ public void testDelimiterAtEnd() { Key key = new Key(new Text("row1\0"), new Text("fi\0color"), new Text("red\0truck\0t-uid001")); byte[] vals = new byte[4]; Value value = new Value(vals); - thrown.expect(ValueFormatException.class); - thrown.expectMessage("trying to convert to long, but byte array isn't long enough, wanted 8 found 0"); - try { - kv.parse(key, value); - } catch (IOException e) { - // Empty on purpose - } + Exception expectedEx = assertThrows(ValueFormatException.class, () -> AtomKeyValueParser.parse(key, value)); + assertTrue(expectedEx.getMessage().equals("trying to convert to long, but byte array isn't long enough, wanted 8 found 0")); } @SuppressWarnings("static-access") @@ -129,13 +117,8 @@ public void testMissingColQual() { Key key = new Key(new Text("row1\0row2and3"), new Text("fi"), new Text("red\0truck\0t-uid001")); byte[] vals = new byte[4]; Value value = new Value(vals); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Atom entry is missing column qualifier parts: "); - try { - kv.parse(key, value); - } catch (IOException e) { - // Empty catch because of ExpectedException - } + Exception expectedEx = assertThrows(IllegalArgumentException.class, () -> AtomKeyValueParser.parse(key, value)); + assertTrue(expectedEx.getMessage().contains("Atom entry is missing column qualifier parts: ")); } @SuppressWarnings("static-access") @@ -144,12 +127,7 @@ public void testBadDelimColQual() { Key key = new Key(new Text("row1\0row2and3"), new Text("fi\0"), new Text("red\0truck\0t-uid001")); byte[] vals = new byte[4]; Value value = new Value(vals); - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Atom entry is missing column qualifier parts: "); - try { - kv.parse(key, value); - } catch (IOException e) { - // Empty catch because of ExpectedException - } + Exception excpectedEx = assertThrows(IllegalArgumentException.class, () -> AtomKeyValueParser.parse(key, value)); + assertTrue(excpectedEx.getMessage().contains("Atom entry is missing column qualifier parts: ")); } } diff --git a/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsBean.java b/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsBean.java index 6246258eca2..4287d36dfd4 100644 --- a/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsBean.java +++ b/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsBean.java @@ -333,6 +333,7 @@ protected void loadBatch(PreparedStatement ps, String owner, String queryId, Str } + @SuppressWarnings("unchecked") protected GenericResponse load(@Required("queryId") String queryId, String alias, String nameBase) { GenericResponse response = new GenericResponse<>(); @@ -368,7 +369,7 @@ protected GenericResponse load(@Required("queryId") String queryId, Stri // This RunningQuery may be in use. Make a copy using the defined Query. RunningQuery rq = null; - QueryLogic logic = null; + QueryLogic logic = null; Query q = null; BaseQueryMetric queryMetric = null; try { @@ -435,7 +436,7 @@ protected GenericResponse load(@Required("queryId") String queryId, Stri } CacheableLogic cacheableLogic; - Transformer t = logic.getTransformer(q); + Transformer t = logic.getTransformer(q); // Audit the query. This may be duplicative if the caller called // QueryExecutorBean.create() or QueryExecutorBean.reset() first. @@ -538,7 +539,7 @@ protected GenericResponse load(@Required("queryId") String queryId, Stri for (CacheableQueryRow cacheableQueryObject : cacheableQueryRowList) { - Collection values = ((CacheableQueryRow) cacheableQueryObject).getColumnValues().values(); + Collection values = cacheableQueryObject.getColumnValues().values(); int maxValueLength = 0; for (String s : values) { if (s.length() > maxValueLength) { @@ -2479,11 +2480,11 @@ protected boolean createView(String tableName, String viewName, Connection con, return viewCreated; } - public QueryPredictor getPredictor() { + public QueryPredictor getPredictor() { return predictor; } - public void setPredictor(QueryPredictor predictor) { + public void setPredictor(QueryPredictor predictor) { this.predictor = predictor; } diff --git a/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedRunningQuery.java b/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedRunningQuery.java index 1b526db4fcb..f2dc24df5cd 100644 --- a/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedRunningQuery.java +++ b/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedRunningQuery.java @@ -63,7 +63,7 @@ public class CachedRunningQuery extends AbstractRunningQuery { private transient CacheableLogic cacheableLogic = null; private transient QueryLogic queryLogic = null; - private transient QueryLogicTransformer transformer = null; + private transient QueryLogicTransformer transformer = null; // gets set in previous and next private transient int lastPageNumber = 0; @@ -831,7 +831,7 @@ private ResultsPage convert(CachedRowSet cachedRowSet, long pageByteTrigger) { cachedRowSet.beforeFirst(); long resultBytes = 0; while (cachedRowSet.next() && !hitPageByteTrigger) { - CacheableQueryRow row = CacheableQueryRowReader.createRow(cachedRowSet, this.fixedFieldsInEvent, this.responseObjectFactory); + CacheableQueryRow row = CacheableQueryRowReader.createRow(cachedRowSet, this.fixedFieldsInEvent, CachedRunningQuery.responseObjectFactory); cacheableQueryRowList.add(row); if (pageByteTrigger != 0) { resultBytes += ObjectSizeOf.Sizer.getObjectSize(row); @@ -860,7 +860,7 @@ private ResultsPage convert(CachedRowSet cachedRowSet, Integer rowBegin, Integer while (cachedRowSet.next() && cachedRowSet.getRow() <= rowEnd && !hitPageByteTrigger) { if (log.isTraceEnabled()) log.trace("CRS.position: " + cachedRowSet.getRow() + ", size: " + cachedRowSet.size()); - CacheableQueryRow row = CacheableQueryRowReader.createRow(cachedRowSet, this.fixedFieldsInEvent, this.responseObjectFactory); + CacheableQueryRow row = CacheableQueryRowReader.createRow(cachedRowSet, this.fixedFieldsInEvent, CachedRunningQuery.responseObjectFactory); cacheableQueryRowList.add(row); if (pageByteTrigger != 0) { resultBytes += ObjectSizeOf.Sizer.getObjectSize(row); @@ -918,7 +918,7 @@ public int getTotalRows() { return totalRows; } - public QueryLogicTransformer getTransformer() { + public QueryLogicTransformer getTransformer() { return transformer; } @@ -1114,6 +1114,7 @@ public static void removeFromDatabase(String id) { } } + @SuppressWarnings("unchecked") public static CachedRunningQuery retrieveFromDatabase(String id, Principal principal, QueryMetricFactory metricFactory) { verifyCrqTableExists(); @@ -1166,7 +1167,7 @@ public static CachedRunningQuery retrieveFromDatabase(String id, Principal princ crq.variableFields.addAll(Arrays.asList(varFields.split(" "))); } - Query query = crq.responseObjectFactory.getQueryImpl(); + Query query = CachedRunningQuery.responseObjectFactory.getQueryImpl(); query.setQuery(resultSet.getString(x++)); Timestamp bDate = resultSet.getTimestamp(x++); diff --git a/web-services/client/src/main/java/datawave/webservice/modification/ModificationEventBase.java b/web-services/client/src/main/java/datawave/webservice/modification/ModificationEventBase.java index e5446ea0492..2d6ca72b7ef 100644 --- a/web-services/client/src/main/java/datawave/webservice/modification/ModificationEventBase.java +++ b/web-services/client/src/main/java/datawave/webservice/modification/ModificationEventBase.java @@ -10,7 +10,7 @@ @XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL) -public abstract class ModificationEventBase { +public abstract class ModificationEventBase> { @XmlElement(name = "id", required = true) protected String id = null; diff --git a/web-services/client/src/main/java/datawave/webservice/query/QueryImpl.java b/web-services/client/src/main/java/datawave/webservice/query/QueryImpl.java index d7afae71766..39cd01759e7 100644 --- a/web-services/client/src/main/java/datawave/webservice/query/QueryImpl.java +++ b/web-services/client/src/main/java/datawave/webservice/query/QueryImpl.java @@ -434,7 +434,7 @@ public QueryImpl duplicate(String newQueryName) { query.setDnList(this.dnList); if (MapUtils.isNotEmpty(this.optionalQueryParameters)) { Map> optionalDuplicate = new HashMap<>(); - this.optionalQueryParameters.entrySet().stream().forEach(e -> optionalDuplicate.put(e.getKey(), new ArrayList(e.getValue()))); + this.optionalQueryParameters.entrySet().stream().forEach(e -> optionalDuplicate.put(e.getKey(), new ArrayList<>(e.getValue()))); query.setOptionalQueryParameters(optionalDuplicate); } query.setUncaughtExceptionHandler(this.getUncaughtExceptionHandler()); @@ -660,6 +660,7 @@ public void mergeFrom(Input input, QueryImpl message) throws IOException { break; case 16: message.systemFrom = input.readString(); + break; default: input.handleUnknownField(number, this); break; diff --git a/web-services/client/src/main/java/datawave/webservice/query/QueryMessages.java b/web-services/client/src/main/java/datawave/webservice/query/QueryMessages.java index e9e69f40b92..3994353dd5c 100644 --- a/web-services/client/src/main/java/datawave/webservice/query/QueryMessages.java +++ b/web-services/client/src/main/java/datawave/webservice/query/QueryMessages.java @@ -255,7 +255,7 @@ public interface QueryImplOrBuilder extends com.google.protobuf.MessageLiteOrBui */ public static final class QueryImpl extends com.google.protobuf.GeneratedMessageLite implements QueryImplOrBuilder { // Use QueryImpl.newBuilder() to construct. - private QueryImpl(com.google.protobuf.GeneratedMessageLite.Builder builder) { + private QueryImpl(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } @@ -431,7 +431,7 @@ public interface ParameterOrBuilder extends com.google.protobuf.MessageLiteOrBui */ public static final class Parameter extends com.google.protobuf.GeneratedMessageLite implements ParameterOrBuilder { // Use Parameter.newBuilder() to construct. - private Parameter(com.google.protobuf.GeneratedMessageLite.Builder builder) { + private Parameter(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } @@ -2953,7 +2953,7 @@ public Builder addParameters(int index, datawave.webservice.query.QueryMessages. */ public Builder addAllParameters(java.lang.Iterable values) { ensureParametersIsMutable(); - super.addAll(values, parameters_); + Builder.addAll(values, parameters_); return this; } diff --git a/web-services/client/src/main/java/datawave/webservice/query/exception/ExceptionMessages.java b/web-services/client/src/main/java/datawave/webservice/query/exception/ExceptionMessages.java index 9f5d0a788b7..518461997e1 100644 --- a/web-services/client/src/main/java/datawave/webservice/query/exception/ExceptionMessages.java +++ b/web-services/client/src/main/java/datawave/webservice/query/exception/ExceptionMessages.java @@ -60,7 +60,7 @@ public interface QueryExceptionTypeOrBuilder extends com.google.protobuf.Message */ public static final class QueryExceptionType extends com.google.protobuf.GeneratedMessageLite implements QueryExceptionTypeOrBuilder { // Use QueryExceptionType.newBuilder() to construct. - private QueryExceptionType(com.google.protobuf.GeneratedMessageLite.Builder builder) { + private QueryExceptionType(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } diff --git a/web-services/client/src/main/java/datawave/webservice/query/map/QueryGeometry.java b/web-services/client/src/main/java/datawave/webservice/query/map/QueryGeometry.java index 673733b849a..6e7c20650f3 100644 --- a/web-services/client/src/main/java/datawave/webservice/query/map/QueryGeometry.java +++ b/web-services/client/src/main/java/datawave/webservice/query/map/QueryGeometry.java @@ -16,6 +16,8 @@ @XmlAccessorType(XmlAccessType.NONE) public class QueryGeometry implements Serializable { + private static final long serialVersionUID = 1l; + @XmlElement private String function; @XmlElement diff --git a/web-services/client/src/main/java/datawave/webservice/query/result/EdgeQueryResponseBase.java b/web-services/client/src/main/java/datawave/webservice/query/result/EdgeQueryResponseBase.java index 3eb93f761d9..d44660ff858 100644 --- a/web-services/client/src/main/java/datawave/webservice/query/result/EdgeQueryResponseBase.java +++ b/web-services/client/src/main/java/datawave/webservice/query/result/EdgeQueryResponseBase.java @@ -15,6 +15,8 @@ public abstract class EdgeQueryResponseBase extends BaseQueryResponse implements protected Map markings; + private static final long serialVersionUID = 0l; + public abstract void addEdge(EdgeBase edge); public abstract void setEdges(List edges); diff --git a/web-services/client/src/main/java/datawave/webservice/query/result/event/FacetsBase.java b/web-services/client/src/main/java/datawave/webservice/query/result/event/FacetsBase.java index 4b75c95241a..d5f6423dc4d 100644 --- a/web-services/client/src/main/java/datawave/webservice/query/result/event/FacetsBase.java +++ b/web-services/client/src/main/java/datawave/webservice/query/result/event/FacetsBase.java @@ -28,6 +28,7 @@ public abstract class FacetsBase implements HasMarkings { @XmlTransient protected ColumnVisibility columnVisibility; + @SuppressWarnings("unchecked") public void setFields(List fields) { this.fields = (List) fields; } diff --git a/web-services/client/src/main/java/datawave/webservice/result/EventQueryResponseBase.java b/web-services/client/src/main/java/datawave/webservice/result/EventQueryResponseBase.java index 082362242fb..86177a65dc3 100644 --- a/web-services/client/src/main/java/datawave/webservice/result/EventQueryResponseBase.java +++ b/web-services/client/src/main/java/datawave/webservice/result/EventQueryResponseBase.java @@ -6,6 +6,8 @@ public abstract class EventQueryResponseBase extends BaseQueryResponse { + private static final long serialVersionUID = 1l; + public abstract Long getTotalEvents(); public abstract long getTotalResults(); diff --git a/web-services/client/src/main/java/datawave/webservice/result/FacetQueryResponseBase.java b/web-services/client/src/main/java/datawave/webservice/result/FacetQueryResponseBase.java index 1d3e92b645f..4651360b2b7 100644 --- a/web-services/client/src/main/java/datawave/webservice/result/FacetQueryResponseBase.java +++ b/web-services/client/src/main/java/datawave/webservice/result/FacetQueryResponseBase.java @@ -14,6 +14,7 @@ */ @XmlAccessorType(XmlAccessType.NONE) public abstract class FacetQueryResponseBase extends BaseQueryResponse implements HasMarkings { + private static final long serialVersionUID = 1l; protected transient Map markings; diff --git a/web-services/client/src/main/java/datawave/webservice/result/MetadataQueryResponseBase.java b/web-services/client/src/main/java/datawave/webservice/result/MetadataQueryResponseBase.java index 597382cd5d2..7a8a5b50c72 100644 --- a/web-services/client/src/main/java/datawave/webservice/result/MetadataQueryResponseBase.java +++ b/web-services/client/src/main/java/datawave/webservice/result/MetadataQueryResponseBase.java @@ -7,6 +7,7 @@ import io.protostuff.Message; public abstract class MetadataQueryResponseBase extends BaseQueryResponse implements Serializable, TotalResultsAware, Message { + private static final long serialVersionUID = 1l; public abstract List getFields(); diff --git a/web-services/client/src/main/java/datawave/webservice/result/QueryImplListResponse.java b/web-services/client/src/main/java/datawave/webservice/result/QueryImplListResponse.java index 743e1bd9247..ee2f42a6e36 100644 --- a/web-services/client/src/main/java/datawave/webservice/result/QueryImplListResponse.java +++ b/web-services/client/src/main/java/datawave/webservice/result/QueryImplListResponse.java @@ -77,25 +77,25 @@ public boolean isInitialized(QueryImplListResponse message) { return true; } + @SuppressWarnings("unchecked") public void writeTo(Output output, QueryImplListResponse message) throws IOException { - Class clazz = null; Schema schema = null; if (message.numResults != 0) output.writeUInt32(1, message.numResults, false); if (message.query != null) { - for (Query query : message.query) { - if (query != null) { + for (Query messageQuery : message.query) { + if (messageQuery != null) { if (null == clazz) { - clazz = (Class) query.getClass(); + clazz = messageQuery.getClass(); output.writeString(6, clazz.getName(), false); } - if ((null == schema) && (query instanceof Message)) { - Message m = (Message) query; + if ((null == schema) && (messageQuery instanceof Message)) { + Message m = (Message) messageQuery; schema = m.cachedSchema(); } - output.writeObject(2, query, schema, true); + output.writeObject(2, messageQuery, schema, true); } } } @@ -119,6 +119,7 @@ public void writeTo(Output output, QueryImplListResponse message) throws IOExcep } } + @SuppressWarnings("unchecked") public void mergeFrom(Input input, QueryImplListResponse message) throws IOException { LinkedList exceptions = null; int number; @@ -131,7 +132,7 @@ public void mergeFrom(Input input, QueryImplListResponse message) throws IOExcep break; case 2: if (message.query == null) { - message.query = new ArrayList(); + message.query = new ArrayList<>(); } if (null == schema) { Class clazz = null; @@ -156,7 +157,7 @@ public void mergeFrom(Input input, QueryImplListResponse message) throws IOExcep break; case 5: if (exceptions == null) - exceptions = new LinkedList(); + exceptions = new LinkedList<>(); exceptions.add(input.mergeObject(null, QueryExceptionType.getSchema())); break; case 6: @@ -191,10 +192,10 @@ public String getFieldName(int number) { public int getFieldNumber(String name) { final Integer number = fieldMap.get(name); - return number == null ? 0 : number.intValue(); + return number == null ? 0 : number; } - final java.util.HashMap fieldMap = new java.util.HashMap(); + final java.util.HashMap fieldMap = new java.util.HashMap<>(); { fieldMap.put("numResults", 1); fieldMap.put("query", 2); diff --git a/web-services/client/src/main/java/datawave/webservice/result/QueryWizardResultResponse.java b/web-services/client/src/main/java/datawave/webservice/result/QueryWizardResultResponse.java index a1cbff09953..df863821aba 100644 --- a/web-services/client/src/main/java/datawave/webservice/result/QueryWizardResultResponse.java +++ b/web-services/client/src/main/java/datawave/webservice/result/QueryWizardResultResponse.java @@ -110,13 +110,13 @@ public String getMainContent() { builder.append(""); String dataType = ""; - for (EventBase event : tempResponse.getEvents()) { + for (EventBase event : tempResponse.getEvents()) { dataType = event.getMetadata().getDataType(); builder.append(""); putTableCell(builder, dataType); for (Object field : event.getFields()) { if (field instanceof FieldBase) { - FieldBase defaultField = (FieldBase) field; + FieldBase defaultField = (FieldBase) field; fieldNameToValueMap.put(defaultField.getName(), defaultField.getValueString()); } } @@ -147,10 +147,10 @@ public String getMainContent() { builder.append(""); } } else if (response instanceof MetadataQueryResponseBase) { - MetadataQueryResponseBase tempResponse = (MetadataQueryResponseBase) response; + MetadataQueryResponseBase tempResponse = (MetadataQueryResponseBase) response; builder.append("Field NameInternal Field NameData TypeLast UpdatedIndex only"); builder.append(""); - for (MetadataFieldBase field : ((List) (tempResponse.getFields()))) { + for (MetadataFieldBase field : (tempResponse.getFields())) { builder.append(""); putTableCell(builder, field.getFieldName()); putTableCell(builder, field.getInternalFieldName()); @@ -194,10 +194,10 @@ private HashSet buildTableColumnHeadings(StringBuilder builder, EventQue HashSet fieldnameSet = new HashSet<>(); builder.append("DataType"); - for (EventBase event : tempResponse.getEvents()) { + for (EventBase event : tempResponse.getEvents()) { for (Object field : event.getFields()) { if (field instanceof FieldBase) { - fieldnameSet.add(((FieldBase) field).getName()); + fieldnameSet.add(((FieldBase) field).getName()); } } } diff --git a/web-services/client/src/main/java/datawave/webservice/result/ResponseMessages.java b/web-services/client/src/main/java/datawave/webservice/result/ResponseMessages.java index 9036b931e6c..97cb6912a36 100644 --- a/web-services/client/src/main/java/datawave/webservice/result/ResponseMessages.java +++ b/web-services/client/src/main/java/datawave/webservice/result/ResponseMessages.java @@ -91,7 +91,7 @@ public interface VoidResponseOrBuilder extends com.google.protobuf.MessageLiteOr */ public static final class VoidResponse extends com.google.protobuf.GeneratedMessageLite implements VoidResponseOrBuilder { // Use VoidResponse.newBuilder() to construct. - private VoidResponse(com.google.protobuf.GeneratedMessageLite.Builder builder) { + private VoidResponse(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } @@ -701,7 +701,7 @@ public Builder addMessages(java.lang.String value) { */ public Builder addAllMessages(java.lang.Iterable values) { ensureMessagesIsMutable(); - super.addAll(values, messages_); + Builder.addAll(values, messages_); return this; } @@ -893,7 +893,7 @@ public Builder addExceptions(int index, datawave.webservice.query.exception.Exce */ public Builder addAllExceptions(java.lang.Iterable values) { ensureExceptionsIsMutable(); - super.addAll(values, exceptions_); + Builder.addAll(values, exceptions_); return this; } @@ -1059,7 +1059,7 @@ public interface QueryImplListResponseOrBuilder extends com.google.protobuf.Mess */ public static final class QueryImplListResponse extends com.google.protobuf.GeneratedMessageLite implements QueryImplListResponseOrBuilder { // Use QueryImplListResponse.newBuilder() to construct. - private QueryImplListResponse(com.google.protobuf.GeneratedMessageLite.Builder builder) { + private QueryImplListResponse(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } @@ -1816,7 +1816,7 @@ public Builder addMessages(java.lang.String value) { */ public Builder addAllMessages(java.lang.Iterable values) { ensureMessagesIsMutable(); - super.addAll(values, messages_); + Builder.addAll(values, messages_); return this; } @@ -2008,7 +2008,7 @@ public Builder addExceptions(int index, datawave.webservice.query.exception.Exce */ public Builder addAllExceptions(java.lang.Iterable values) { ensureExceptionsIsMutable(); - super.addAll(values, exceptions_); + Builder.addAll(values, exceptions_); return this; } @@ -2197,7 +2197,7 @@ public Builder addQuery(int index, datawave.webservice.query.QueryMessages.Query */ public Builder addAllQuery(java.lang.Iterable values) { ensureQueryIsMutable(); - super.addAll(values, query_); + Builder.addAll(values, query_); return this; } @@ -2521,7 +2521,7 @@ public interface GenericResponseOrBuilder extends com.google.protobuf.MessageLit */ public static final class GenericResponse extends com.google.protobuf.GeneratedMessageLite implements GenericResponseOrBuilder { // Use GenericResponse.newBuilder() to construct. - private GenericResponse(com.google.protobuf.GeneratedMessageLite.Builder builder) { + private GenericResponse(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } @@ -3603,7 +3603,7 @@ public Builder addMessages(java.lang.String value) { */ public Builder addAllMessages(java.lang.Iterable values) { ensureMessagesIsMutable(); - super.addAll(values, messages_); + Builder.addAll(values, messages_); return this; } @@ -3795,7 +3795,7 @@ public Builder addExceptions(int index, datawave.webservice.query.exception.Exce */ public Builder addAllExceptions(java.lang.Iterable values) { ensureExceptionsIsMutable(); - super.addAll(values, exceptions_); + Builder.addAll(values, exceptions_); return this; } diff --git a/web-services/client/src/main/java/datawave/webservice/results/ingest/file/FileDetails.java b/web-services/client/src/main/java/datawave/webservice/results/ingest/file/FileDetails.java index 2533c639df8..23e9b4389c1 100644 --- a/web-services/client/src/main/java/datawave/webservice/results/ingest/file/FileDetails.java +++ b/web-services/client/src/main/java/datawave/webservice/results/ingest/file/FileDetails.java @@ -16,6 +16,8 @@ @XmlAccessorType(XmlAccessType.NONE) public class FileDetails implements Serializable, Message { + + private static final long serialVersionUID = 1l; @XmlAttribute(name = "filePath") private String path; @XmlAttribute(name = "dateReceived") diff --git a/web-services/client/src/test/java/datawave/webservice/query/data/ObjectSizeOfTest.java b/web-services/client/src/test/java/datawave/webservice/query/data/ObjectSizeOfTest.java index de5fa71c788..607f6f0e191 100644 --- a/web-services/client/src/test/java/datawave/webservice/query/data/ObjectSizeOfTest.java +++ b/web-services/client/src/test/java/datawave/webservice/query/data/ObjectSizeOfTest.java @@ -60,20 +60,20 @@ public void testRoundUp() { @Test public void testNumbers() { assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(Boolean.TRUE)); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Byte((byte) 1))); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Character((char) 1))); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Short((short) 1))); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Integer(1))); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Float(1))); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Long(1))); - assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(new Double(1))); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize((byte) 1)); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize((char) 1)); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize((short) 1)); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(1)); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(1F)); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(1L)); + assertEquals(16, ObjectSizeOf.Sizer.getObjectSize(1.0)); } @Test public void testObjects() { List list = new ArrayList(10); - list.add(new Long(1)); - list.add(new Double(1)); + list.add(1L); + list.add(1.0); int overhead = 8; int arrayoverhead = 12; int reference = 4; diff --git a/web-services/common-util/src/main/java/datawave/configuration/ConfigExtension.java b/web-services/common-util/src/main/java/datawave/configuration/ConfigExtension.java index cad84d27c7c..d940fb7eddc 100644 --- a/web-services/common-util/src/main/java/datawave/configuration/ConfigExtension.java +++ b/web-services/common-util/src/main/java/datawave/configuration/ConfigExtension.java @@ -19,7 +19,7 @@ * find a resource on the class path matching the class' name and path. The xml resource is a jax-b serialized version of the configuration object. */ public class ConfigExtension implements Extension { - @SuppressWarnings("unused") + @SuppressWarnings({"unused", "unchecked"}) void processInjectionTarget(@Observes ProcessInjectionTarget pit) { final InjectionTarget it = pit.getInjectionTarget(); diff --git a/web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java b/web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java index 8e798e79be6..56f480b144f 100644 --- a/web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java +++ b/web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java @@ -27,6 +27,8 @@ @XmlType(factoryMethod = "anonymousPrincipal", propOrder = {"name", "proxiedUsers", "creationTime"}) @XmlAccessorType(XmlAccessType.NONE) public class DatawavePrincipal implements ProxiedUserDetails, Principal, Serializable { + + private static final long serialVersionUID = 1L; private final String username; private final DatawaveUser primaryUser; @XmlElement diff --git a/web-services/common-util/src/main/java/datawave/security/authorization/UserOperations.java b/web-services/common-util/src/main/java/datawave/security/authorization/UserOperations.java index 0f5b090b46e..e30363eb2cc 100644 --- a/web-services/common-util/src/main/java/datawave/security/authorization/UserOperations.java +++ b/web-services/common-util/src/main/java/datawave/security/authorization/UserOperations.java @@ -19,13 +19,13 @@ */ public interface UserOperations { - AuthorizationsListBase listEffectiveAuthorizations(Object callerObject) throws AuthorizationException; + AuthorizationsListBase listEffectiveAuthorizations(Object callerObject) throws AuthorizationException; GenericResponse flushCachedCredentials(Object callerObject) throws AuthorizationException; default DatawavePrincipal getRemoteUser(DatawavePrincipal principal) throws AuthorizationException { // get the effective authorizations for this user - AuthorizationsListBase auths = listEffectiveAuthorizations(principal); + AuthorizationsListBase auths = listEffectiveAuthorizations(principal); // create a new set of proxied users List mappedUsers = new ArrayList<>(); diff --git a/web-services/common-util/src/test/java/datawave/resteasy/interceptor/CreateQuerySessionIDFilterTest.java b/web-services/common-util/src/test/java/datawave/resteasy/interceptor/CreateQuerySessionIDFilterTest.java index d60922713f5..8d0436971e4 100644 --- a/web-services/common-util/src/test/java/datawave/resteasy/interceptor/CreateQuerySessionIDFilterTest.java +++ b/web-services/common-util/src/test/java/datawave/resteasy/interceptor/CreateQuerySessionIDFilterTest.java @@ -6,6 +6,7 @@ import java.lang.annotation.Annotation; +import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.core.NewCookie; import javax.ws.rs.core.Response; @@ -15,6 +16,7 @@ import org.easymock.Mock; import org.easymock.MockType; import org.jboss.resteasy.core.ResourceMethodInvoker; +import org.jboss.resteasy.core.ServerResponseWriter; import org.jboss.resteasy.core.interception.ContainerResponseContextImpl; import org.jboss.resteasy.core.interception.ResponseContainerRequestContext; import org.jboss.resteasy.mock.MockHttpRequest; @@ -56,7 +58,8 @@ public Class annotationType() { request = new ResponseContainerRequestContext(MockHttpRequest.post("/mock")); request.setProperty(ResourceMethodInvoker.class.getName(), method); - response = new ContainerResponseContextImpl(request.getHttpRequest(), new MockHttpResponse(), new BuiltResponse()); + response = new ContainerResponseContextImpl(request.getHttpRequest(), new MockHttpResponse(), new BuiltResponse(), null, new ContainerResponseFilter[0], + (t) -> {}, null); filter = new CreateQuerySessionIDFilter(); } @@ -83,7 +86,7 @@ public void filterNoQueryId() throws Exception { // More method calls due to logging the error about QUERY_ID threadlocal not set. EasyMock.expect(method.getResourceClass()).andReturn(null); // noinspection ConfusingArgumentToVarargsMethod - EasyMock.expect(method.getMethod()).andReturn(getClass().getMethod("filterNoQueryId", null)); + EasyMock.expect(method.getMethod()).andReturn(getClass().getMethod("filterNoQueryId")); replayAll(); CreateQuerySessionIDFilter.QUERY_ID.set(null); diff --git a/web-services/common-util/src/test/java/datawave/security/util/WSAuthorizationsUtilTest.java b/web-services/common-util/src/test/java/datawave/security/util/WSAuthorizationsUtilTest.java index 17067e0c025..f3c789a350c 100644 --- a/web-services/common-util/src/test/java/datawave/security/util/WSAuthorizationsUtilTest.java +++ b/web-services/common-util/src/test/java/datawave/security/util/WSAuthorizationsUtilTest.java @@ -229,7 +229,7 @@ public void testBuilidAuthorizationString() { @Test public void testBuildUserAuthorizationsString() throws Exception { String expected = new Authorizations("A", "C", "D").toString(); - assertEquals(expected, WSAuthorizationsUtil.buildUserAuthorizationString((DatawavePrincipal) proxiedUserPrincipal)); + assertEquals(expected, WSAuthorizationsUtil.buildUserAuthorizationString(proxiedUserPrincipal)); } @Test @@ -263,19 +263,18 @@ public void testMergeUsers() { @Test(expected = IllegalArgumentException.class) public void testCannotMergeUser() { - WSAuthorizationsUtil.mergeUsers(((DatawavePrincipal) proxiedServerPrincipal1).getPrimaryUser(), - ((DatawavePrincipal) proxiedServerPrincipal2).getPrimaryUser()); + WSAuthorizationsUtil.mergeUsers(proxiedServerPrincipal1.getPrimaryUser(), proxiedServerPrincipal2.getPrimaryUser()); } @Test public void testMergePrincipals() { - DatawavePrincipal merged = WSAuthorizationsUtil.mergePrincipals((DatawavePrincipal) proxiedUserPrincipal, (DatawavePrincipal) remoteUserPrincipal); - assertPrincipalEquals((DatawavePrincipal) overallUserPrincipal, merged); + DatawavePrincipal merged = WSAuthorizationsUtil.mergePrincipals(proxiedUserPrincipal, remoteUserPrincipal); + assertPrincipalEquals(overallUserPrincipal, merged); } @Test(expected = IllegalArgumentException.class) public void testCannotMergePrincipal() { - WSAuthorizationsUtil.mergePrincipals((DatawavePrincipal) proxiedServerPrincipal1, (DatawavePrincipal) proxiedServerPrincipal2); + WSAuthorizationsUtil.mergePrincipals(proxiedServerPrincipal1, proxiedServerPrincipal2); } private void assertUserEquals(DatawaveUser user1, DatawaveUser user2) { diff --git a/web-services/common/src/main/java/datawave/metrics/MetricsCdiConfiguration.java b/web-services/common/src/main/java/datawave/metrics/MetricsCdiConfiguration.java index 4605a3cfd7f..432f53efd8a 100644 --- a/web-services/common/src/main/java/datawave/metrics/MetricsCdiConfiguration.java +++ b/web-services/common/src/main/java/datawave/metrics/MetricsCdiConfiguration.java @@ -1,5 +1,6 @@ package datawave.metrics; +import java.lang.reflect.InvocationTargetException; import java.util.concurrent.TimeUnit; import javax.annotation.PreDestroy; @@ -27,14 +28,14 @@ public MetricRegistry metricRegistry(@ConfigProperty(name = "dw.metrics.reporter @ConfigProperty(name = "dw.metrics.reporter.class", defaultValue = "datawave.metrics.TimelyMetricsReporterFactory") String reporterClass) { MetricRegistry metricRegistry = new MetricRegistry(); try { - MetricsReporterFactory factory = MetricsReporterFactory.class.cast(Class.forName(reporterClass).newInstance()); + MetricsReporterFactory factory = MetricsReporterFactory.class.cast(Class.forName(reporterClass).getDeclaredConstructor().newInstance()); statsReporter = factory.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build(reportHost, reportPort); statsReporter.start(reportInterval, TimeUnit.valueOf(reportIntervalTimeUnit)); } catch (ClassNotFoundException e) { throw new IllegalArgumentException( "Metrics reporter class " + reporterClass + " does not exist or is not a " + MetricsReporterFactory.class.getName(), e); - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new IllegalArgumentException("Metrics reporter class " + reporterClass + " could not be instantiated: " + e.getMessage(), e); } return metricRegistry; diff --git a/web-services/map-reduce/src/main/java/datawave/webservice/mr/MapReduceBean.java b/web-services/map-reduce/src/main/java/datawave/webservice/mr/MapReduceBean.java index c5c0d21f288..dfdf4849179 100644 --- a/web-services/map-reduce/src/main/java/datawave/webservice/mr/MapReduceBean.java +++ b/web-services/map-reduce/src/main/java/datawave/webservice/mr/MapReduceBean.java @@ -762,7 +762,9 @@ public StreamingOutput getResultFile(@PathParam("jobId") String jobId, @PathPara FSDataInputStream fis; try { - if (!fs.exists(resultFile) || !fs.isFile(resultFile)) { + final FileStatus fileStatus = fs.getFileStatus(resultFile); + + if (!fs.exists(resultFile) || !fileStatus.isFile()) { NotFoundQueryException qe = new NotFoundQueryException(DatawaveErrorCode.FILE_NOT_FOUND, MessageFormat.format("{0} at path {1}", fileName, resultsDir)); response.addException(qe); diff --git a/web-services/map-reduce/src/main/java/datawave/webservice/mr/bulkresults/map/BulkResultsFileOutputMapper.java b/web-services/map-reduce/src/main/java/datawave/webservice/mr/bulkresults/map/BulkResultsFileOutputMapper.java index 08e6d834c21..182a489532a 100644 --- a/web-services/map-reduce/src/main/java/datawave/webservice/mr/bulkresults/map/BulkResultsFileOutputMapper.java +++ b/web-services/map-reduce/src/main/java/datawave/webservice/mr/bulkresults/map/BulkResultsFileOutputMapper.java @@ -1,5 +1,7 @@ package datawave.webservice.mr.bulkresults.map; +import static org.jgroups.util.Util.assertNotNull; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.StringReader; @@ -58,7 +60,7 @@ public class BulkResultsFileOutputMapper extends ApplicationContextAwareMapper t = null; private Map entries = new HashMap<>(); private Map> responseClassMap = new HashMap<>(); private SerializationFormat format = SerializationFormat.XML; @@ -112,7 +114,7 @@ protected void map(Key key, Value value, org.apache.hadoop.mapreduce.Mapper entry : entries.entrySet()) { try { - Object o = t.transform(entry); + Object o = t.transform(entry.getKey()); BaseQueryResponse response = t.createResponse(new ResultsPage(Collections.singletonList(o))); Class responseClass = null; try { diff --git a/web-services/query-websocket/src/main/java/datawave/webservice/websocket/codec/QueryResponseMessageJsonEncoder.java b/web-services/query-websocket/src/main/java/datawave/webservice/websocket/codec/QueryResponseMessageJsonEncoder.java index 6ceab6ceb9f..cd092b848c3 100644 --- a/web-services/query-websocket/src/main/java/datawave/webservice/websocket/codec/QueryResponseMessageJsonEncoder.java +++ b/web-services/query-websocket/src/main/java/datawave/webservice/websocket/codec/QueryResponseMessageJsonEncoder.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; +import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; import datawave.webservice.result.BaseResponse; @@ -33,8 +34,8 @@ public void encode(QueryResponseMessage object, Writer writer) throws EncodeExce @Override public void init(EndpointConfig config) { - mapper = new ObjectMapper(); - mapper.enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME); + mapper = JsonMapper.builder().enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME).build(); + mapper.setAnnotationIntrospector( AnnotationIntrospector.pair(new JacksonAnnotationIntrospector(), new JaxbAnnotationIntrospector(mapper.getTypeFactory()))); // Don't close the output stream diff --git a/web-services/query-websocket/src/main/java/datawave/webservice/websocket/messages/CreateQueryMessage.java b/web-services/query-websocket/src/main/java/datawave/webservice/websocket/messages/CreateQueryMessage.java index 62b0651657b..deeabba9d16 100644 --- a/web-services/query-websocket/src/main/java/datawave/webservice/websocket/messages/CreateQueryMessage.java +++ b/web-services/query-websocket/src/main/java/datawave/webservice/websocket/messages/CreateQueryMessage.java @@ -27,7 +27,7 @@ public class CreateQueryMessage implements QueryMessage { private MultivaluedMap parameters; - public CreateQueryMessage(MultivaluedMap parameters) { + public CreateQueryMessage(MultivaluedMap parameters) { this.parameters = parameters; } diff --git a/web-services/query/src/main/java/datawave/webservice/query/exception/EmptyObjectException.java b/web-services/query/src/main/java/datawave/webservice/query/exception/EmptyObjectException.java index a85d2bae3cf..dffc04a5a8a 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/exception/EmptyObjectException.java +++ b/web-services/query/src/main/java/datawave/webservice/query/exception/EmptyObjectException.java @@ -3,5 +3,5 @@ // used when a transformer gets a non-null empty object // and the TransformIterator should call next instead of returning null public class EmptyObjectException extends RuntimeException { - + private static final long serialVersionUID = 1l; } diff --git a/web-services/query/src/main/java/datawave/webservice/query/logic/QueryLogic.java b/web-services/query/src/main/java/datawave/webservice/query/logic/QueryLogic.java index a6b2e353366..275cd73a879 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/logic/QueryLogic.java +++ b/web-services/query/src/main/java/datawave/webservice/query/logic/QueryLogic.java @@ -108,7 +108,7 @@ String getPlan(AccumuloClient client, Query settings, Set runtim default String getResponseClass(Query query) throws QueryException { try { - QueryLogicTransformer t = this.getEnrichedTransformer(query); + QueryLogicTransformer t = this.getEnrichedTransformer(query); BaseResponse refResponse = t.createResponse(new ResultsPage()); return refResponse.getClass().getCanonicalName(); } catch (RuntimeException e) { diff --git a/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeLogicException.java b/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeLogicException.java index c57abd66a55..dc86b4080f4 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeLogicException.java +++ b/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeLogicException.java @@ -7,6 +7,8 @@ import datawave.webservice.query.exception.QueryException; public class CompositeLogicException extends RuntimeException { + private static final long serialVersionUID = 0l; + public CompositeLogicException(String message, String logicName, Exception exception) { super(getMessage(message, Collections.singletonMap(logicName, exception)), exception); } diff --git a/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeQueryConfiguration.java b/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeQueryConfiguration.java index e7bf6cc3a98..2c1a928904d 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeQueryConfiguration.java +++ b/web-services/query/src/main/java/datawave/webservice/query/logic/composite/CompositeQueryConfiguration.java @@ -7,6 +7,7 @@ import datawave.webservice.query.configuration.GenericQueryConfiguration; public class CompositeQueryConfiguration extends GenericQueryConfiguration implements Serializable { + private static final long serialVersionUID = 1l; private Query query = null; diff --git a/web-services/query/src/main/java/datawave/webservice/query/metric/QueryMetricsWriter.java b/web-services/query/src/main/java/datawave/webservice/query/metric/QueryMetricsWriter.java index a77b9f7f7fc..448dd0e31cc 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/metric/QueryMetricsWriter.java +++ b/web-services/query/src/main/java/datawave/webservice/query/metric/QueryMetricsWriter.java @@ -188,6 +188,7 @@ public void addMetricToQueue(QueryMetricHolder queryMetricHolder) { * maximum latency * @return list of query metric holders */ + @SuppressWarnings("unchecked") private List getMetricsFromQueue(int batchSize, long maxLatency) { List metricHolderList = new ArrayList<>(); long start = System.currentTimeMillis(); @@ -217,7 +218,6 @@ private static class FailureRecord { * FailureRecord tracks the number and type of failures to send the query metric update so we can make decisions on whether to retry sending or drop the * query metric update. * - * * @param metric * the metric * @param anySuccess @@ -497,8 +497,9 @@ private void writeMetricsToRemoteService(List updatedMetrics) t * list of metrics to process * @return list of failed query metrics */ + @SuppressWarnings("unchecked") private List writeMetricsToHandler(QueryMetricHandler queryMetricHandler, List metricQueue) { - List failedMetrics = new ArrayList<>(); + List failedMetricsHolder = new ArrayList<>(); if (!metricQueue.isEmpty()) { for (QueryMetricHolder metricHolder : metricQueue) { try { @@ -510,11 +511,11 @@ private List writeMetricsToHandler(QueryMetricHandler queryMe } } catch (Exception e) { log.error(String.format("metric update write to QueryMetricHandler failed: %s", e.getMessage())); - failedMetrics.add(metricHolder); + failedMetricsHolder.add(metricHolder); } } } - return failedMetrics; + return failedMetricsHolder; } /** diff --git a/web-services/query/src/main/java/datawave/webservice/query/runner/QueryPredictor.java b/web-services/query/src/main/java/datawave/webservice/query/runner/QueryPredictor.java index 5c0c59e59a3..3cb5b5b3194 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/runner/QueryPredictor.java +++ b/web-services/query/src/main/java/datawave/webservice/query/runner/QueryPredictor.java @@ -14,6 +14,7 @@ public interface QueryPredictor { Set predict(T query) throws PredictionException; class PredictionException extends Exception implements Serializable { + private static final long serialVersionUID = 0l; public PredictionException() { super(); diff --git a/web-services/query/src/main/java/datawave/webservice/query/util/AbstractUUIDLookupCriteria.java b/web-services/query/src/main/java/datawave/webservice/query/util/AbstractUUIDLookupCriteria.java index 6026bcdab5d..45cc9b42e3a 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/util/AbstractUUIDLookupCriteria.java +++ b/web-services/query/src/main/java/datawave/webservice/query/util/AbstractUUIDLookupCriteria.java @@ -80,7 +80,7 @@ public MultivaluedMap getQueryParameters() { * returns a context for the lookup request if any was specfied in the request. The lookup context is used to obtain alternate query logics for the lookup * requests to use. This can be used to modify the types of responses the query operations provide (e.g., plaintext responses.) * - * @return + * @return uuidTypeContext string */ public String getUUIDTypeContext() { return uuidTypeContext; diff --git a/web-services/query/src/main/java/datawave/webservice/query/util/LookupUUIDUtil.java b/web-services/query/src/main/java/datawave/webservice/query/util/LookupUUIDUtil.java index 79fec7b1250..9a2e02b49fc 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/util/LookupUUIDUtil.java +++ b/web-services/query/src/main/java/datawave/webservice/query/util/LookupUUIDUtil.java @@ -541,7 +541,8 @@ public UUIDType getUUIDType(final String uuidType) { * check if the query logic name is one of the configured content lookup type logics. * * @param queryLogicName - * @return + * the query logic name + * @return true if it is configured as content lookup, false if not */ public boolean isContentLookup(String queryLogicName) { if (queryLogicName == null) diff --git a/web-services/query/src/test/java/datawave/webservice/query/logic/composite/CompositeQueryLogicTest.java b/web-services/query/src/test/java/datawave/webservice/query/logic/composite/CompositeQueryLogicTest.java index 8901b62a511..77135308a28 100644 --- a/web-services/query/src/test/java/datawave/webservice/query/logic/composite/CompositeQueryLogicTest.java +++ b/web-services/query/src/test/java/datawave/webservice/query/logic/composite/CompositeQueryLogicTest.java @@ -117,6 +117,7 @@ public void setValue(String value) { } public static class TestEdgeQueryResponse extends EdgeQueryResponseBase { + private static final long serialVersionUID = 0l; private ArrayList edges = new ArrayList<>(); private long totalResults = 0; diff --git a/web-services/query/src/test/java/datawave/webservice/query/runner/ExtendedQueryExecutorBeanTest.java b/web-services/query/src/test/java/datawave/webservice/query/runner/ExtendedQueryExecutorBeanTest.java index 9623ea3d322..7a15028c7fd 100644 --- a/web-services/query/src/test/java/datawave/webservice/query/runner/ExtendedQueryExecutorBeanTest.java +++ b/web-services/query/src/test/java/datawave/webservice/query/runner/ExtendedQueryExecutorBeanTest.java @@ -206,10 +206,10 @@ public class ExtendedQueryExecutorBeanTest { Multimap traceInfos; @Mock - QueryLogicTransformer transformer; + QueryLogicTransformer transformer; @Mock - TransformIterator transformIterator; + TransformIterator transformIterator; @Mock UserTransaction transaction; @@ -857,6 +857,7 @@ public void testCreateQueryAndNext_HappyPath() throws Exception { } @Test + @SuppressWarnings("unchecked") public void testCreateQueryAndNext_BadID() throws Exception { // Set local test input String queryLogicName = "queryLogicName"; @@ -1024,6 +1025,7 @@ public void testCreateQueryAndNext_BadID() throws Exception { } @Test + @SuppressWarnings("unchecked") public void testCreateQueryAndNext_PageSizeParam() throws Exception { // Set local test input String queryLogicName = "queryLogicName"; @@ -1182,6 +1184,7 @@ public void testCreateQueryAndNext_PageSizeParam() throws Exception { } @Test + @SuppressWarnings("unchecked") public void testCreateQueryAndNext_PageSizeParamTwo() throws Exception { // Set local test input String queryLogicName = "queryLogicName"; diff --git a/web-services/query/src/test/java/datawave/webservice/query/runner/QueryExecutorBeanTest.java b/web-services/query/src/test/java/datawave/webservice/query/runner/QueryExecutorBeanTest.java index 964dfc83880..90a75f474bc 100644 --- a/web-services/query/src/test/java/datawave/webservice/query/runner/QueryExecutorBeanTest.java +++ b/web-services/query/src/test/java/datawave/webservice/query/runner/QueryExecutorBeanTest.java @@ -3,7 +3,7 @@ import static org.easymock.EasyMock.anyObject; import static org.easymock.EasyMock.eq; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.fail; import static org.powermock.api.easymock.PowerMock.createMock; import static org.powermock.api.easymock.PowerMock.createStrictMock; @@ -218,8 +218,8 @@ public void setup() throws Exception { public void testTriple_Nulls() throws Exception { Triple subject = new Triple(null, null, null); subject.hashCode(); - assertTrue("Should not be equal", !subject.equals(null)); - assertTrue("Should not be equal", !subject.equals(new Triple("test", null, null))); + assertNotEquals("Should not be equal", subject, null); + assertNotEquals("Should not be equal", subject, new Triple("test", null, null)); } private QueryImpl createNewQuery() throws Exception { diff --git a/web-services/query/src/test/java/datawave/webservice/query/runner/RunningQueryTest.java b/web-services/query/src/test/java/datawave/webservice/query/runner/RunningQueryTest.java index b67228d7b55..24a02d6f8d5 100644 --- a/web-services/query/src/test/java/datawave/webservice/query/runner/RunningQueryTest.java +++ b/web-services/query/src/test/java/datawave/webservice/query/runner/RunningQueryTest.java @@ -112,7 +112,7 @@ public void testConstructorSetsConnection() throws Exception { SampleGenericQueryConfiguration config = new SampleGenericQueryConfiguration(); expect(logic.initialize(anyObject(), anyObject(), anyObject())).andReturn(config); logic.setupQuery(config); - TransformIterator iter = new TransformIterator(); + TransformIterator iter = new TransformIterator<>(); expect(logic.getCollectQueryMetrics()).andReturn(Boolean.FALSE); expect(logic.getTransformIterator(settings)).andReturn(iter); expect(logic.isLongRunningQuery()).andReturn(false); @@ -185,7 +185,7 @@ public void testWithCompositeQueryLogic() throws Exception { auths[0] = "A"; auths[1] = "C"; Map> logics = new HashMap<>(); - TestQueryLogic logic1 = new TestQueryLogic(); + TestQueryLogic logic1 = new TestQueryLogic<>(); HashSet roles = new HashSet<>(); roles.add("NONTESTROLE"); logic1.setTableName("thisTable"); diff --git a/web-services/security/src/main/java/datawave/security/auth/DatawaveAuthenticationMechanism.java b/web-services/security/src/main/java/datawave/security/auth/DatawaveAuthenticationMechanism.java index b0d0dfa4e85..eeef4a49e0b 100644 --- a/web-services/security/src/main/java/datawave/security/auth/DatawaveAuthenticationMechanism.java +++ b/web-services/security/src/main/java/datawave/security/auth/DatawaveAuthenticationMechanism.java @@ -243,6 +243,8 @@ private IdentityManager getIdentityManager(SecurityContext securityContext) { } private static final class MultipleHeaderException extends Exception { + private static final long serialVersionUID = 0l; + public MultipleHeaderException(String message) { super(message); } diff --git a/web-services/security/src/test/java/datawave/security/authorization/remote/ConditionalRemoteUserOperationsTest.java b/web-services/security/src/test/java/datawave/security/authorization/remote/ConditionalRemoteUserOperationsTest.java index 7a3c3af3b8b..fea5e50391e 100644 --- a/web-services/security/src/test/java/datawave/security/authorization/remote/ConditionalRemoteUserOperationsTest.java +++ b/web-services/security/src/test/java/datawave/security/authorization/remote/ConditionalRemoteUserOperationsTest.java @@ -41,7 +41,7 @@ private static class MockRemoteUserOperations implements UserOperations { boolean invoked = false; @Override - public AuthorizationsListBase listEffectiveAuthorizations(Object callerObject) throws AuthorizationException { + public AuthorizationsListBase listEffectiveAuthorizations(Object callerObject) throws AuthorizationException { invoked = true; return new DefaultAuthorizationsList(); }