SOLR-14564: Fix or suppress remaining warnings in solr/core

This commit is contained in:
Erick Erickson 2020-06-13 11:00:58 -04:00
parent 6801d4c139
commit a41aa20b0a
92 changed files with 211 additions and 81 deletions

View File

@ -338,6 +338,8 @@ Other Changes
* SOLR-14565: Fix or suppress warnings in solrj/impl and solrj/io/graph (Erick Erickson) * SOLR-14565: Fix or suppress warnings in solrj/impl and solrj/io/graph (Erick Erickson)
* SOLR-14564: Fix or suppress remaining warnings in solr/core (Erick Erickson)
================== 8.5.2 ================== ================== 8.5.2 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -158,7 +158,8 @@ public class EmbeddedSolrServer extends SolrClient {
// It *should* be able to convert the response directly into a named list. // It *should* be able to convert the response directly into a named list.
@Override @Override
public NamedList<Object> request(SolrRequest request, String coreName) throws SolrServerException, IOException { @SuppressWarnings({"unchecked"})
public NamedList<Object> request(@SuppressWarnings({"rawtypes"})SolrRequest request, String coreName) throws SolrServerException, IOException {
String path = request.getPath(); String path = request.getPath();
if (path == null || !path.startsWith("/")) { if (path == null || !path.startsWith("/")) {
@ -275,7 +276,7 @@ public class EmbeddedSolrServer extends SolrClient {
} }
} }
private Set<ContentStream> getContentStreams(SolrRequest request) throws IOException { private Set<ContentStream> getContentStreams(@SuppressWarnings({"rawtypes"})SolrRequest request) throws IOException {
if (request.getMethod() == SolrRequest.METHOD.GET) return null; if (request.getMethod() == SolrRequest.METHOD.GET) return null;
if (request instanceof ContentStreamUpdateRequest) { if (request instanceof ContentStreamUpdateRequest) {
final ContentStreamUpdateRequest csur = (ContentStreamUpdateRequest) request; final ContentStreamUpdateRequest csur = (ContentStreamUpdateRequest) request;

View File

@ -212,6 +212,7 @@ public class RequestParams implements MapSerializable {
public static final String APPENDS = "_appends_"; public static final String APPENDS = "_appends_";
public static final String INVARIANTS = "_invariants_"; public static final String INVARIANTS = "_invariants_";
@SuppressWarnings({"unchecked"})
public static class ParamSet implements MapSerializable { public static class ParamSet implements MapSerializable {
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
private final Map defaults, appends, invariants; private final Map defaults, appends, invariants;

View File

@ -178,6 +178,7 @@ public class DistribPackageStore implements PackageStore {
String baseUrl = url.replace("/solr", "/api"); String baseUrl = url.replace("/solr", "/api");
ByteBuffer metadata = null; ByteBuffer metadata = null;
@SuppressWarnings({"rawtypes"})
Map m = null; Map m = null;
try { try {
metadata = Utils.executeGET(coreContainer.getUpdateShardHandler().getDefaultHttpClient(), metadata = Utils.executeGET(coreContainer.getUpdateShardHandler().getDefaultHttpClient(),
@ -448,7 +449,7 @@ public class DistribPackageStore implements PackageStore {
} }
@Override @Override
public List list(String path, Predicate<String> predicate) { public List<FileDetails> list(String path, Predicate<String> predicate) {
File file = getRealpath(path).toFile(); File file = getRealpath(path).toFile();
List<FileDetails> fileDetails = new ArrayList<>(); List<FileDetails> fileDetails = new ArrayList<>();
FileType type = getType(path, false); FileType type = getType(path, false);
@ -472,6 +473,7 @@ public class DistribPackageStore implements PackageStore {
@Override @Override
public void refresh(String path) { public void refresh(String path) {
try { try {
@SuppressWarnings({"rawtypes"})
List l = null; List l = null;
try { try {
l = coreContainer.getZkController().getZkClient().getChildren(ZK_PACKAGESTORE+ path, null, true); l = coreContainer.getZkController().getZkClient().getChildren(ZK_PACKAGESTORE+ path, null, true);
@ -479,6 +481,7 @@ public class DistribPackageStore implements PackageStore {
// does not matter // does not matter
} }
if (l != null && !l.isEmpty()) { if (l != null && !l.isEmpty()) {
@SuppressWarnings({"rawtypes"})
List myFiles = list(path, s -> true); List myFiles = list(path, s -> true);
for (Object f : l) { for (Object f : l) {
if (!myFiles.contains(f)) { if (!myFiles.contains(f)) {
@ -546,6 +549,7 @@ public class DistribPackageStore implements PackageStore {
if (!parent.exists()) { if (!parent.exists()) {
parent.mkdirs(); parent.mkdirs();
} }
@SuppressWarnings({"rawtypes"})
Map m = (Map) Utils.fromJSON(meta.array(), meta.arrayOffset(), meta.limit()); Map m = (Map) Utils.fromJSON(meta.array(), meta.arrayOffset(), meta.limit());
if (m == null || m.isEmpty()) { if (m == null || m.isEmpty()) {
throw new SolrException(SERVER_ERROR, "invalid metadata , discarding : " + path); throw new SolrException(SERVER_ERROR, "invalid metadata , discarding : " + path);

View File

@ -89,7 +89,7 @@ public class PackageStoreAPI {
*/ */
public ArrayList<String> shuffledNodes() { public ArrayList<String> shuffledNodes() {
Set<String> liveNodes = coreContainer.getZkController().getZkStateReader().getClusterState().getLiveNodes(); Set<String> liveNodes = coreContainer.getZkController().getZkStateReader().getClusterState().getLiveNodes();
ArrayList<String> l = new ArrayList(liveNodes); ArrayList<String> l = new ArrayList<>(liveNodes);
l.remove(coreContainer.getZkController().getNodeName()); l.remove(coreContainer.getZkController().getNodeName());
Collections.shuffle(l, BlobRepository.RANDOM); Collections.shuffle(l, BlobRepository.RANDOM);
return l; return l;
@ -279,6 +279,7 @@ public class PackageStoreAPI {
int idx = path.lastIndexOf('/'); int idx = path.lastIndexOf('/');
String fileName = path.substring(idx + 1); String fileName = path.substring(idx + 1);
String parentPath = path.substring(0, path.lastIndexOf('/')); String parentPath = path.substring(0, path.lastIndexOf('/'));
@SuppressWarnings({"rawtypes"})
List l = packageStore.list(parentPath, s -> s.equals(fileName)); List l = packageStore.list(parentPath, s -> s.equals(fileName));
rsp.add("files", Collections.singletonMap(path, l.isEmpty() ? null : l.get(0))); rsp.add("files", Collections.singletonMap(path, l.isEmpty() ? null : l.get(0)));
return; return;
@ -312,7 +313,8 @@ public class PackageStoreAPI {
List<String> signatures; List<String> signatures;
Map<String, Object> otherAttribs; Map<String, Object> otherAttribs;
public MetaData(Map m) { @SuppressWarnings({"unchecked"})
public MetaData(@SuppressWarnings({"rawtypes"})Map m) {
m = Utils.getDeepCopy(m, 3); m = Utils.getDeepCopy(m, 3);
this.sha512 = (String) m.remove(SHA512); this.sha512 = (String) m.remove(SHA512);
this.signatures = (List<String>) m.remove("sig"); this.signatures = (List<String>) m.remove("sig");

View File

@ -45,6 +45,7 @@ public class ExportHandler extends SearchHandler {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ModelCache modelCache = null; private ModelCache modelCache = null;
@SuppressWarnings({"rawtypes"})
private ConcurrentMap objectCache = new ConcurrentHashMap(); private ConcurrentMap objectCache = new ConcurrentHashMap();
private SolrDefaultStreamFactory streamFactory = new ExportHandlerStreamFactory(); private SolrDefaultStreamFactory streamFactory = new ExportHandlerStreamFactory();
private String coreName; private String coreName;

View File

@ -364,6 +364,7 @@ public class StatsValuesFactory {
return res; return res;
} }
@SuppressWarnings({"unchecked"})
public void setNextReader(LeafReaderContext ctx) throws IOException { public void setNextReader(LeafReaderContext ctx) throws IOException {
if (valueSource == null) { if (valueSource == null) {
// first time we've collected local values, get the right ValueSource // first time we've collected local values, get the right ValueSource

View File

@ -193,6 +193,7 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public void open() throws IOException { public void open() throws IOException {
docs = (SortDoc[]) context.get(SORT_DOCS_KEY); docs = (SortDoc[]) context.get(SORT_DOCS_KEY);
queue = (SortQueue) context.get(SORT_QUEUE_KEY); queue = (SortQueue) context.get(SORT_QUEUE_KEY);

View File

@ -365,6 +365,7 @@ public class TaggerRequestHandler extends RequestHandlerBase {
functionValuesDocIdPerSeg = new int[readerContexts.size()]; functionValuesDocIdPerSeg = new int[readerContexts.size()];
} }
@SuppressWarnings({"unchecked"})
Object objectVal(int topDocId) throws IOException { Object objectVal(int topDocId) throws IOException {
// lookup segment level stuff: // lookup segment level stuff:
int segIdx = ReaderUtil.subIndex(topDocId, readerContexts); int segIdx = ReaderUtil.subIndex(topDocId, readerContexts);

View File

@ -459,6 +459,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
IndexReader reader = new TermVectorReusingLeafReader(req.getSearcher().getSlowAtomicReader()); // SOLR-5855 IndexReader reader = new TermVectorReusingLeafReader(req.getSearcher().getSlowAtomicReader()); // SOLR-5855
// Highlight each document // Highlight each document
@SuppressWarnings({"rawtypes"})
NamedList fragments = new SimpleOrderedMap(); NamedList fragments = new SimpleOrderedMap();
DocIterator iterator = docs.iterator(); DocIterator iterator = docs.iterator();
for (int i = 0; i < docs.size(); i++) { for (int i = 0; i < docs.size(); i++) {

View File

@ -36,7 +36,7 @@ public abstract class HighlightingPluginBase implements SolrInfoBean
protected Set<String> metricNames = ConcurrentHashMap.newKeySet(1); protected Set<String> metricNames = ConcurrentHashMap.newKeySet(1);
protected SolrMetricsContext solrMetricsContext; protected SolrMetricsContext solrMetricsContext;
public void init(NamedList args) { public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
if( args != null ) { if( args != null ) {
Object o = args.get("defaults"); Object o = args.get("defaults");
if (o != null && o instanceof NamedList ) { if (o != null && o instanceof NamedList ) {

View File

@ -48,7 +48,7 @@ public class RegexFragmenter extends HighlightingPluginBase implements SolrFragm
protected Pattern defaultPattern; protected Pattern defaultPattern;
@Override @Override
public void init(NamedList args) { public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
super.init(args); super.init(args);
defaultPatternRaw = LuceneRegexFragmenter.DEFAULT_PATTERN_RAW; defaultPatternRaw = LuceneRegexFragmenter.DEFAULT_PATTERN_RAW;
if( defaults != null ) { if( defaults != null ) {

View File

@ -30,7 +30,7 @@ public interface SolrEncoder extends SolrInfoBean, NamedListInitializedPlugin {
* solrconfig.xml * solrconfig.xml
*/ */
@Override @Override
public void init(NamedList args); public void init(@SuppressWarnings({"rawtypes"})NamedList args);
/** /**
* Return an {@link org.apache.lucene.search.highlight.Encoder} appropriate for this field. * Return an {@link org.apache.lucene.search.highlight.Encoder} appropriate for this field.

View File

@ -30,7 +30,7 @@ public interface SolrFormatter extends SolrInfoBean, NamedListInitializedPlugin
* solrconfig.xml * solrconfig.xml
*/ */
@Override @Override
public void init(NamedList args); public void init(@SuppressWarnings({"rawtypes"})NamedList args);
/** /**
* Return a {@link org.apache.lucene.search.highlight.Formatter} appropriate for this field. * Return a {@link org.apache.lucene.search.highlight.Formatter} appropriate for this field.

View File

@ -30,7 +30,7 @@ public interface SolrFragListBuilder extends SolrInfoBean, NamedListInitializedP
* solrconfig.xml * solrconfig.xml
*/ */
@Override @Override
public void init( NamedList args); public void init( @SuppressWarnings({"rawtypes"})NamedList args);
/** /**
* Return a FragListBuilder. * Return a FragListBuilder.

View File

@ -30,7 +30,7 @@ public interface SolrFragmenter extends SolrInfoBean, NamedListInitializedPlugin
* solrconfig.xml * solrconfig.xml
*/ */
@Override @Override
public void init(NamedList args); public void init(@SuppressWarnings({"rawtypes"})NamedList args);
/** /**
* Return a {@link org.apache.lucene.search.highlight.Fragmenter} appropriate for this field. * Return a {@link org.apache.lucene.search.highlight.Fragmenter} appropriate for this field.

View File

@ -68,6 +68,7 @@ public abstract class WrapperMergePolicyFactory extends MergePolicyFactory {
} }
/** Returns an instance of the wrapped {@link MergePolicy} after it has been configured with all set parameters. */ /** Returns an instance of the wrapped {@link MergePolicy} after it has been configured with all set parameters. */
@SuppressWarnings({"rawtypes"})
protected final MergePolicy getWrappedMergePolicy() { protected final MergePolicy getWrappedMergePolicy() {
if (wrappedMergePolicyArgs == null) { if (wrappedMergePolicyArgs == null) {
return getDefaultWrappedMergePolicy(); return getDefaultWrappedMergePolicy();

View File

@ -72,6 +72,7 @@ public class CSVParser {
// the following objects are shared to reduce garbage // the following objects are shared to reduce garbage
/** A record buffer for getLine(). Grows as necessary and is reused. */ /** A record buffer for getLine(). Grows as necessary and is reused. */
@SuppressWarnings({"rawtypes"})
private final ArrayList record = new ArrayList(); private final ArrayList record = new ArrayList();
private final Token reusableToken = new Token(); private final Token reusableToken = new Token();
private final CharBuffer wsBuf = new CharBuffer(); private final CharBuffer wsBuf = new CharBuffer();
@ -138,7 +139,9 @@ public class CSVParser {
* @return matrix of records x values ('null' when end of file) * @return matrix of records x values ('null' when end of file)
* @throws IOException on parse error or input read-failure * @throws IOException on parse error or input read-failure
*/ */
@SuppressWarnings({"unchecked"})
public String[][] getAllValues() throws IOException { public String[][] getAllValues() throws IOException {
@SuppressWarnings({"rawtypes"})
ArrayList records = new ArrayList(); ArrayList records = new ArrayList();
String[] values; String[] values;
String[][] ret = null; String[][] ret = null;
@ -189,6 +192,7 @@ public class CSVParser {
* ('null' when end of file has been reached) * ('null' when end of file has been reached)
* @throws IOException on parse error or input read-failure * @throws IOException on parse error or input read-failure
*/ */
@SuppressWarnings({"unchecked"})
public String[] getLine() throws IOException { public String[] getLine() throws IOException {
String[] ret = EMPTY_STRING_ARRAY; String[] ret = EMPTY_STRING_ARRAY;
record.clear(); record.clear();

View File

@ -89,6 +89,7 @@ public class CSVPrinter {
* *
* @param comment the comment to output * @param comment the comment to output
*/ */
@SuppressWarnings({"fallthrough"})
public void printlnComment(String comment) throws IOException { public void printlnComment(String comment) throws IOException {
if(this.strategy.isCommentingDisabled()) { if(this.strategy.isCommentingDisabled()) {
return; return;

View File

@ -124,6 +124,7 @@ public abstract class LogWatcher<E> {
* *
* @return a LogWatcher configured for the container's logging framework * @return a LogWatcher configured for the container's logging framework
*/ */
@SuppressWarnings({"rawtypes"})
public static LogWatcher newRegisteredLogWatcher(LogWatcherConfig config, SolrResourceLoader loader) { public static LogWatcher newRegisteredLogWatcher(LogWatcherConfig config, SolrResourceLoader loader) {
if (!config.isEnabled()) { if (!config.isEnabled()) {
@ -145,6 +146,7 @@ public abstract class LogWatcher<E> {
return logWatcher; return logWatcher;
} }
@SuppressWarnings({"rawtypes"})
private static LogWatcher createWatcher(LogWatcherConfig config, SolrResourceLoader loader) { private static LogWatcher createWatcher(LogWatcherConfig config, SolrResourceLoader loader) {
String fname = config.getLoggingClass(); String fname = config.getLoggingClass();

View File

@ -147,6 +147,7 @@ public class MetricSuppliers {
private static final double DEFAULT_ALPHA = 0.015; private static final double DEFAULT_ALPHA = 0.015;
private static final long DEFAULT_WINDOW = 300; private static final long DEFAULT_WINDOW = 300;
@SuppressWarnings({"unchecked"})
private static final Reservoir getReservoir(SolrResourceLoader loader, PluginInfo info) { private static final Reservoir getReservoir(SolrResourceLoader loader, PluginInfo info) {
if (info == null) { if (info == null) {
return new ExponentiallyDecayingReservoir(); return new ExponentiallyDecayingReservoir();
@ -276,6 +277,7 @@ public class MetricSuppliers {
* @param info plugin configuration, or null for default * @param info plugin configuration, or null for default
* @return configured supplier instance, or default instance if configuration was invalid * @return configured supplier instance, or default instance if configuration was invalid
*/ */
@SuppressWarnings({"unchecked"})
public static MetricRegistry.MetricSupplier<Counter> counterSupplier(SolrResourceLoader loader, PluginInfo info) { public static MetricRegistry.MetricSupplier<Counter> counterSupplier(SolrResourceLoader loader, PluginInfo info) {
if (info == null || info.className == null || info.className.trim().isEmpty()) { if (info == null || info.className == null || info.className.trim().isEmpty()) {
return new DefaultCounterSupplier(); return new DefaultCounterSupplier();
@ -302,6 +304,7 @@ public class MetricSuppliers {
* @param info plugin configuration, or null for default * @param info plugin configuration, or null for default
* @return configured supplier instance, or default instance if configuration was invalid * @return configured supplier instance, or default instance if configuration was invalid
*/ */
@SuppressWarnings({"unchecked"})
public static MetricRegistry.MetricSupplier<Meter> meterSupplier(SolrResourceLoader loader, PluginInfo info) { public static MetricRegistry.MetricSupplier<Meter> meterSupplier(SolrResourceLoader loader, PluginInfo info) {
MetricRegistry.MetricSupplier<Meter> supplier; MetricRegistry.MetricSupplier<Meter> supplier;
if (info == null || info.className == null || info.className.isEmpty()) { if (info == null || info.className == null || info.className.isEmpty()) {
@ -328,6 +331,7 @@ public class MetricSuppliers {
* @param info plugin configuration, or null for default * @param info plugin configuration, or null for default
* @return configured supplier instance, or default instance if configuration was invalid * @return configured supplier instance, or default instance if configuration was invalid
*/ */
@SuppressWarnings({"unchecked"})
public static MetricRegistry.MetricSupplier<Timer> timerSupplier(SolrResourceLoader loader, PluginInfo info) { public static MetricRegistry.MetricSupplier<Timer> timerSupplier(SolrResourceLoader loader, PluginInfo info) {
MetricRegistry.MetricSupplier<Timer> supplier; MetricRegistry.MetricSupplier<Timer> supplier;
if (info == null || info.className == null || info.className.isEmpty()) { if (info == null || info.className == null || info.className.isEmpty()) {
@ -353,6 +357,7 @@ public class MetricSuppliers {
* @param info plugin configuration, or null for default * @param info plugin configuration, or null for default
* @return configured supplier instance, or default instance if configuration was invalid * @return configured supplier instance, or default instance if configuration was invalid
*/ */
@SuppressWarnings({"unchecked"})
public static MetricRegistry.MetricSupplier<Histogram> histogramSupplier(SolrResourceLoader loader, PluginInfo info) { public static MetricRegistry.MetricSupplier<Histogram> histogramSupplier(SolrResourceLoader loader, PluginInfo info) {
MetricRegistry.MetricSupplier<Histogram> supplier; MetricRegistry.MetricSupplier<Histogram> supplier;
if (info == null || info.className == null || info.className.isEmpty()) { if (info == null || info.className == null || info.className.isEmpty()) {

View File

@ -159,7 +159,9 @@ public class MetricsMap implements Gauge<Map<String,Object>>, DynamicMBean {
if (jmxAttributes.containsKey(k)) { if (jmxAttributes.containsKey(k)) {
return; return;
} }
@SuppressWarnings({"rawtypes"})
Class type = v.getClass(); Class type = v.getClass();
@SuppressWarnings({"rawtypes"})
OpenType typeBox = determineType(type); OpenType typeBox = determineType(type);
if (type.equals(String.class) || typeBox == null) { if (type.equals(String.class) || typeBox == null) {
attrInfoList.add(new MBeanAttributeInfo(k, String.class.getName(), attrInfoList.add(new MBeanAttributeInfo(k, String.class.getName(),
@ -179,6 +181,7 @@ public class MetricsMap implements Gauge<Map<String,Object>>, DynamicMBean {
return new MBeanInfo(getClass().getName(), "MetricsMap", attrInfoArr, null, null, null); return new MBeanInfo(getClass().getName(), "MetricsMap", attrInfoArr, null, null, null);
} }
@SuppressWarnings({"rawtypes"})
private OpenType determineType(Class type) { private OpenType determineType(Class type) {
try { try {
for (Field field : SimpleType.class.getFields()) { for (Field field : SimpleType.class.getFields()) {

View File

@ -399,7 +399,7 @@ public class SolrMetricManager {
for (String pattern : patterns) { for (String pattern : patterns) {
compiled.add(Pattern.compile(pattern)); compiled.add(Pattern.compile(pattern));
} }
return registryNames((Pattern[]) compiled.toArray(new Pattern[compiled.size()])); return registryNames(compiled.toArray(new Pattern[compiled.size()]));
} }
public Set<String> registryNames(Pattern... patterns) { public Set<String> registryNames(Pattern... patterns) {
@ -740,6 +740,7 @@ public class SolrMetricManager {
} }
} }
@SuppressWarnings({"unchecked", "rawtypes"})
public void registerGauge(SolrMetricsContext context, String registry, Gauge<?> gauge, String tag, boolean force, String metricName, String... metricPath) { public void registerGauge(SolrMetricsContext context, String registry, Gauge<?> gauge, String tag, boolean force, String metricName, String... metricPath) {
registerMetric(context, registry, new GaugeWrapper(gauge, tag), force, metricName, metricPath); registerMetric(context, registry, new GaugeWrapper(gauge, tag), force, metricName, metricPath);
} }
@ -753,6 +754,7 @@ public class SolrMetricManager {
AtomicInteger removed = new AtomicInteger(); AtomicInteger removed = new AtomicInteger();
registry.removeMatching((name, metric) -> { registry.removeMatching((name, metric) -> {
if (metric instanceof GaugeWrapper) { if (metric instanceof GaugeWrapper) {
@SuppressWarnings({"rawtypes"})
GaugeWrapper wrapper = (GaugeWrapper) metric; GaugeWrapper wrapper = (GaugeWrapper) metric;
boolean toRemove = wrapper.getTag().contains(tagSegment); boolean toRemove = wrapper.getTag().contains(tagSegment);
if (toRemove) { if (toRemove) {
@ -952,6 +954,7 @@ public class SolrMetricManager {
* component instances. * component instances.
* @throws Exception if any argument is missing or invalid * @throws Exception if any argument is missing or invalid
*/ */
@SuppressWarnings({"rawtypes"})
public void loadReporter(String registry, SolrResourceLoader loader, CoreContainer coreContainer, SolrCore solrCore, PluginInfo pluginInfo, String tag) throws Exception { public void loadReporter(String registry, SolrResourceLoader loader, CoreContainer coreContainer, SolrCore solrCore, PluginInfo pluginInfo, String tag) throws Exception {
if (registry == null || pluginInfo == null || pluginInfo.name == null || pluginInfo.className == null) { if (registry == null || pluginInfo == null || pluginInfo.name == null || pluginInfo.className == null) {
throw new IllegalArgumentException("loadReporter called with missing arguments: " + throw new IllegalArgumentException("loadReporter called with missing arguments: " +
@ -1173,6 +1176,7 @@ public class SolrMetricManager {
return result; return result;
} }
@SuppressWarnings({"unchecked", "rawtypes"})
private PluginInfo preparePlugin(PluginInfo info, Map<String, String> defaultAttributes, private PluginInfo preparePlugin(PluginInfo info, Map<String, String> defaultAttributes,
Map<String, Object> defaultInitArgs) { Map<String, Object> defaultInitArgs) {
if (info == null) { if (info == null) {

View File

@ -85,6 +85,7 @@ public class SolrSlf4jReporter extends FilteringSolrMetricReporter {
} }
@Override @Override
@SuppressWarnings({"rawtypes"})
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) {
throw new UnsupportedOperationException("this method should never be called here!"); throw new UnsupportedOperationException("this method should never be called here!");
} }

View File

@ -144,7 +144,7 @@ public class SolrClusterReporter extends SolrCoreContainerReporter {
this.handler = handler; this.handler = handler;
} }
public void setReport(List<Map> reportConfig) { public void setReport(@SuppressWarnings({"rawtypes"})List<Map> reportConfig) {
if (reportConfig == null || reportConfig.isEmpty()) { if (reportConfig == null || reportConfig.isEmpty()) {
return; return;
} }
@ -156,7 +156,7 @@ public class SolrClusterReporter extends SolrCoreContainerReporter {
}); });
} }
public void setReport(Map map) { public void setReport(@SuppressWarnings({"rawtypes"})Map map) {
if (map == null || map.isEmpty()) { if (map == null || map.isEmpty()) {
return; return;
} }

View File

@ -94,6 +94,7 @@ public class SolrReporter extends ScheduledReporter {
} }
} }
@SuppressWarnings({"unchecked"})
public static Report fromMap(Map<?, ?> map) { public static Report fromMap(Map<?, ?> map) {
String groupPattern = (String)map.get("group"); String groupPattern = (String)map.get("group");
String labelPattern = (String)map.get("label"); String labelPattern = (String)map.get("label");
@ -259,6 +260,7 @@ public class SolrReporter extends ScheduledReporter {
* @return configured instance of reporter * @return configured instance of reporter
* @deprecated use {@link #build(SolrClientCache, Supplier)} instead. * @deprecated use {@link #build(SolrClientCache, Supplier)} instead.
*/ */
@Deprecated
public SolrReporter build(HttpClient client, Supplier<String> urlProvider) { public SolrReporter build(HttpClient client, Supplier<String> urlProvider) {
return new SolrReporter(client, urlProvider, metricManager, reports, handler, reporterId, rateUnit, durationUnit, return new SolrReporter(client, urlProvider, metricManager, reports, handler, reporterId, rateUnit, durationUnit,
params, skipHistograms, skipAggregateValues, cloudClient, compact); params, skipHistograms, skipAggregateValues, cloudClient, compact);
@ -478,6 +480,7 @@ public class SolrReporter extends ScheduledReporter {
} }
@Override @Override
@SuppressWarnings({"rawtypes"})
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) {
// no-op - we do all the work in report() // no-op - we do all the work in report()
} }

View File

@ -62,7 +62,7 @@ import com.codahale.metrics.MetricFilter;
public class SolrShardReporter extends SolrCoreReporter { public class SolrShardReporter extends SolrCoreReporter {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final List<String> DEFAULT_FILTERS = new ArrayList(){{ public static final List<String> DEFAULT_FILTERS = new ArrayList<>(){{
add("TLOG.*"); add("TLOG.*");
add("CORE\\.fs.*"); add("CORE\\.fs.*");
add("REPLICATION.*"); add("REPLICATION.*");

View File

@ -282,7 +282,7 @@ public class SolrRrdBackendFactory extends RrdBackendFactory implements SolrClos
backends.forEach((name, db) -> { backends.forEach((name, db) -> {
long lastModifiedTime = db.getLastModifiedTime(); long lastModifiedTime = db.getLastModifiedTime();
Pair<String, Long> stored = byName.get(name); Pair<String, Long> stored = byName.get(name);
Pair<String, Long> inMemory = new Pair(name, lastModifiedTime); Pair<String, Long> inMemory = new Pair<>(name, lastModifiedTime);
if (stored != null) { if (stored != null) {
if (stored.second() < lastModifiedTime) { if (stored.second() < lastModifiedTime) {
byName.put(name, inMemory); byName.put(name, inMemory);

View File

@ -81,6 +81,7 @@ public class PackageManager implements Closeable {
} }
} }
@SuppressWarnings({"unchecked", "rawtypes"})
public List<SolrPackageInstance> fetchInstalledPackageInstances() throws SolrException { public List<SolrPackageInstance> fetchInstalledPackageInstances() throws SolrException {
log.info("Getting packages from packages.json..."); log.info("Getting packages from packages.json...");
List<SolrPackageInstance> ret = new ArrayList<SolrPackageInstance>(); List<SolrPackageInstance> ret = new ArrayList<SolrPackageInstance>();
@ -112,6 +113,7 @@ public class PackageManager implements Closeable {
return ret; return ret;
} }
@SuppressWarnings({"unchecked"})
public Map<String, SolrPackageInstance> getPackagesDeployed(String collection) { public Map<String, SolrPackageInstance> getPackagesDeployed(String collection) {
Map<String, String> packages = null; Map<String, String> packages = null;
try { try {
@ -145,8 +147,9 @@ public class PackageManager implements Closeable {
} }
} }
@SuppressWarnings({"unchecked"})
private boolean deployPackage(SolrPackageInstance packageInstance, boolean pegToLatest, boolean isUpdate, boolean noprompt, private boolean deployPackage(SolrPackageInstance packageInstance, boolean pegToLatest, boolean isUpdate, boolean noprompt,
List<String> collections, String overrides[]) { List<String> collections, String[] overrides) {
List<String> previouslyDeployed = new ArrayList<>(); // collections where package is already deployed in List<String> previouslyDeployed = new ArrayList<>(); // collections where package is already deployed in
for (String collection: collections) { for (String collection: collections) {

View File

@ -122,6 +122,7 @@ public class RepositoryManager {
String existingRepositoriesJson = getRepositoriesJson(packageManager.zkClient); String existingRepositoriesJson = getRepositoriesJson(packageManager.zkClient);
log.info(existingRepositoriesJson); log.info(existingRepositoriesJson);
@SuppressWarnings({"unchecked"})
List<PackageRepository> repos = getMapper().readValue(existingRepositoriesJson, List.class); List<PackageRepository> repos = getMapper().readValue(existingRepositoriesJson, List.class);
repos.add(new DefaultPackageRepository(repoName, uri)); repos.add(new DefaultPackageRepository(repoName, uri));
if (packageManager.zkClient.exists(PackageUtils.REPOSITORIES_ZK_PATH, true) == false) { if (packageManager.zkClient.exists(PackageUtils.REPOSITORIES_ZK_PATH, true) == false) {

View File

@ -59,6 +59,11 @@ public class SolrPackageInstance implements ReflectMapWriter {
return name.equals(((SolrPackageInstance)obj).name) && version.equals(((SolrPackageInstance)obj).version); return name.equals(((SolrPackageInstance)obj).name) && version.equals(((SolrPackageInstance)obj).version);
} }
@Override
public int hashCode() {
throw new UnsupportedOperationException("TODO unimplemented");
}
@Override @Override
public String toString() { public String toString() {
return jsonStr(); return jsonStr();

View File

@ -209,6 +209,11 @@ public class PackageAPI {
return false; return false;
} }
@Override
public int hashCode() {
throw new UnsupportedOperationException("TODO unimplemented");
}
@Override @Override
public String toString() { public String toString() {
try { try {
@ -250,6 +255,7 @@ public class PackageAPI {
@Command(name = "add") @Command(name = "add")
@SuppressWarnings({"unchecked"})
public void add(SolrQueryRequest req, SolrQueryResponse rsp, PayloadObj<Package.AddVersion> payload) { public void add(SolrQueryRequest req, SolrQueryResponse rsp, PayloadObj<Package.AddVersion> payload) {
if (!checkEnabled(payload)) return; if (!checkEnabled(payload)) return;
Package.AddVersion add = payload.get(); Package.AddVersion add = payload.get();
@ -271,6 +277,7 @@ public class PackageAPI {
log.error("Error deserializing packages.json", e); log.error("Error deserializing packages.json", e);
packages = new Packages(); packages = new Packages();
} }
@SuppressWarnings({"rawtypes"})
List list = packages.packages.computeIfAbsent(add.pkg, Utils.NEW_ARRAYLIST_FUN); List list = packages.packages.computeIfAbsent(add.pkg, Utils.NEW_ARRAYLIST_FUN);
for (Object o : list) { for (Object o : list) {
if (o instanceof PkgVersion) { if (o instanceof PkgVersion) {

View File

@ -64,6 +64,7 @@ public class PackageLoader implements Closeable {
return packageClassLoaders.get(key); return packageClassLoaders.get(key);
} }
@SuppressWarnings({"unchecked"})
public Map<String, Package> getPackages() { public Map<String, Package> getPackages() {
return Collections.EMPTY_MAP; return Collections.EMPTY_MAP;
} }
@ -213,7 +214,7 @@ public class PackageLoader implements Closeable {
if (lessThan == null) { if (lessThan == null) {
return getLatest(); return getLatest();
} }
String latest = findBiggest(lessThan, new ArrayList(sortedVersions)); String latest = findBiggest(lessThan, new ArrayList<>(sortedVersions));
return latest == null ? null : myVersions.get(latest); return latest == null ? null : myVersions.get(latest);
} }
@ -271,6 +272,7 @@ public class PackageLoader implements Closeable {
return version.version; return version.version;
} }
@SuppressWarnings({"rawtypes"})
public Collection getFiles() { public Collection getFiles() {
return Collections.unmodifiableList(version.files); return Collections.unmodifiableList(version.files);
} }

View File

@ -35,13 +35,16 @@ import org.apache.solr.core.SolrCore;
* *
*/ */
public class LocalSolrQueryRequest extends SolrQueryRequestBase { public class LocalSolrQueryRequest extends SolrQueryRequestBase {
@SuppressWarnings({"rawtypes"})
public final static Map emptyArgs = new HashMap(0,1); public final static Map emptyArgs = new HashMap(0,1);
public String userPrincipalName = null; public String userPrincipalName = null;
protected static SolrParams makeParams(String query, String qtype, int start, int limit, Map args) { protected static SolrParams makeParams(String query, String qtype, int start, int limit,
@SuppressWarnings({"rawtypes"})Map args) {
Map<String,String[]> map = new HashMap<>(); Map<String,String[]> map = new HashMap<>();
for (Iterator iter = args.entrySet().iterator(); iter.hasNext();) { for (@SuppressWarnings({"rawtypes"})Iterator iter = args.entrySet().iterator(); iter.hasNext();) {
@SuppressWarnings({"rawtypes"})
Map.Entry e = (Map.Entry)iter.next(); Map.Entry e = (Map.Entry)iter.next();
String k = e.getKey().toString(); String k = e.getKey().toString();
Object v = e.getValue(); Object v = e.getValue();
@ -55,11 +58,12 @@ public class LocalSolrQueryRequest extends SolrQueryRequestBase {
return new MultiMapSolrParams(map); return new MultiMapSolrParams(map);
} }
public LocalSolrQueryRequest(SolrCore core, String query, String qtype, int start, int limit, Map args) { public LocalSolrQueryRequest(SolrCore core, String query, String qtype, int start, int limit,
@SuppressWarnings({"rawtypes"})Map args) {
super(core,makeParams(query,qtype,start,limit,args)); super(core,makeParams(query,qtype,start,limit,args));
} }
public LocalSolrQueryRequest(SolrCore core, NamedList args) { public LocalSolrQueryRequest(SolrCore core, @SuppressWarnings({"rawtypes"})NamedList args) {
super(core, args.toSolrParams()); super(core, args.toSolrParams());
} }

View File

@ -267,6 +267,7 @@ public class SimpleFacets {
} else { } else {
return base; return base;
} }
@SuppressWarnings({"rawtypes"})
AllGroupHeadsCollector allGroupHeadsCollector = grouping.getCommands().get(0).createAllGroupCollector(); AllGroupHeadsCollector allGroupHeadsCollector = grouping.getCommands().get(0).createAllGroupCollector();
searcher.search(base.getTopFilter(), allGroupHeadsCollector); searcher.search(base.getTopFilter(), allGroupHeadsCollector);
return new BitDocSet(allGroupHeadsCollector.retrieveGroupHeads(searcher.maxDoc())); return new BitDocSet(allGroupHeadsCollector.retrieveGroupHeads(searcher.maxDoc()));
@ -333,6 +334,7 @@ public class SimpleFacets {
); );
} }
@SuppressWarnings({"rawtypes"})
AllGroupsCollector collector = new AllGroupsCollector<>(new TermGroupSelector(groupField)); AllGroupsCollector collector = new AllGroupsCollector<>(new TermGroupSelector(groupField));
searcher.search(QueryUtils.combineQueryAndFilter(facetQuery, docSet.getTopFilter()), collector); searcher.search(QueryUtils.combineQueryAndFilter(facetQuery, docSet.getTopFilter()), collector);
return collector.getGroupCount(); return collector.getGroupCount();
@ -516,6 +518,7 @@ public class SimpleFacets {
String warningMessage String warningMessage
= "Raising facet.mincount from " + mincount + " to 1, because field " + field + " is Points-based."; = "Raising facet.mincount from " + mincount + " to 1, because field " + field + " is Points-based.";
log.warn(warningMessage); log.warn(warningMessage);
@SuppressWarnings({"unchecked"})
List<String> warnings = (List<String>)rb.rsp.getResponseHeader().get("warnings"); List<String> warnings = (List<String>)rb.rsp.getResponseHeader().get("warnings");
if (null == warnings) { if (null == warnings) {
warnings = new ArrayList<>(); warnings = new ArrayList<>();
@ -568,13 +571,16 @@ public class SimpleFacets {
//Go through the response to build the expected output for SimpleFacets //Go through the response to build the expected output for SimpleFacets
counts = new NamedList<>(); counts = new NamedList<>();
if(resObj != null) { if(resObj != null) {
@SuppressWarnings({"unchecked"})
NamedList<Object> res = (NamedList<Object>) resObj; NamedList<Object> res = (NamedList<Object>) resObj;
@SuppressWarnings({"unchecked"})
List<NamedList<Object>> buckets = (List<NamedList<Object>>)res.get("buckets"); List<NamedList<Object>> buckets = (List<NamedList<Object>>)res.get("buckets");
for(NamedList<Object> b : buckets) { for(NamedList<Object> b : buckets) {
counts.add(b.get("val").toString(), ((Number)b.get("count")).intValue()); counts.add(b.get("val").toString(), ((Number)b.get("count")).intValue());
} }
if(missing) { if(missing) {
@SuppressWarnings({"unchecked"})
NamedList<Object> missingCounts = (NamedList<Object>) res.get("missing"); NamedList<Object> missingCounts = (NamedList<Object>) res.get("missing");
counts.add(null, ((Number)missingCounts.get("count")).intValue()); counts.add(null, ((Number)missingCounts.get("count")).intValue());
} }
@ -797,6 +803,7 @@ public class SimpleFacets {
int maxThreads = req.getParams().getInt(FacetParams.FACET_THREADS, 0); int maxThreads = req.getParams().getInt(FacetParams.FACET_THREADS, 0);
Executor executor = maxThreads == 0 ? directExecutor : facetExecutor; Executor executor = maxThreads == 0 ? directExecutor : facetExecutor;
final Semaphore semaphore = new Semaphore((maxThreads <= 0) ? Integer.MAX_VALUE : maxThreads); final Semaphore semaphore = new Semaphore((maxThreads <= 0) ? Integer.MAX_VALUE : maxThreads);
@SuppressWarnings({"rawtypes"})
List<Future<NamedList>> futures = new ArrayList<>(facetFs.length); List<Future<NamedList>> futures = new ArrayList<>(facetFs.length);
if (fdebugParent != null) { if (fdebugParent != null) {
@ -815,6 +822,7 @@ public class SimpleFacets {
final String termList = localParams == null ? null : localParams.get(CommonParams.TERMS); final String termList = localParams == null ? null : localParams.get(CommonParams.TERMS);
final String key = parsed.key; final String key = parsed.key;
final String facetValue = parsed.facetValue; final String facetValue = parsed.facetValue;
@SuppressWarnings({"rawtypes"})
Callable<NamedList> callable = () -> { Callable<NamedList> callable = () -> {
try { try {
NamedList<Object> result = new SimpleOrderedMap<>(); NamedList<Object> result = new SimpleOrderedMap<>();
@ -839,6 +847,7 @@ public class SimpleFacets {
} }
}; };
@SuppressWarnings({"rawtypes"})
RunnableFuture<NamedList> runnableFuture = new FutureTask<>(callable); RunnableFuture<NamedList> runnableFuture = new FutureTask<>(callable);
semaphore.acquire();//may block and/or interrupt semaphore.acquire();//may block and/or interrupt
executor.execute(runnableFuture);//releases semaphore when done executor.execute(runnableFuture);//releases semaphore when done
@ -846,7 +855,7 @@ public class SimpleFacets {
}//facetFs loop }//facetFs loop
//Loop over futures to get the values. The order is the same as facetFs but shouldn't matter. //Loop over futures to get the values. The order is the same as facetFs but shouldn't matter.
for (Future<NamedList> future : futures) { for (@SuppressWarnings({"rawtypes"})Future<NamedList> future : futures) {
res.addAll(future.get()); res.addAll(future.get());
} }
assert semaphore.availablePermits() >= maxThreads; assert semaphore.availablePermits() >= maxThreads;
@ -1196,6 +1205,7 @@ public class SimpleFacets {
return res; return res;
} }
@SuppressWarnings({"rawtypes"})
public NamedList getHeatmapCounts() throws IOException, SyntaxError { public NamedList getHeatmapCounts() throws IOException, SyntaxError {
final NamedList<Object> resOuter = new SimpleOrderedMap<>(); final NamedList<Object> resOuter = new SimpleOrderedMap<>();
String[] unparsedFields = rb.req.getParams().getParams(FacetParams.FACET_HEATMAP); String[] unparsedFields = rb.req.getParams().getParams(FacetParams.FACET_HEATMAP);

View File

@ -211,6 +211,7 @@ public abstract class SolrQueryRequestBase implements SolrQueryRequest, Closeabl
return null; return null;
} }
@SuppressWarnings({"unchecked"})
protected Map<String, JsonSchemaValidator> getValidators(){ protected Map<String, JsonSchemaValidator> getValidators(){
return Collections.EMPTY_MAP; return Collections.EMPTY_MAP;
} }

View File

@ -45,7 +45,7 @@ public interface SolrRequestHandler extends SolrInfoBean {
* may be specified when declaring a request handler in * may be specified when declaring a request handler in
* solrconfig.xml * solrconfig.xml
*/ */
public void init(NamedList args); public void init(@SuppressWarnings({"rawtypes"})NamedList args);
/** /**

View File

@ -172,13 +172,15 @@ public class SolrRequestInfo {
public static ExecutorUtil.InheritableThreadLocalProvider getInheritableThreadLocalProvider() { public static ExecutorUtil.InheritableThreadLocalProvider getInheritableThreadLocalProvider() {
return new ExecutorUtil.InheritableThreadLocalProvider() { return new ExecutorUtil.InheritableThreadLocalProvider() {
@Override @Override
public void store(AtomicReference ctx) { @SuppressWarnings({"unchecked"})
public void store(@SuppressWarnings({"rawtypes"})AtomicReference ctx) {
SolrRequestInfo me = SolrRequestInfo.getRequestInfo(); SolrRequestInfo me = SolrRequestInfo.getRequestInfo();
if (me != null) ctx.set(me); if (me != null) ctx.set(me);
} }
@Override @Override
public void set(AtomicReference ctx) { @SuppressWarnings({"unchecked"})
public void set(@SuppressWarnings({"rawtypes"})AtomicReference ctx) {
SolrRequestInfo me = (SolrRequestInfo) ctx.get(); SolrRequestInfo me = (SolrRequestInfo) ctx.get();
if (me != null) { if (me != null) {
ctx.set(null); ctx.set(null);
@ -187,7 +189,7 @@ public class SolrRequestInfo {
} }
@Override @Override
public void clean(AtomicReference ctx) { public void clean(@SuppressWarnings({"rawtypes"})AtomicReference ctx) {
SolrRequestInfo.clearRequestInfo(); SolrRequestInfo.clearRequestInfo();
} }
}; };

View File

@ -45,6 +45,7 @@ class JsonQueryConverter {
// when isQParser==true, "val" is a query object of the form {query_type:{param1:val1, param2:val2}} // when isQParser==true, "val" is a query object of the form {query_type:{param1:val1, param2:val2}}
// when isQParser==false, "val" is a parameter on an existing qparser (which could be a simple parameter like 42, or a sub-query) // when isQParser==false, "val" is a parameter on an existing qparser (which could be a simple parameter like 42, or a sub-query)
@SuppressWarnings({"unchecked"})
private void buildLocalParams(StringBuilder builder, Object val, boolean isQParser, Map<String, String[]> additionalParams) { private void buildLocalParams(StringBuilder builder, Object val, boolean isQParser, Map<String, String[]> additionalParams) {
if (!isQParser && !(val instanceof Map)) { if (!isQParser && !(val instanceof Map)) {
// val is value of a query parser, and it is not a map // val is value of a query parser, and it is not a map
@ -136,6 +137,7 @@ class JsonQueryConverter {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Error when parsing json query, value of query field should not be a list, found : " + entry.getValue()); "Error when parsing json query, value of query field should not be a list, found : " + entry.getValue());
} }
@SuppressWarnings({"rawtypes"})
List l = (List) entry.getValue(); List l = (List) entry.getValue();
for (Object subVal : l) { for (Object subVal : l) {
builder.append(key).append("="); builder.append(key).append("=");

View File

@ -39,7 +39,9 @@ public class ObjectUtil {
} }
if (previous instanceof Map && current instanceof Map) { if (previous instanceof Map && current instanceof Map) {
@SuppressWarnings({"unchecked"})
Map<String,Object> prevMap = (Map<String,Object>)previous; Map<String,Object> prevMap = (Map<String,Object>)previous;
@SuppressWarnings({"unchecked"})
Map<String,Object> currMap = (Map<String,Object>)current; Map<String,Object> currMap = (Map<String,Object>)current;
if (prevMap.size() == 0) return; if (prevMap.size() == 0) return;
mergeMap(prevMap, currMap, path); mergeMap(prevMap, currMap, path);
@ -70,13 +72,15 @@ public class ObjectUtil {
} }
protected Object makeList(Object current, Object previous) { protected Object makeList(Object current, Object previous) {
@SuppressWarnings({"rawtypes"})
ArrayList lst = new ArrayList(); ArrayList lst = new ArrayList();
append(lst, previous); // make the original value(s) come first append(lst, previous); // make the original value(s) come first
append(lst, current); append(lst, current);
return lst; return lst;
} }
protected void append(List lst, Object current) { @SuppressWarnings({"unchecked"})
protected void append(@SuppressWarnings({"rawtypes"})List lst, Object current) {
if (current instanceof Collection) { if (current instanceof Collection) {
lst.addAll((Collection)current); lst.addAll((Collection)current);
} else { } else {
@ -89,6 +93,7 @@ public class ObjectUtil {
public static void mergeObjects(Map<String,Object> top, List<String> path, Object val, ConflictHandler handler) { public static void mergeObjects(Map<String,Object> top, List<String> path, Object val, ConflictHandler handler) {
Map<String,Object> outer = top; Map<String,Object> outer = top;
for (int i=0; i<path.size()-1; i++) { for (int i=0; i<path.size()-1; i++) {
@SuppressWarnings({"unchecked"})
Map<String,Object> sub = (Map<String,Object>)outer.get(path.get(i)); Map<String,Object> sub = (Map<String,Object>)outer.get(path.get(i));
if (sub == null) { if (sub == null) {
sub = new LinkedHashMap<String,Object>(); sub = new LinkedHashMap<String,Object>();
@ -107,6 +112,7 @@ public class ObjectUtil {
} }
} else if (val instanceof Map) { } else if (val instanceof Map) {
// merging at top level... // merging at top level...
@SuppressWarnings({"unchecked"})
Map<String,Object> newMap = (Map<String,Object>)val; Map<String,Object> newMap = (Map<String,Object>)val;
handler.mergeMap(outer, newMap, path); handler.mergeMap(outer, newMap, path);
} else { } else {

View File

@ -60,6 +60,7 @@ public class ValueSourceAugmenter extends DocTransformer
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public void setContext( ResultContext context ) { public void setContext( ResultContext context ) {
super.setContext(context); super.setContext(context);
try { try {
@ -86,6 +87,7 @@ public class ValueSourceAugmenter extends DocTransformer
// TODO: calculate this stuff just once across diff functions // TODO: calculate this stuff just once across diff functions
int idx = ReaderUtil.subIndex(docid, readerContexts); int idx = ReaderUtil.subIndex(docid, readerContexts);
LeafReaderContext rcontext = readerContexts.get(idx); LeafReaderContext rcontext = readerContexts.get(idx);
@SuppressWarnings({"unchecked"})
FunctionValues values = valueSource.getValues(fcontext, rcontext); FunctionValues values = valueSource.getValues(fcontext, rcontext);
int localId = docid - rcontext.docBase; int localId = docid - rcontext.docBase;
setValue(doc,values.objectVal(localId)); setValue(doc,values.objectVal(localId));

View File

@ -195,6 +195,7 @@ public abstract class BaseSolrResource extends ServerResource {
protected void handleException(Logger log) { protected void handleException(Logger log) {
Exception exception = getSolrResponse().getException(); Exception exception = getSolrResponse().getException();
if (null != exception) { if (null != exception) {
@SuppressWarnings({"rawtypes"})
NamedList info = new SimpleOrderedMap(); NamedList info = new SimpleOrderedMap();
int code = ResponseUtils.getErrorInfo(exception, info, log); int code = ResponseUtils.getErrorInfo(exception, info, log);
setStatus(Status.valueOf(code)); setStatus(Status.valueOf(code));

View File

@ -205,7 +205,9 @@ public abstract class ManagedResource {
"Stored data for "+resourceId+" is not a valid JSON object!"); "Stored data for "+resourceId+" is not a valid JSON object!");
} }
@SuppressWarnings({"unchecked"})
Map<String,Object> jsonMap = (Map<String,Object>)data; Map<String,Object> jsonMap = (Map<String,Object>)data;
@SuppressWarnings({"unchecked"})
Map<String,Object> initArgsMap = (Map<String,Object>)jsonMap.get(INIT_ARGS_JSON_FIELD); Map<String,Object> initArgsMap = (Map<String,Object>)jsonMap.get(INIT_ARGS_JSON_FIELD);
managedInitArgs = new NamedList<>(initArgsMap); managedInitArgs = new NamedList<>(initArgsMap);
log.info("Loaded initArgs {} for {}", managedInitArgs, resourceId); log.info("Loaded initArgs {} for {}", managedInitArgs, resourceId);

View File

@ -235,6 +235,7 @@ public class ManagedSynonymFilterFactory extends BaseManagedTokenFilterFactory {
madeChanges = true; madeChanges = true;
} }
} else if (val instanceof List) { } else if (val instanceof List) {
@SuppressWarnings({"unchecked"})
List<String> vals = (List<String>)val; List<String> vals = (List<String>)val;
if (output == null) { if (output == null) {

View File

@ -230,6 +230,7 @@ public class ManagedSynonymGraphFilterFactory extends BaseManagedTokenFilterFact
madeChanges = true; madeChanges = true;
} }
} else if (val instanceof List) { } else if (val instanceof List) {
@SuppressWarnings({"unchecked"})
List<String> vals = (List<String>)val; List<String> vals = (List<String>)val;
if (output == null) { if (output == null) {

View File

@ -514,6 +514,7 @@ public class CurrencyFieldType extends FieldType implements SchemaAware, Resourc
public Currency getTargetCurrency() { return targetCurrency; } public Currency getTargetCurrency() { return targetCurrency; }
@Override @Override
@SuppressWarnings({"unchecked"})
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext reader) throws IOException { public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext reader) throws IOException {
final FunctionValues amounts = amountValues.getValues(context, reader); final FunctionValues amounts = amountValues.getValues(context, reader);
final FunctionValues currencies = currencyValues.getValues(context, reader); final FunctionValues currencies = currencyValues.getValues(context, reader);

View File

@ -323,6 +323,7 @@ class SpatialDistanceQuery extends ExtendedQueryBase implements PostFilter {
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
protected Map lonContext; protected Map lonContext;
@SuppressWarnings({"unchecked"})
public SpatialWeight(IndexSearcher searcher, float boost) throws IOException { public SpatialWeight(IndexSearcher searcher, float boost) throws IOException {
super(SpatialDistanceQuery.this, boost); super(SpatialDistanceQuery.this, boost);
this.searcher = searcher; this.searcher = searcher;
@ -371,6 +372,7 @@ class SpatialDistanceQuery extends ExtendedQueryBase implements PostFilter {
int lastDistDoc; int lastDistDoc;
double lastDist; double lastDist;
@SuppressWarnings({"unchecked"})
public SpatialScorer(LeafReaderContext readerContext, SpatialWeight w, float qWeight) throws IOException { public SpatialScorer(LeafReaderContext readerContext, SpatialWeight w, float qWeight) throws IOException {
super(w); super(w);
this.weight = w; this.weight = w;

View File

@ -1869,6 +1869,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
collapseScore.setupIfNeeded(groupHeadSelector, rcontext); collapseScore.setupIfNeeded(groupHeadSelector, rcontext);
} }
@SuppressWarnings({"unchecked"})
public void setNextReader(LeafReaderContext context) throws IOException { public void setNextReader(LeafReaderContext context) throws IOException {
functionValues = this.valueSource.getValues(rcontext, context); functionValues = this.valueSource.getValues(rcontext, context);
} }
@ -2396,6 +2397,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
collapseScore.setupIfNeeded(groupHeadSelector, rcontext); collapseScore.setupIfNeeded(groupHeadSelector, rcontext);
} }
@SuppressWarnings({"unchecked"})
public void setNextReader(LeafReaderContext context) throws IOException { public void setNextReader(LeafReaderContext context) throws IOException {
functionValues = this.valueSource.getValues(rcontext, context); functionValues = this.valueSource.getValues(rcontext, context);
} }

View File

@ -58,6 +58,7 @@ public class FloatPayloadValueSource extends ValueSource {
final Terms terms = readerContext.reader().terms(indexedField); final Terms terms = readerContext.reader().terms(indexedField);
@SuppressWarnings({"unchecked"})
FunctionValues defaultValues = defaultValueSource.getValues(context, readerContext); FunctionValues defaultValues = defaultValueSource.getValues(context, readerContext);
// copied the bulk of this from TFValueSource - TODO: this is a very repeated pattern - base-class this advance logic stuff? // copied the bulk of this from TFValueSource - TODO: this is a very repeated pattern - base-class this advance logic stuff?

View File

@ -72,6 +72,7 @@ public class FunctionRangeQuery extends SolrConstantScoreQuery implements PostFi
protected void doSetNextReader(LeafReaderContext context) throws IOException { protected void doSetNextReader(LeafReaderContext context) throws IOException {
super.doSetNextReader(context); super.doSetNextReader(context);
maxdoc = context.reader().maxDoc(); maxdoc = context.reader().maxDoc();
@SuppressWarnings({"unchecked"})
FunctionValues dv = rangeFilt.getValueSource().getValues(fcontext, context); FunctionValues dv = rangeFilt.getValueSource().getValues(fcontext, context);
scorer = dv.getRangeScorer(weight, context, rangeFilt.getLowerVal(), rangeFilt.getUpperVal(), rangeFilt.isIncludeLower(), rangeFilt.isIncludeUpper()); scorer = dv.getRangeScorer(weight, context, rangeFilt.getLowerVal(), rangeFilt.getUpperVal(), rangeFilt.isIncludeLower(), rangeFilt.isIncludeUpper());
} }

View File

@ -927,6 +927,7 @@ public class Grouping {
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
Map context; Map context;
@SuppressWarnings({"unchecked"})
private ValueSourceGroupSelector newSelector() { private ValueSourceGroupSelector newSelector() {
return new ValueSourceGroupSelector(groupBy, context); return new ValueSourceGroupSelector(groupBy, context);
} }
@ -939,6 +940,7 @@ public class Grouping {
Collection<SearchGroup<MutableValue>> topGroups; Collection<SearchGroup<MutableValue>> topGroups;
@Override @Override
@SuppressWarnings({"unchecked"})
protected void prepare() throws IOException { protected void prepare() throws IOException {
context = ValueSource.newContext(searcher); context = ValueSource.newContext(searcher);
groupBy.createWeight(context, searcher); groupBy.createWeight(context, searcher);

View File

@ -1411,6 +1411,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
@Override @Override
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException { public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues vals = source.getValues(context, readerContext); final FunctionValues vals = source.getValues(context, readerContext);
return new DoubleDocValues(this) { return new DoubleDocValues(this) {
@Override @Override
@ -1458,7 +1459,9 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
@Override @Override
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException { public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues aVals = a.getValues(context, readerContext); final FunctionValues aVals = a.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues bVals = b.getValues(context, readerContext); final FunctionValues bVals = b.getValues(context, readerContext);
return new DoubleDocValues(this) { return new DoubleDocValues(this) {
@Override @Override
@ -1574,6 +1577,7 @@ public abstract class ValueSourceParser implements NamedListInitializedPlugin {
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context
, LeafReaderContext readerContext) throws IOException { , LeafReaderContext readerContext) throws IOException {
if (context.get(this) == null) { if (context.get(this) == null) {

View File

@ -285,6 +285,7 @@ public abstract class SlotAcc implements Closeable {
} }
@Override @Override
@SuppressWarnings({"unchecked"})
public void setNextReader(LeafReaderContext readerContext) throws IOException { public void setNextReader(LeafReaderContext readerContext) throws IOException {
super.setNextReader(readerContext); super.setNextReader(readerContext);
values = valueSource.getValues(fcontext.qcontext, readerContext); values = valueSource.getValues(fcontext.qcontext, readerContext);

View File

@ -60,8 +60,8 @@ public abstract class MultiStringFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"unchecked"})
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
final FunctionValues[] valsArr = new FunctionValues[sources.length]; final FunctionValues[] valsArr = new FunctionValues[sources.length];
for (int i=0; i<sources.length; i++) { for (int i=0; i<sources.length; i++) {
valsArr[i] = sources[i].getValues(context, readerContext); valsArr[i] = sources[i].getValues(context, readerContext);

View File

@ -86,6 +86,7 @@ public class ValueSourceRangeFilter extends SolrFilter {
return BitsFilteredDocIdSet.wrap(new DocIdSet() { return BitsFilteredDocIdSet.wrap(new DocIdSet() {
@Override @Override
public DocIdSetIterator iterator() throws IOException { public DocIdSetIterator iterator() throws IOException {
@SuppressWarnings({"unchecked"})
Scorer scorer = valueSource.getValues(context, readerContext).getRangeScorer(weight, readerContext, lowerVal, upperVal, includeLower, includeUpper); Scorer scorer = valueSource.getValues(context, readerContext).getRangeScorer(weight, readerContext, lowerVal, upperVal, includeLower, includeUpper);
return scorer == null ? null : scorer.iterator(); return scorer == null ? null : scorer.iterator();
} }
@ -102,8 +103,8 @@ public class ValueSourceRangeFilter extends SolrFilter {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"unchecked"})
public void createWeight(Map context, IndexSearcher searcher) throws IOException { public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
valueSource.createWeight(context, searcher); valueSource.createWeight(context, searcher);
} }

View File

@ -47,7 +47,9 @@ public class GeohashFunction extends ValueSource {
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues latDV = lat.getValues(context, readerContext); final FunctionValues latDV = lat.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues lonDV = lon.getValues(context, readerContext); final FunctionValues lonDV = lon.getValues(context, readerContext);

View File

@ -59,9 +59,11 @@ public class GeohashHaversineFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context,
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues gh1DV = geoHash1.getValues(context, readerContext); final FunctionValues gh1DV = geoHash1.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues gh2DV = geoHash2.getValues(context, readerContext); final FunctionValues gh2DV = geoHash2.getValues(context, readerContext);
return new DoubleDocValues(this) { return new DoubleDocValues(this) {
@ -97,8 +99,8 @@ public class GeohashHaversineFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"unchecked"})
public void createWeight(Map context, IndexSearcher searcher) throws IOException { public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
geoHash1.createWeight(context, searcher); geoHash1.createWeight(context, searcher);
geoHash2.createWeight(context, searcher); geoHash2.createWeight(context, searcher);
} }

View File

@ -56,9 +56,11 @@ public class HaversineConstFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context,
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues latVals = latSource.getValues(context, readerContext); final FunctionValues latVals = latSource.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues lonVals = lonSource.getValues(context, readerContext); final FunctionValues lonVals = lonSource.getValues(context, readerContext);
final double latCenterRad = this.latCenter * DEGREES_TO_RADIANS; final double latCenterRad = this.latCenter * DEGREES_TO_RADIANS;
final double lonCenterRad = this.lonCenter * DEGREES_TO_RADIANS; final double lonCenterRad = this.lonCenter * DEGREES_TO_RADIANS;
@ -85,8 +87,8 @@ public class HaversineConstFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"unchecked"})
public void createWeight(Map context, IndexSearcher searcher) throws IOException { public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
latSource.createWeight(context, searcher); latSource.createWeight(context, searcher);
lonSource.createWeight(context, searcher); lonSource.createWeight(context, searcher);
} }

View File

@ -93,10 +93,11 @@ public class HaversineFunction extends ValueSource {
@Override @Override
@SuppressWarnings({"rawtypes"}) public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { @SuppressWarnings({"unchecked"})
final FunctionValues vals1 = p1.getValues(context, readerContext); final FunctionValues vals1 = p1.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues vals2 = p2.getValues(context, readerContext); final FunctionValues vals2 = p2.getValues(context, readerContext);
return new DoubleDocValues(this) { return new DoubleDocValues(this) {
@Override @Override
@ -115,8 +116,8 @@ public class HaversineFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"unchecked"})
public void createWeight(Map context, IndexSearcher searcher) throws IOException { public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
p1.createWeight(context, searcher); p1.createWeight(context, searcher);
p2.createWeight(context, searcher); p2.createWeight(context, searcher);

View File

@ -45,7 +45,9 @@ public class StringDistanceFunction extends ValueSource {
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"rawtypes"})
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException { public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues str1DV = str1.getValues(context, readerContext); final FunctionValues str1DV = str1.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues str2DV = str2.getValues(context, readerContext); final FunctionValues str2DV = str2.getValues(context, readerContext);
return new FloatDocValues(this) { return new FloatDocValues(this) {

View File

@ -149,11 +149,12 @@ public class VectorDistanceFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) public FunctionValues getValues(@SuppressWarnings({"rawtypes"})Map context, LeafReaderContext readerContext) throws IOException {
public FunctionValues getValues(Map context, LeafReaderContext readerContext) throws IOException {
@SuppressWarnings({"unchecked"})
final FunctionValues vals1 = source1.getValues(context, readerContext); final FunctionValues vals1 = source1.getValues(context, readerContext);
@SuppressWarnings({"unchecked"})
final FunctionValues vals2 = source2.getValues(context, readerContext); final FunctionValues vals2 = source2.getValues(context, readerContext);
@ -178,8 +179,8 @@ public class VectorDistanceFunction extends ValueSource {
} }
@Override @Override
@SuppressWarnings({"rawtypes"}) @SuppressWarnings({"unchecked"})
public void createWeight(Map context, IndexSearcher searcher) throws IOException { public void createWeight(@SuppressWarnings({"rawtypes"})Map context, IndexSearcher searcher) throws IOException {
source1.createWeight(context, searcher); source1.createWeight(context, searcher);
source2.createWeight(context, searcher); source2.createWeight(context, searcher);
} }

View File

@ -473,6 +473,7 @@ public class HttpSolrCall {
int statusCode = authResponse.statusCode; int statusCode = authResponse.statusCode;
if (statusCode == AuthorizationResponse.PROMPT.statusCode) { if (statusCode == AuthorizationResponse.PROMPT.statusCode) {
@SuppressWarnings({"unchecked"})
Map<String, String> headers = (Map) getReq().getAttribute(AuthenticationPlugin.class.getName()); Map<String, String> headers = (Map) getReq().getAttribute(AuthenticationPlugin.class.getName());
if (headers != null) { if (headers != null) {
for (Map.Entry<String, String> e : headers.entrySet()) response.setHeader(e.getKey(), e.getValue()); for (Map.Entry<String, String> e : headers.entrySet()) response.setHeader(e.getKey(), e.getValue());
@ -775,6 +776,7 @@ public class HttpSolrCall {
} finally { } finally {
try { try {
if (exp != null) { if (exp != null) {
@SuppressWarnings({"rawtypes"})
SimpleOrderedMap info = new SimpleOrderedMap(); SimpleOrderedMap info = new SimpleOrderedMap();
int code = ResponseUtils.getErrorInfo(ex, info, log); int code = ResponseUtils.getErrorInfo(ex, info, log);
sendError(code, info.toString()); sendError(code, info.toString());
@ -885,6 +887,7 @@ public class HttpSolrCall {
if (null != ct) response.setContentType(ct); if (null != ct) response.setContentType(ct);
if (solrRsp.getException() != null) { if (solrRsp.getException() != null) {
@SuppressWarnings({"rawtypes"})
NamedList info = new SimpleOrderedMap(); NamedList info = new SimpleOrderedMap();
int code = ResponseUtils.getErrorInfo(solrRsp.getException(), info, log); int code = ResponseUtils.getErrorInfo(solrRsp.getException(), info, log);
solrRsp.add("error", info); solrRsp.add("error", info);
@ -1188,6 +1191,7 @@ public class HttpSolrCall {
static final String CONTENT_LENGTH_HEADER = "Content-Length"; static final String CONTENT_LENGTH_HEADER = "Content-Length";
List<CommandOperation> parsedCommands; List<CommandOperation> parsedCommands;
@SuppressWarnings({"unchecked"})
public List<CommandOperation> getCommands(boolean validateInput) { public List<CommandOperation> getCommands(boolean validateInput) {
if (parsedCommands == null) { if (parsedCommands == null) {
Iterable<ContentStream> contentStreams = solrReq.getContentStreams(); Iterable<ContentStream> contentStreams = solrReq.getContentStreams();
@ -1202,6 +1206,7 @@ public class HttpSolrCall {
return null; return null;
} }
@SuppressWarnings({"unchecked"})
protected Map<String, JsonSchemaValidator> getValidators(){ protected Map<String, JsonSchemaValidator> getValidators(){
return Collections.EMPTY_MAP; return Collections.EMPTY_MAP;
} }

View File

@ -38,7 +38,8 @@ public class ResponseUtils {
* <p> * <p>
* Status codes less than 100 are adjusted to be 500. * Status codes less than 100 are adjusted to be 500.
*/ */
public static int getErrorInfo(Throwable ex, NamedList info, Logger log) { @SuppressWarnings({"unchecked"})
public static int getErrorInfo(Throwable ex, @SuppressWarnings({"rawtypes"})NamedList info, Logger log) {
int code = 500; int code = 500;
if (ex instanceof SolrException) { if (ex instanceof SolrException) {
SolrException solrExc = (SolrException)ex; SolrException solrExc = (SolrException)ex;

View File

@ -80,7 +80,8 @@ public abstract class AbstractLuceneSpellChecker extends SolrSpellChecker {
protected StringDistance sd; protected StringDistance sd;
@Override @Override
public String init(NamedList config, SolrCore core) { @SuppressWarnings({"unchecked"})
public String init(@SuppressWarnings({"rawtypes"})NamedList config, SolrCore core) {
super.init(config, core); super.init(config, core);
indexDir = (String) config.get(INDEX_DIR); indexDir = (String) config.get(INDEX_DIR);
String accuracy = (String) config.get(ACCURACY); String accuracy = (String) config.get(ACCURACY);

View File

@ -96,7 +96,8 @@ public class DirectSolrSpellChecker extends SolrSpellChecker {
private DirectSpellChecker checker = new DirectSpellChecker(); private DirectSpellChecker checker = new DirectSpellChecker();
@Override @Override
public String init(NamedList config, SolrCore core) { @SuppressWarnings({"unchecked"})
public String init(@SuppressWarnings({"rawtypes"})NamedList config, SolrCore core) {
SolrParams params = config.toSolrParams(); SolrParams params = config.toSolrParams();

View File

@ -60,7 +60,7 @@ public class FileBasedSpellChecker extends AbstractLuceneSpellChecker {
public static final String WORD_FIELD_NAME = "word"; public static final String WORD_FIELD_NAME = "word";
@Override @Override
public String init(NamedList config, SolrCore core) { public String init(@SuppressWarnings({"rawtypes"})NamedList config, SolrCore core) {
super.init(config, core); super.init(config, core);
characterEncoding = (String) config.get(SOURCE_FILE_CHAR_ENCODING); characterEncoding = (String) config.get(SOURCE_FILE_CHAR_ENCODING);
return name; return name;

View File

@ -48,7 +48,7 @@ public class IndexBasedSpellChecker extends AbstractLuceneSpellChecker {
protected IndexReader reader; protected IndexReader reader;
@Override @Override
public String init(NamedList config, SolrCore core) { public String init(@SuppressWarnings({"rawtypes"})NamedList config, SolrCore core) {
super.init(config, core); super.init(config, core);
threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f
: (Float) config.get(THRESHOLD_TOKEN_FREQUENCY); : (Float) config.get(THRESHOLD_TOKEN_FREQUENCY);

View File

@ -45,6 +45,7 @@ import org.apache.solr.util.plugin.NamedListInitializedPlugin;
* @since solr 1.3 * @since solr 1.3
*/ */
public abstract class QueryConverter implements NamedListInitializedPlugin { public abstract class QueryConverter implements NamedListInitializedPlugin {
@SuppressWarnings({"rawtypes"})
private NamedList args; private NamedList args;
protected Analyzer analyzer; protected Analyzer analyzer;
@ -75,7 +76,7 @@ public abstract class QueryConverter implements NamedListInitializedPlugin {
*/ */
public static final int TERM_IN_BOOLEAN_QUERY_FLAG = 131072; public static final int TERM_IN_BOOLEAN_QUERY_FLAG = 131072;
@Override @Override
public void init(NamedList args) { public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
this.args = args; this.args = args;
} }

View File

@ -56,7 +56,7 @@ public abstract class SolrSpellChecker {
protected String field; protected String field;
protected String fieldTypeName; protected String fieldTypeName;
public String init(NamedList config, SolrCore core) { public String init(@SuppressWarnings({"rawtypes"})NamedList config, SolrCore core) {
name = (String) config.get(DICTIONARY_NAME); name = (String) config.get(DICTIONARY_NAME);
if (name == null) { if (name == null) {
name = DEFAULT_DICTIONARY_NAME; name = DEFAULT_DICTIONARY_NAME;

View File

@ -117,7 +117,7 @@ public class WordBreakSolrSpellChecker extends SolrSpellChecker {
private static final Pattern spacePattern = Pattern.compile("\\s+"); private static final Pattern spacePattern = Pattern.compile("\\s+");
@Override @Override
public String init(@SuppressWarnings("unchecked") NamedList config, public String init(@SuppressWarnings("rawtypes") NamedList config,
SolrCore core) { SolrCore core) {
String name = super.init(config, core); String name = super.init(config, core);
combineWords = boolParam(config, PARAM_COMBINE_WORDS); combineWords = boolParam(config, PARAM_COMBINE_WORDS);
@ -160,13 +160,13 @@ public class WordBreakSolrSpellChecker extends SolrSpellChecker {
return name; return name;
} }
private String strParam(@SuppressWarnings("unchecked") NamedList config, private String strParam(@SuppressWarnings("rawtypes") NamedList config,
String paramName) { String paramName) {
Object o = config.get(paramName); Object o = config.get(paramName);
return o == null ? null : o.toString(); return o == null ? null : o.toString();
} }
private boolean boolParam(@SuppressWarnings("unchecked") NamedList config, private boolean boolParam(@SuppressWarnings("rawtypes") NamedList config,
String paramName) { String paramName) {
String s = strParam(config, paramName); String s = strParam(config, paramName);
if ("true".equalsIgnoreCase(s) || "on".equalsIgnoreCase(s)) { if ("true".equalsIgnoreCase(s) || "on".equalsIgnoreCase(s)) {
@ -175,7 +175,7 @@ public class WordBreakSolrSpellChecker extends SolrSpellChecker {
return false; return false;
} }
private int intParam(@SuppressWarnings("unchecked") NamedList config, private int intParam(@SuppressWarnings("rawtypes") NamedList config,
String paramName) { String paramName) {
Object o = config.get(paramName); Object o = config.get(paramName);
if (o == null) { if (o == null) {

View File

@ -31,10 +31,11 @@ public abstract class DictionaryFactory {
/** Default dictionary implementation to use for IndexBasedDictionaries */ /** Default dictionary implementation to use for IndexBasedDictionaries */
public static String DEFAULT_INDEX_BASED_DICT = HighFrequencyDictionaryFactory.class.getName(); public static String DEFAULT_INDEX_BASED_DICT = HighFrequencyDictionaryFactory.class.getName();
@SuppressWarnings({"rawtypes"})
protected NamedList params; protected NamedList params;
/** Sets the parameters available to SolrSuggester for use in Dictionary creation */ /** Sets the parameters available to SolrSuggester for use in Dictionary creation */
public void setParams(NamedList params) { public void setParams(@SuppressWarnings({"rawtypes"})NamedList params) {
this.params = params; this.params = params;
} }

View File

@ -37,7 +37,7 @@ public abstract class LookupFactory {
* Create a Lookup using config options in <code>params</code> and * Create a Lookup using config options in <code>params</code> and
* current <code>core</code> * current <code>core</code>
*/ */
public abstract Lookup create(NamedList params, SolrCore core); public abstract Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core);
/** /**
* <p>Returns the filename in which the in-memory data structure is stored </p> * <p>Returns the filename in which the in-memory data structure is stored </p>

View File

@ -99,6 +99,7 @@ public class SolrSuggester implements Accountable {
* Uses the <code>config</code> and the <code>core</code> to initialize the underlying * Uses the <code>config</code> and the <code>core</code> to initialize the underlying
* Lucene suggester * Lucene suggester
* */ * */
@SuppressWarnings({"unchecked"})
public String init(NamedList<?> config, SolrCore core) { public String init(NamedList<?> config, SolrCore core) {
log.info("init: {}", config); log.info("init: {}", config);

View File

@ -85,7 +85,7 @@ public class Suggester extends SolrSpellChecker {
private LookupFactory factory; private LookupFactory factory;
@Override @Override
public String init(NamedList config, SolrCore core) { public String init(@SuppressWarnings({"rawtypes"})NamedList config, SolrCore core) {
log.info("init: {}", config); log.info("init: {}", config);
String name = super.init(config, core); String name = super.init(config, core);
threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f threshold = config.get(THRESHOLD_TOKEN_FREQUENCY) == null ? 0.0f

View File

@ -82,7 +82,7 @@ public class AnalyzingInfixLookupFactory extends LookupFactory {
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
// mandatory parameter // mandatory parameter
Object fieldTypeName = params.get(QUERY_ANALYZER); Object fieldTypeName = params.get(QUERY_ANALYZER);
if (fieldTypeName == null) { if (fieldTypeName == null) {

View File

@ -75,7 +75,7 @@ public class AnalyzingLookupFactory extends LookupFactory {
private static final String FILENAME = "wfsta.bin"; private static final String FILENAME = "wfsta.bin";
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
// mandatory parameter // mandatory parameter
Object fieldTypeName = params.get(QUERY_ANALYZER); Object fieldTypeName = params.get(QUERY_ANALYZER);
if (fieldTypeName == null) { if (fieldTypeName == null) {

View File

@ -70,7 +70,7 @@ public class BlendedInfixLookupFactory extends AnalyzingInfixLookupFactory {
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
// mandatory parameter // mandatory parameter
Object fieldTypeName = params.get(QUERY_ANALYZER); Object fieldTypeName = params.get(QUERY_ANALYZER);
if (fieldTypeName == null) { if (fieldTypeName == null) {

View File

@ -50,7 +50,7 @@ public class FSTLookupFactory extends LookupFactory {
public static final String EXACT_MATCH_FIRST = "exactMatchFirst"; public static final String EXACT_MATCH_FIRST = "exactMatchFirst";
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
int buckets = params.get(WEIGHT_BUCKETS) != null int buckets = params.get(WEIGHT_BUCKETS) != null
? Integer.parseInt(params.get(WEIGHT_BUCKETS).toString()) ? Integer.parseInt(params.get(WEIGHT_BUCKETS).toString())
: 10; : 10;

View File

@ -53,7 +53,7 @@ public class FreeTextLookupFactory extends LookupFactory {
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
Object fieldTypeName = params.get(QUERY_ANALYZER); Object fieldTypeName = params.get(QUERY_ANALYZER);
if (fieldTypeName == null) { if (fieldTypeName == null) {
throw new IllegalArgumentException("Error in configuration: " + QUERY_ANALYZER + " parameter is mandatory"); throw new IllegalArgumentException("Error in configuration: " + QUERY_ANALYZER + " parameter is mandatory");

View File

@ -68,7 +68,7 @@ public class FuzzyLookupFactory extends LookupFactory {
private static final String FILENAME = "fwfsta.bin"; private static final String FILENAME = "fwfsta.bin";
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
// mandatory parameter // mandatory parameter
Object fieldTypeName = params.get(AnalyzingLookupFactory.QUERY_ANALYZER); Object fieldTypeName = params.get(AnalyzingLookupFactory.QUERY_ANALYZER);

View File

@ -40,7 +40,7 @@ public class WFSTLookupFactory extends LookupFactory {
private static final String FILENAME = "wfst.bin"; private static final String FILENAME = "wfst.bin";
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
boolean exactMatchFirst = params.get(EXACT_MATCH_FIRST) != null boolean exactMatchFirst = params.get(EXACT_MATCH_FIRST) != null
? Boolean.valueOf(params.get(EXACT_MATCH_FIRST).toString()) ? Boolean.valueOf(params.get(EXACT_MATCH_FIRST).toString())
: true; : true;

View File

@ -35,7 +35,7 @@ public class JaspellLookupFactory extends LookupFactory {
private static final String FILENAME = "jaspell.dat"; private static final String FILENAME = "jaspell.dat";
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
log.info("init: {}", params); log.info("init: {}", params);
return new JaspellLookup(); return new JaspellLookup();
} }

View File

@ -29,7 +29,7 @@ public class TSTLookupFactory extends LookupFactory {
private static final String FILENAME = "tst.dat"; private static final String FILENAME = "tst.dat";
@Override @Override
public Lookup create(NamedList params, SolrCore core) { public Lookup create(@SuppressWarnings({"rawtypes"})NamedList params, SolrCore core) {
return new TSTLookup(getTempDir(), "suggester"); return new TSTLookup(getTempDir(), "suggester");
} }

View File

@ -173,7 +173,7 @@ public class BlockDirectory extends FilterDirectory implements ShutdownAwareDire
@Override @Override
public IndexInput clone() { public IndexInput clone() {
CachedIndexInput clone = (CachedIndexInput) super.clone(); CachedIndexInput clone = (CachedIndexInput) super.clone();
clone.source = (IndexInput) source.clone(); clone.source = source.clone();
return clone; return clone;
} }

View File

@ -609,6 +609,7 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
} }
@Override @Override
@SuppressWarnings({"rawtypes"})
public void commit(CommitUpdateCommand cmd) throws IOException { public void commit(CommitUpdateCommand cmd) throws IOException {
TestInjection.injectDirectUpdateLatch(); TestInjection.injectDirectUpdateLatch();
if (cmd.prepareCommit) { if (cmd.prepareCommit) {
@ -623,7 +624,6 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
if (cmd.expungeDeletes) expungeDeleteCommands.mark(); if (cmd.expungeDeletes) expungeDeleteCommands.mark();
} }
@SuppressWarnings({"rawtypes"})
Future[] waitSearcher = null; Future[] waitSearcher = null;
if (cmd.waitSearcher) { if (cmd.waitSearcher) {
waitSearcher = new Future[1]; waitSearcher = new Future[1];

View File

@ -105,6 +105,7 @@ public class IndexFingerprint implements MapSerializable {
} }
} }
@SuppressWarnings({"unchecked"})
public static IndexFingerprint getFingerprint(SolrIndexSearcher searcher, LeafReaderContext ctx, Long maxVersion) public static IndexFingerprint getFingerprint(SolrIndexSearcher searcher, LeafReaderContext ctx, Long maxVersion)
throws IOException { throws IOException {
SchemaField versionField = VersionInfo.getAndCheckVersionField(searcher.getSchema()); SchemaField versionField = VersionInfo.getAndCheckVersionField(searcher.getSchema());

View File

@ -208,6 +208,7 @@ public class VersionInfo {
* Returns the latest version from the index, searched by the given id (bytes) as seen from the realtime searcher. * Returns the latest version from the index, searched by the given id (bytes) as seen from the realtime searcher.
* Returns null if no document can be found in the index for the given id. * Returns null if no document can be found in the index for the given id.
*/ */
@SuppressWarnings({"unchecked"})
public Long getVersionFromIndex(BytesRef idBytes) { public Long getVersionFromIndex(BytesRef idBytes) {
// TODO: we could cache much of this and invalidate during a commit. // TODO: we could cache much of this and invalidate during a commit.
// TODO: most DocValues classes are threadsafe - expose which. // TODO: most DocValues classes are threadsafe - expose which.
@ -238,6 +239,7 @@ public class VersionInfo {
/** /**
* Returns the highest version from the index, or 0L if no versions can be found in the index. * Returns the highest version from the index, or 0L if no versions can be found in the index.
*/ */
@SuppressWarnings({"unchecked"})
public Long getMaxVersionFromIndex(IndexSearcher searcher) throws IOException { public Long getMaxVersionFromIndex(IndexSearcher searcher) throws IOException {
final String versionFieldName = versionField.getName(); final String versionFieldName = versionField.getName();

View File

@ -227,7 +227,7 @@ public class CloneFieldUpdateProcessorFactory
* "source" and "dest" init params do <em>not</em> exist. * "source" and "dest" init params do <em>not</em> exist.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void initSimpleRegexReplacement(NamedList args) { private void initSimpleRegexReplacement(@SuppressWarnings({"rawtypes"})NamedList args) {
// The syntactic sugar for the case where there is only one regex pattern for source and the same pattern // The syntactic sugar for the case where there is only one regex pattern for source and the same pattern
// is used for the destination pattern... // is used for the destination pattern...
// //

View File

@ -353,6 +353,7 @@ public class DocBasedVersionConstraintsProcessor extends UpdateRequestProcessor
return values; return values;
} }
@SuppressWarnings({"unchecked"})
private static FunctionValues getFunctionValues(LeafReaderContext segmentContext, private static FunctionValues getFunctionValues(LeafReaderContext segmentContext,
SchemaField field, SchemaField field,
SolrIndexSearcher searcher) throws IOException { SolrIndexSearcher searcher) throws IOException {

View File

@ -55,8 +55,9 @@ import static org.apache.solr.update.processor.FieldMutatingUpdateProcessor.SELE
public final class MaxFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory { public final class MaxFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
@Override @Override
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked"})
public Collection pickSubset(Collection values) { public Collection<Object> pickSubset(@SuppressWarnings({"rawtypes"})Collection values) {
@SuppressWarnings({"rawtypes"})
Collection result = values; Collection result = values;
try { try {
// NOTE: the extra cast to Object is needed to prevent compile // NOTE: the extra cast to Object is needed to prevent compile

View File

@ -55,8 +55,9 @@ import static org.apache.solr.update.processor.FieldMutatingUpdateProcessor.SELE
public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory { public final class MinFieldValueUpdateProcessorFactory extends FieldValueSubsetUpdateProcessorFactory {
@Override @Override
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked"})
public Collection pickSubset(Collection values) { public Collection<Object> pickSubset(@SuppressWarnings({"rawtypes"})Collection values) {
@SuppressWarnings({"rawtypes"})
Collection result = values; Collection result = values;
try { try {
// NOTE: the extra cast to Object is needed to prevent compile // NOTE: the extra cast to Object is needed to prevent compile

View File

@ -55,8 +55,7 @@ public class UniqFieldsUpdateProcessorFactory extends FieldValueSubsetUpdateProc
} }
@Override @Override
@SuppressWarnings({"unchecked", "rawtypes"}) public Collection<Object> pickSubset(@SuppressWarnings({"rawtypes"})Collection values) {
public Collection pickSubset(Collection values) {
Set<Object> uniqs = new HashSet<>(); Set<Object> uniqs = new HashSet<>();
List<Object> result = new ArrayList<>(values.size()); List<Object> result = new ArrayList<>(values.size());
for (Object o : values) { for (Object o : values) {