Skip to content

Commit

Permalink
fix build warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Gross cogross committed Jun 10, 2024
1 parent 3ffbad9 commit 988977c
Show file tree
Hide file tree
Showing 157 changed files with 443 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package datawave.core.mapreduce.bulkresults.map;

import static org.jgroups.util.Util.assertNotNull;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
Expand Down Expand Up @@ -57,7 +59,7 @@ public class BulkResultsFileOutputMapper extends ApplicationContextAwareMapper<K
*/
public static final String RESULT_SERIALIZATION_FORMAT = "bulk.results.serial.format";

private QueryLogicTransformer t = null;
private QueryLogicTransformer<Key,Value> t = null;
private Map<Key,Value> entries = new HashMap<>();
private Map<String,Class<? extends BaseQueryResponse>> responseClassMap = new HashMap<>();
private SerializationFormat format = SerializationFormat.XML;
Expand Down Expand Up @@ -99,7 +101,7 @@ protected void map(Key key, Value value, org.apache.hadoop.mapreduce.Mapper<Key,
entries.put(key, value);
for (Entry<Key,Value> 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<? extends BaseQueryResponse> responseClass = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ default ResultPostprocessor getResultPostprocessor(GenericQueryConfiguration con

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import datawave.microservice.query.QueryImpl;

public class CompositeQueryConfiguration extends GenericQueryConfiguration implements Serializable {
private static final long serialVersionUID = 1l;

private Map<String,GenericQueryConfiguration> configs = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface QueryPredictor<T extends BaseQueryMetric> {
Set<Prediction> predict(T query) throws PredictionException;

class PredictionException extends Exception implements Serializable {
private static final long serialVersionUID = 0l;

public PredictionException() {
super();
Expand Down
2 changes: 1 addition & 1 deletion warehouse/accumulo-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<id>clover</id>
<dependencies>
<dependency>
<groupId>com.cenqua.clover</groupId>
<groupId>org.openclover</groupId>
<artifactId>clover</artifactId>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public abstract class TokenSpecParser<B extends TokenSpecParser> {
*
* @return TokenSpecParser child object
*/
@SuppressWarnings("unchecked")
public B parse(String configuration) {
ParserState parser = new ParserState(configuration);
parser.parseTo(this);
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ public void verifyOverridenValues() throws IOException {
// <zip ttl="123"/>

// 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<FilterRule> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -52,10 +52,10 @@ public void verifyInheritedParentConfigs() throws IOException {
// <fields>alpha,beta,gamma,delta</fields>
// 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) {
Expand All @@ -65,7 +65,7 @@ private Boolean isIndexTable(TestFieldFilter filter) {
private static FilterRule loadRulesFromFile(FileRuleWatcher watcher, FileSystem fs, Path filePath) throws IOException {
Collection<FilterRule> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -104,30 +104,30 @@ public void testNewConfigMaintainsOrder() throws Exception {
List<FilterRule> childRules = (List<FilterRule>) 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<FilterRule> parentRules, int i) {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -188,7 +188,7 @@ public void testTtl() {

private static FilterRule loadRulesFromFile(FileRuleWatcher watcher, FileSystem fs, Path filePath, int expectedNumRules) throws IOException {
Collection<FilterRule> rules = watcher.loadContents(fs.open(filePath));
assertThat(rules.size(), is(expectedNumRules));
assertEquals(rules.size(), expectedNumRules);
// only return the TestTrieFilter for this test
Optional<FilterRule> first = rules.stream().filter(r -> r instanceof TestTrieFilter).findFirst();
return first.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.IOException;
Expand Down Expand Up @@ -57,9 +58,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
Expand All @@ -70,9 +71,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
Expand All @@ -83,9 +84,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
Expand All @@ -97,8 +98,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
Expand All @@ -116,22 +117,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);

}

Expand Down Expand Up @@ -169,10 +170,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)
Expand Down Expand Up @@ -200,14 +201,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);
}

// --------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> implements Comparator<T>, Serializable {
Expand All @@ -15,6 +16,8 @@ public MultiComparator(Collection<Comparator<T>> comparators) {
this.comparators = comparators;
}

@SafeVarargs
@SuppressWarnings("varargs")
public MultiComparator(Comparator<T>... comparators) {
this((comparators != null && comparators.length > 0) ? Arrays.asList(comparators) : new ArrayList<>());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 988977c

Please sign in to comment.