From f96488180cfbd03903f69db077f45420a4199858 Mon Sep 17 00:00:00 2001 From: Erick Erickson Date: Sun, 7 Jun 2020 08:10:35 -0400 Subject: [PATCH] SOLR-14542: Fix or suppress warnings in solr/handler/dataimport --- solr/CHANGES.txt | 6 ++++-- .../dataimport/MailEntityProcessor.java | 1 + .../dataimport/TikaEntityProcessor.java | 1 + .../handler/dataimport/ClobTransformer.java | 1 + .../solr/handler/dataimport/Context.java | 2 ++ .../solr/handler/dataimport/ContextImpl.java | 6 +++++- .../handler/dataimport/DataImportHandler.java | 8 +++++--- .../solr/handler/dataimport/DataImporter.java | 6 ++++++ .../dataimport/DateFormatTransformer.java | 1 + .../solr/handler/dataimport/DebugLogger.java | 12 +++++++++++- .../solr/handler/dataimport/DocBuilder.java | 12 +++++++++--- .../dataimport/EntityProcessorWrapper.java | 18 ++++++++++++------ .../dataimport/HTMLStripTransformer.java | 1 + .../handler/dataimport/JdbcDataSource.java | 1 + .../dataimport/NumberFormatTransformer.java | 1 + .../dataimport/PlainTextEntityProcessor.java | 1 + .../handler/dataimport/RegexTransformer.java | 4 ++-- .../dataimport/TemplateTransformer.java | 1 + .../dataimport/XPathEntityProcessor.java | 7 ++++++- .../handler/dataimport/XPathRecordReader.java | 1 + .../dataimport/AbstractDIHCacheTestCase.java | 2 +- .../AbstractDataImportHandlerTestCase.java | 9 ++++++--- .../dataimport/MockInitialContextFactory.java | 2 +- .../dataimport/TestClobTransformer.java | 2 ++ .../handler/dataimport/TestDataConfig.java | 1 + .../handler/dataimport/TestDocBuilder.java | 10 ++++++++-- .../handler/dataimport/TestDocBuilder2.java | 16 ++++++++++++++-- .../handler/dataimport/TestEphemeralCache.java | 3 +++ .../handler/dataimport/TestErrorHandling.java | 1 + .../handler/dataimport/TestFieldReader.java | 1 + .../TestFileListEntityProcessor.java | 8 +++++++- .../TestJdbcDataSourceConvertType.java | 2 +- .../dataimport/TestLineEntityProcessor.java | 8 ++++++++ .../TestPlainTextEntityProcessor.java | 3 +++ .../dataimport/TestRegexTransformer.java | 5 +++++ .../dataimport/TestScriptTransformer.java | 4 +++- .../TestSolrEntityProcessorUnit.java | 3 ++- .../dataimport/TestTemplateTransformer.java | 4 ++++ .../dataimport/TestVariableResolver.java | 1 + .../handler/dataimport/TestWriterImpl.java | 2 ++ .../dataimport/TestXPathEntityProcessor.java | 15 +++++++++++++++ .../dataimport/TestXPathRecordReader.java | 1 + .../dataimport/TestZKPropertiesWriter.java | 2 ++ 43 files changed, 164 insertions(+), 32 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index a9da21670b9..d03c1a2c8c9 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -133,8 +133,8 @@ Improvements * SOLR-11334: hl.fl and tv.fl now parse field lists when they have both commas and spaces (David Smiley, Yasufumi Mizoguchi) -* SOLR-14442: bin/solr and bin\solr.cmd invoke jstack before forceful termination, if jstack is available. - Also, bin\solr.cmd executes forceful termination even port is unbinded already (Christine Poerschke via Mikhail Khludnev). +* SOLR-14442: bin/solr and bin\solr.cmd invoke jstack before forceful termination, if jstack is available. + Also, bin\solr.cmd executes forceful termination even port is unbinded already (Christine Poerschke via Mikhail Khludnev). Optimizations --------------------- @@ -300,6 +300,8 @@ Other Changes * SOLR-13492: Ensure explicit GCs are concurrent by adding '+ExplicitGCInvokesConcurrent'. (Guna Sekhar Dora, Shawn Heisey, Munendra S N) +* SOLR-14542: Fix or suppress warnings in solr/handler/dataimport (Erick Erickson) + ================== 8.5.2 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java b/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java index 7c65f359b9f..6e5ad92c12c 100644 --- a/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java +++ b/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/MailEntityProcessor.java @@ -253,6 +253,7 @@ public class MailEntityProcessor extends EntityProcessorBase { } } + @SuppressWarnings({"unchecked"}) public void addPartToDocument(Part part, Map row, boolean outerMost) throws Exception { if (part instanceof Message) { addEnvelopeToDocument(part, row); diff --git a/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java b/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java index c789fc0c631..78a53fac258 100644 --- a/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java +++ b/solr/contrib/dataimporthandler-extras/src/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java @@ -132,6 +132,7 @@ public class TikaEntityProcessor extends EntityProcessorBase { public Map nextRow() { if(done) return null; Map row = new HashMap<>(); + @SuppressWarnings({"unchecked"}) DataSource dataSource = context.getDataSource(); InputStream is = dataSource.getData(context.getResolvedEntityAttribute(URL)); ContentHandler contentHandler = null; diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ClobTransformer.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ClobTransformer.java index 4bbe0467349..2e9d93a0c1a 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ClobTransformer.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ClobTransformer.java @@ -46,6 +46,7 @@ public class ClobTransformer extends Transformer { srcCol = column; Object o = aRow.get(srcCol); if (o instanceof List) { + @SuppressWarnings({"unchecked"}) List inputs = (List) o; List results = new ArrayList<>(); for (Object input : inputs) { diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java index 4d0cb3a683c..70dbbcb6ec6 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/Context.java @@ -102,6 +102,7 @@ public abstract class Context { * @see org.apache.solr.handler.dataimport.DataSource * @see #getDataSource(String) */ + @SuppressWarnings({"rawtypes"}) public abstract DataSource getDataSource(); /** @@ -112,6 +113,7 @@ public abstract class Context { * @return a new DataSource instance * @see org.apache.solr.handler.dataimport.DataSource */ + @SuppressWarnings({"rawtypes"}) public abstract DataSource getDataSource(String name); /** diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ContextImpl.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ContextImpl.java index 20a2aad456d..a47434e638b 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ContextImpl.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ContextImpl.java @@ -38,6 +38,7 @@ public class ContextImpl extends Context { private VariableResolver resolver; + @SuppressWarnings({"rawtypes"}) private DataSource ds; private String currProcess; @@ -57,7 +58,7 @@ public class ContextImpl extends Context { public ContextImpl(EntityProcessorWrapper epw, VariableResolver resolver, - DataSource ds, String currProcess, + @SuppressWarnings({"rawtypes"})DataSource ds, String currProcess, Map global, ContextImpl parentContext, DocBuilder docBuilder) { this.epw = epw; this.docBuilder = docBuilder; @@ -83,6 +84,7 @@ public class ContextImpl extends Context { } @Override + @SuppressWarnings({"unchecked"}) public List> getAllEntityFields() { return epw==null || epw.getEntity() == null ? Collections.EMPTY_LIST : epw.getEntity().getAllFieldsList(); } @@ -93,6 +95,7 @@ public class ContextImpl extends Context { } @Override + @SuppressWarnings({"rawtypes"}) public DataSource getDataSource() { if (ds != null) return ds; if(epw==null) { return null; } @@ -108,6 +111,7 @@ public class ContextImpl extends Context { } @Override + @SuppressWarnings({"rawtypes"}) public DataSource getDataSource(String name) { return dataImporter.getDataSourceInstance(epw==null ? null : epw.getEntity(), name, this); } diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java index 94b28481efb..296fabed453 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java @@ -89,8 +89,8 @@ public class DataImportHandler extends RequestHandlerBase implements } @Override - @SuppressWarnings("unchecked") - public void init(NamedList args) { + + public void init(@SuppressWarnings({"rawtypes"})NamedList args) { super.init(args); Map macro = new HashMap<>(); macro.put("expandMacros", "false"); @@ -131,6 +131,7 @@ public class DataImportHandler extends RequestHandlerBase implements } } SolrParams params = req.getParams(); + @SuppressWarnings({"rawtypes"}) NamedList defaultParams = (NamedList) initArgs.get("defaults"); RequestInfo requestParams = new RequestInfo(req, getParamsMap(params), contentStream); String command = requestParams.getCommand(); @@ -242,7 +243,7 @@ public class DataImportHandler extends RequestHandlerBase implements SolrParams reqParams = req.getParams(); String writerClassStr = null; if (reqParams != null && reqParams.get(PARAM_WRITER_IMPL) != null) { - writerClassStr = (String) reqParams.get(PARAM_WRITER_IMPL); + writerClassStr = reqParams.get(PARAM_WRITER_IMPL); } DIHWriter writer; if (writerClassStr != null @@ -252,6 +253,7 @@ public class DataImportHandler extends RequestHandlerBase implements try { @SuppressWarnings("unchecked") Class writerClass = DocBuilder.loadClass(writerClassStr, req.getCore()); + @SuppressWarnings({"rawtypes"}) Constructor cnstr = writerClass.getConstructor(new Class[] { UpdateRequestProcessor.class, SolrQueryRequest.class}); return cnstr.newInstance((Object) processor, (Object) req); diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java index 07ab9bcf51b..c5b2f70bf22 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImporter.java @@ -142,6 +142,7 @@ public class DataImporter { String name = defaultParams.getName(position); if (name.equals("datasource")) { success = true; + @SuppressWarnings({"rawtypes"}) NamedList dsConfig = (NamedList) defaultParams.getVal(position); log.info("Getting configuration for Global Datasource..."); Map props = new HashMap<>(); @@ -361,6 +362,7 @@ public class DataImporter { return store.get(key); } + @SuppressWarnings({"unchecked", "rawtypes"}) public DataSource getDataSourceInstance(Entity key, String name, Context ctx) { Map p = requestLevelDataSourceProps.get(name); if (p == null) @@ -373,6 +375,7 @@ public class DataImporter { throw new DataImportHandlerException(SEVERE, "No dataSource :" + name + " available for entity :" + key.getName()); String type = p.get(TYPE); + @SuppressWarnings({"rawtypes"}) DataSource dataSrc = null; if (type == null) { dataSrc = new JdbcDataSource(); @@ -493,11 +496,13 @@ public class DataImporter { Map getStatusMessages() { //this map object is a Collections.synchronizedMap(new LinkedHashMap()). if we // synchronize on the object it must be safe to iterate through the map + @SuppressWarnings({"rawtypes"}) Map statusMessages = (Map) retrieve(STATUS_MSGS); Map result = new LinkedHashMap<>(); if (statusMessages != null) { synchronized (statusMessages) { for (Object o : statusMessages.entrySet()) { + @SuppressWarnings({"rawtypes"}) Map.Entry e = (Map.Entry) o; //the toString is taken because some of the Objects create the data lazily when toString() is called result.put((String) e.getKey(), e.getValue().toString()); @@ -524,6 +529,7 @@ public class DataImporter { /** * used by tests. */ + @SuppressWarnings({"unchecked"}) Map getEvaluators(List> fn) { Map evaluators = new HashMap<>(); evaluators.put(Evaluator.DATE_FORMAT_EVALUATOR, new DateFormatEvaluator()); diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java index 6da9cc1b08b..61edbe61117 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DateFormatTransformer.java @@ -68,6 +68,7 @@ public class DateFormatTransformer extends Transformer { try { Object o = aRow.get(srcCol); if (o instanceof List) { + @SuppressWarnings({"rawtypes"}) List inputs = (List) o; List results = new ArrayList<>(); for (Object input : inputs) { diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DebugLogger.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DebugLogger.java index 2fd93031073..9de42fc6f3a 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DebugLogger.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DebugLogger.java @@ -44,6 +44,7 @@ import java.util.Stack; class DebugLogger { private Stack debugStack; + @SuppressWarnings({"rawtypes"}) NamedList output; // private final SolrWriter writer1; @@ -54,6 +55,7 @@ class DebugLogger { boolean enabled = true; + @SuppressWarnings({"rawtypes"}) public DebugLogger() { // writer = solrWriter; output = new NamedList(); @@ -75,6 +77,7 @@ class DebugLogger { return debugStack.isEmpty() ? null : debugStack.peek(); } + @SuppressWarnings({"unchecked"}) public void log(DIHLogLevels event, String name, Object row) { if (event == DIHLogLevels.DISABLE_LOGGING) { enabled = false; @@ -150,9 +153,12 @@ class DebugLogger { } } - private void addToNamedList(NamedList nl, Object row) { + @SuppressWarnings({"unchecked"}) + private void addToNamedList(@SuppressWarnings({"rawtypes"})NamedList nl, Object row) { if (row instanceof List) { + @SuppressWarnings({"rawtypes"}) List list = (List) row; + @SuppressWarnings({"rawtypes"}) NamedList l = new NamedList(); nl.add(null, l); for (Object o : list) { @@ -167,6 +173,7 @@ class DebugLogger { } } + @SuppressWarnings({"rawtypes"}) DataSource wrapDs(final DataSource ds) { return new DataSource() { @Override @@ -236,6 +243,7 @@ class DebugLogger { } static String getTransformerName(Transformer t) { + @SuppressWarnings({"rawtypes"}) Class transClass = t.getClass(); if (t instanceof EntityProcessorWrapper.ReflectionTransformer) { return ((EntityProcessorWrapper.ReflectionTransformer) t).trans; @@ -256,12 +264,14 @@ class DebugLogger { int tCount, rowCount; + @SuppressWarnings({"rawtypes"}) NamedList lst; DIHLogLevels type; DebugInfo parent; + @SuppressWarnings({"unchecked", "rawtypes"}) public DebugInfo(String name, DIHLogLevels type, DebugInfo parent) { this.name = name; this.type = type; diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java index 8db73ca1909..0f8dd6ed323 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java @@ -66,7 +66,7 @@ public class DocBuilder { private EntityProcessorWrapper currentEntityProcessorWrapper; - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) private Map statusMessages = Collections.synchronizedMap(new LinkedHashMap()); public Statistics importStatistics = new Statistics(); @@ -157,6 +157,7 @@ public class DocBuilder { private void invokeEventListener(String className, Exception lastException) { try { + @SuppressWarnings({"unchecked"}) EventListener listener = (EventListener) loadClass(className, dataImporter.getCore()).getConstructor().newInstance(); notifyListener(listener, lastException); } catch (Exception e) { @@ -315,6 +316,7 @@ public class DocBuilder { } } + @SuppressWarnings({"unchecked"}) void handleError(String message, Exception e) { if (!dataImporter.getCore().getCoreContainer().isZooKeeperAware()) { writer.rollback(); @@ -595,6 +597,7 @@ public class DocBuilder { Object value = arow.get(DELETE_DOC_BY_ID); if (value != null) { if (value instanceof Collection) { + @SuppressWarnings({"rawtypes"}) Collection collection = (Collection) value; for (Object o : collection) { writer.deleteDoc(o.toString()); @@ -608,6 +611,7 @@ public class DocBuilder { value = arow.get(DELETE_DOC_BY_QUERY); if (value != null) { if (value instanceof Collection) { + @SuppressWarnings({"rawtypes"}) Collection collection = (Collection) value; for (Object o : collection) { writer.deleteByQuery(o.toString()); @@ -691,6 +695,7 @@ public class DocBuilder { private void addFieldToDoc(Object value, String name, boolean multiValued, DocWrapper doc) { if (value instanceof Collection) { + @SuppressWarnings({"rawtypes"}) Collection collection = (Collection) value; if (multiValued) { for (Object o : collection) { @@ -716,6 +721,7 @@ public class DocBuilder { } } + @SuppressWarnings({"unchecked"}) public EntityProcessorWrapper getEntityProcessorWrapper(Entity entity) { EntityProcessor entityProcessor = null; if (entity.getProcessorName() == null) { @@ -776,7 +782,7 @@ public class DocBuilder { * * @return an iterator to the list of keys for which Solr documents should be updated. */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public Set> collectDelta(EntityProcessorWrapper epw, VariableResolver resolver, Set> deletedRows) { //someone called abort @@ -929,7 +935,7 @@ public class DocBuilder { return reqParams; } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) static Class loadClass(String name, SolrCore core) throws ClassNotFoundException { try { return core != null ? diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java index f63bfbd528f..d2a01b27b8b 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java @@ -45,6 +45,7 @@ public class EntityProcessorWrapper extends EntityProcessor { private EntityProcessor delegate; private Entity entity; + @SuppressWarnings({"rawtypes"}) private DataSource datasource; private List children = new ArrayList<>(); private DocBuilder docBuilder; @@ -68,7 +69,7 @@ public class EntityProcessorWrapper extends EntityProcessor { public void init(Context context) { rowcache = null; this.context = context; - resolver = (VariableResolver) context.getVariableResolver(); + resolver = context.getVariableResolver(); if (entityName == null) { onError = resolver.replaceTokens(context.getEntityAttribute(ON_ERROR)); if (onError == null) onError = ABORT; @@ -110,6 +111,7 @@ public class EntityProcessorWrapper extends EntityProcessor { continue; } try { + @SuppressWarnings({"rawtypes"}) Class clazz = DocBuilder.loadClass(trans, context.getSolrCore()); if (Transformer.class.isAssignableFrom(clazz)) { transformers.add((Transformer) clazz.getConstructor().newInstance()); @@ -153,13 +155,14 @@ public class EntityProcessorWrapper extends EntityProcessor { static class ReflectionTransformer extends Transformer { final Method meth; + @SuppressWarnings({"rawtypes"}) final Class clazz; final String trans; final Object o; - public ReflectionTransformer(Method meth, Class clazz, String trans) + public ReflectionTransformer(Method meth, @SuppressWarnings({"rawtypes"})Class clazz, String trans) throws Exception { this.meth = meth; this.clazz = clazz; @@ -195,7 +198,7 @@ public class EntityProcessorWrapper extends EntityProcessor { Map transformedRow = row; List> rows = null; boolean stopTransform = checkStopTransform(row); - VariableResolver resolver = (VariableResolver) context.getVariableResolver(); + VariableResolver resolver = context.getVariableResolver(); for (Transformer t : transformers) { if (stopTransform) break; try { @@ -207,6 +210,7 @@ public class EntityProcessorWrapper extends EntityProcessor { if (o == null) continue; if (o instanceof Map) { + @SuppressWarnings({"rawtypes"}) Map oMap = (Map) o; stopTransform = checkStopTransform(oMap); tmpRows.add((Map) o); @@ -223,6 +227,7 @@ public class EntityProcessorWrapper extends EntityProcessor { if (o == null) return null; if (o instanceof Map) { + @SuppressWarnings({"rawtypes"}) Map oMap = (Map) o; stopTransform = checkStopTransform(oMap); transformedRow = (Map) o; @@ -251,7 +256,7 @@ public class EntityProcessorWrapper extends EntityProcessor { } - private boolean checkStopTransform(Map oMap) { + private boolean checkStopTransform(@SuppressWarnings({"rawtypes"})Map oMap) { return oMap.get("$stopTransform") != null && Boolean.parseBoolean(oMap.get("$stopTransform").toString()); } @@ -313,7 +318,7 @@ public class EntityProcessorWrapper extends EntityProcessor { } public VariableResolver getVariableResolver() { - return (VariableResolver) context.getVariableResolver(); + return context.getVariableResolver(); } public Context getContext() { @@ -333,11 +338,12 @@ public class EntityProcessorWrapper extends EntityProcessor { return children; } + @SuppressWarnings({"rawtypes"}) public DataSource getDatasource() { return datasource; } - public void setDatasource(DataSource datasource) { + public void setDatasource(@SuppressWarnings({"rawtypes"})DataSource datasource) { this.datasource = datasource; } diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HTMLStripTransformer.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HTMLStripTransformer.java index e62c329283e..7ef4d9362a9 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HTMLStripTransformer.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/HTMLStripTransformer.java @@ -49,6 +49,7 @@ public class HTMLStripTransformer extends Transformer { if (tmpVal instanceof List) { List inputs = (List) tmpVal; + @SuppressWarnings({"rawtypes"}) List results = new ArrayList(); for (String input : inputs) { if (input == null) diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java index 3b81d21eaf2..87f38f49f68 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/JdbcDataSource.java @@ -189,6 +189,7 @@ public class JdbcDataSource extends // the class loader of the class which is trying to make the connection. // This is a workaround for cases where the user puts the driver jar in the // solr.home/lib or solr.home/core/lib directories. + @SuppressWarnings({"unchecked"}) Driver d = (Driver) DocBuilder.loadClass(driver, context.getSolrCore()).getConstructor().newInstance(); c = d.connect(url, initProps); } diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java index 349b14eee30..f693aecce4a 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/NumberFormatTransformer.java @@ -69,6 +69,7 @@ public class NumberFormatTransformer extends Transformer { if (val instanceof List) { List inputs = (List) val; + @SuppressWarnings({"rawtypes"}) List results = new ArrayList(); for (String input : inputs) { try { diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java index c75608c95a9..4b8771af26e 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java @@ -45,6 +45,7 @@ public class PlainTextEntityProcessor extends EntityProcessorBase { @Override public Map nextRow() { if (ended) return null; + @SuppressWarnings({"unchecked"}) DataSource ds = context.getDataSource(); String url = context.replaceTokens(context.getEntityAttribute(URL)); Reader r = null; diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/RegexTransformer.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/RegexTransformer.java index 0765bd67e94..f5934163b00 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/RegexTransformer.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/RegexTransformer.java @@ -43,7 +43,7 @@ public class RegexTransformer extends Transformer { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public Map transformRow(Map row, Context ctx) { List> fields = ctx.getAllEntityFields(); @@ -135,7 +135,7 @@ public class RegexTransformer extends Transformer { return l; } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) private Object readfromRegExp(String reStr, String value, String columnName, String gNames) { String[] groupNames = null; if(gNames != null && gNames.trim().length() >0){ diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/TemplateTransformer.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/TemplateTransformer.java index 3a20028bb48..75a6ff29686 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/TemplateTransformer.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/TemplateTransformer.java @@ -94,6 +94,7 @@ public class TemplateTransformer extends Transformer { return row; } + @SuppressWarnings({"unchecked"}) private void addToRow(String key, Map row, Object value) { Object prevVal = row.get(key); if (prevVal != null) { diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java index 4c70d406b86..03737121791 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathEntityProcessor.java @@ -184,6 +184,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { } } String url = context.getEntityAttribute(URL); + @SuppressWarnings({"unchecked"}) List l = url == null ? Collections.EMPTY_LIST : resolver.getVariables(url); for (String s : l) { if (s.startsWith(entityName + ".")) { @@ -268,7 +269,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { Object val = context.getSessionAttribute(name, Context.SCOPE_ENTITY); if (val != null) namespace.put(name, val); } - ((VariableResolver)context.getVariableResolver()).addNamespace(entityName, namespace); + context.getVariableResolver().addNamespace(entityName, namespace); } private void addCommonFields(Map r) { @@ -284,6 +285,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { } + @SuppressWarnings({"unchecked"}) private void initQuery(String s) { Reader data = null; try { @@ -358,6 +360,7 @@ public class XPathEntityProcessor extends EntityProcessorBase { } } + @SuppressWarnings({"unchecked"}) protected Map readRow(Map record, String xpath) { if (useSolrAddXml) { List names = (List) record.get("name"); @@ -367,9 +370,11 @@ public class XPathEntityProcessor extends EntityProcessorBase { if (row.containsKey(names.get(i))) { Object existing = row.get(names.get(i)); if (existing instanceof List) { + @SuppressWarnings({"rawtypes"}) List list = (List) existing; list.add(values.get(i)); } else { + @SuppressWarnings({"rawtypes"}) List list = new ArrayList(); list.add(existing); list.add(values.get(i)); diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java index 1d546e9bc97..0a4638f8986 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/XPathRecordReader.java @@ -585,6 +585,7 @@ public class XPathRecordReader { * records values. If a fields value is a List then they have to be * deep-copied for thread safety */ + @SuppressWarnings({"unchecked", "rawtypes"}) private static Map getDeepCopy(Map values) { Map result = new HashMap<>(); for (Map.Entry entry : values.entrySet()) { diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java index 9a0f3a772e7..7a7b3ec88ca 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDIHCacheTestCase.java @@ -81,7 +81,7 @@ public class AbstractDIHCacheTestCase { } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public int compareTo(ControlData cd) { Comparable c1 = (Comparable) data[0]; Comparable c2 = (Comparable) cd.data[0]; diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java index 3674a3d58f1..7a31acfda3e 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java @@ -115,6 +115,7 @@ public abstract class AbstractDataImportHandlerTestCase extends * @param extraParams any extra request parameters needed to be passed to DataImportHandler * @throws Exception in case of any error */ + @SuppressWarnings({"unchecked"}) protected void runFullImport(String dataConfig, Map extraParams) throws Exception { HashMap params = new HashMap<>(); params.put("command", "full-import"); @@ -123,6 +124,7 @@ public abstract class AbstractDataImportHandlerTestCase extends params.put("clean", "true"); params.put("commit", "true"); params.putAll(extraParams); + @SuppressWarnings({"rawtypes"}) NamedList l = new NamedList(); for (Map.Entry e : params.entrySet()) { l.add(e.getKey(),e.getValue()); @@ -136,7 +138,7 @@ public abstract class AbstractDataImportHandlerTestCase extends */ @SuppressWarnings("unchecked") public static TestContext getContext(EntityProcessorWrapper parent, - VariableResolver resolver, DataSource parentDataSource, + VariableResolver resolver, @SuppressWarnings({"rawtypes"})DataSource parentDataSource, String currProcess, final List> entityFields, final Map entityAttrs) { if (resolver == null) resolver = new VariableResolver(); @@ -150,7 +152,7 @@ public abstract class AbstractDataImportHandlerTestCase extends * Strings at even index are keys, odd-index strings are values in the * returned map */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"rawtypes"}) public static Map createMap(Object... args) { return Utils.makeMap(args); } @@ -217,6 +219,7 @@ public abstract class AbstractDataImportHandlerTestCase extends } @Override + @SuppressWarnings({"rawtypes"}) public DataSource getDataSource() { return delegate.getDataSource(); } @@ -257,7 +260,7 @@ public abstract class AbstractDataImportHandlerTestCase extends } @Override - public DataSource getDataSource(String name) { + @SuppressWarnings({"rawtypes"})public DataSource getDataSource(String name) { return delegate.getDataSource(name); } diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java index 756821027ed..5a7ea84650a 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/MockInitialContextFactory.java @@ -42,7 +42,7 @@ public class MockInitialContextFactory implements InitialContextFactory { @Override @SuppressWarnings("unchecked") - public javax.naming.Context getInitialContext(Hashtable env) { + public javax.naming.Context getInitialContext(@SuppressWarnings({"rawtypes"})Hashtable env) { return context; } diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java index fe00d491d04..26478dedba7 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestClobTransformer.java @@ -32,6 +32,7 @@ import java.util.*; * @see org.apache.solr.handler.dataimport.ClobTransformer * @since solr 1.4 */ +@SuppressWarnings({"unchecked"}) public class TestClobTransformer extends AbstractDataImportHandlerTestCase { @Test public void simple() throws Exception { @@ -45,6 +46,7 @@ public class TestClobTransformer extends AbstractDataImportHandlerTestCase { Context ctx = getContext(null, new VariableResolver(), null, Context.FULL_DUMP, flds, Collections.EMPTY_MAP); Transformer t = new ClobTransformer(); Map row = new HashMap<>(); + @SuppressWarnings({"rawtypes"}) Clob clob = (Clob) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[]{Clob.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDataConfig.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDataConfig.java index 7a56fd2f36e..c5028931c73 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDataConfig.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDataConfig.java @@ -44,6 +44,7 @@ public class TestDataConfig extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testDataConfigWithDataSource() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); MockDataSource.setIterator("select * from x", rows.iterator()); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java index 7f7278e7d0b..6ee2432d085 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder.java @@ -52,6 +52,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void singleEntityNoRows() { DataImporter di = new DataImporter(); di.loadAndInit(dc_singleEntity); @@ -71,6 +72,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void testDeltaImportNoRows_MustNotCommit() { DataImporter di = new DataImporter(); di.loadAndInit(dc_deltaConfig); @@ -93,6 +95,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void singleEntityOneRow() { DataImporter di = new DataImporter(); di.loadAndInit(dc_singleEntity); @@ -122,6 +125,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void testImportCommand() { DataImporter di = new DataImporter(); di.loadAndInit(dc_singleEntity); @@ -142,7 +146,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { assertEquals(1, di.getDocBuilder().importStatistics.rowsCount.get()); for (int i = 0; i < l.size(); i++) { - Map map = (Map) l.get(i); + Map map = l.get(i); SolrInputDocument doc = swi.docs.get(i); for (Map.Entry entry : map.entrySet()) { assertEquals(entry.getValue(), doc.getFieldValue(entry.getKey())); @@ -151,6 +155,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void singleEntityMultipleRows() { DataImporter di = new DataImporter(); di.loadAndInit(dc_singleEntity); @@ -170,7 +175,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { assertEquals(Boolean.TRUE, swi.finishCalled); assertEquals(3, swi.docs.size()); for (int i = 0; i < l.size(); i++) { - Map map = (Map) l.get(i); + Map map = l.get(i); SolrInputDocument doc = swi.docs.get(i); for (Map.Entry entry : map.entrySet()) { assertEquals(entry.getValue(), doc.getFieldValue(entry.getKey())); @@ -183,6 +188,7 @@ public class TestDocBuilder extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void templateXPath() { DataImporter di = new DataImporter(); di.loadAndInit(dc_variableXpath); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java index 27865cd5e34..2941f589617 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java @@ -46,6 +46,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testSingleEntity() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -62,6 +63,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testSingleEntity_CaseInsensitive() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desC", "one")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -76,7 +78,9 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void testErrorHandler() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "FORCE_ERROR", "true")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -90,6 +94,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testDynamicFields() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -103,6 +108,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testRequestParamsAsVariable() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "101", "desc", "ApacheSolr")); MockDataSource.setIterator("select * from books where category='search'", rows.iterator()); @@ -118,6 +124,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testDynamicFieldNames() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("mypk", "101", "text", "ApacheSolr")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -132,6 +139,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testRequestParamsAsFieldName() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("mypk", "101", "text", "ApacheSolr")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -147,6 +155,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testContext() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); MockDataSource.setIterator("select * from x", rows.iterator()); @@ -157,6 +166,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testSkipDoc() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); rows.add(createMap("id", "2", "desc", "two", DocBuilder.SKIP_DOC, "true")); @@ -169,7 +179,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public void testSkipRow() throws Exception { List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); @@ -206,6 +216,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testStopTransform() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); rows.add(createMap("id", "2", "desc", "two", "$stopTransform", "true")); @@ -219,7 +230,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public void testDeleteDocs() throws Exception { List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); @@ -269,6 +280,7 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { public void testFileListEntityProcessor_lastIndexTime() throws Exception { File tmpdir = createTempDir().toFile(); + @SuppressWarnings({"unchecked"}) Map params = createMap("baseDir", tmpdir.getAbsolutePath()); createFile(tmpdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), true); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java index ddccafeaa3e..b5b3c337425 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestEphemeralCache.java @@ -46,6 +46,7 @@ public class TestEphemeralCache extends AbstractDataImportHandlerTestCase { @SuppressWarnings("unchecked") private void setupMockData() { + @SuppressWarnings({"rawtypes"}) List parentRows = new ArrayList(); parentRows.add(createMap("id", new BigDecimal("1"), "parent_s", "one")); parentRows.add(createMap("id", new BigDecimal("2"), "parent_s", "two")); @@ -53,6 +54,7 @@ public class TestEphemeralCache extends AbstractDataImportHandlerTestCase { parentRows.add(createMap("id", new BigDecimal("4"), "parent_s", "four")); parentRows.add(createMap("id", new BigDecimal("5"), "parent_s", "five")); + @SuppressWarnings({"rawtypes"}) List child1Rows = new ArrayList(); child1Rows.add(createMap("id", new BigDecimal("6"), "child1a_mult_s", "this is the number six.")); child1Rows.add(createMap("id", new BigDecimal("5"), "child1a_mult_s", "this is the number five.")); @@ -65,6 +67,7 @@ public class TestEphemeralCache extends AbstractDataImportHandlerTestCase { child1Rows.add(createMap("id", new BigDecimal("1"), "child1a_mult_s", "uno")); child1Rows.add(createMap("id", new BigDecimal("2"), "child1b_s", "CHILD1B", "child1a_mult_s", "this is the number two.")); + @SuppressWarnings({"rawtypes"}) List child2Rows = new ArrayList(); child2Rows.add(createMap("id", new BigDecimal("6"), "child2a_mult_s", "Child 2 says, 'this is the number six.'")); child2Rows.add(createMap("id", new BigDecimal("5"), "child2a_mult_s", "Child 2 says, 'this is the number five.'")); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestErrorHandling.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestErrorHandling.java index 1ea1ad483a1..2391ae8a314 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestErrorHandling.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestErrorHandling.java @@ -80,6 +80,7 @@ public class TestErrorHandling extends AbstractDataImportHandlerTestCase { assertQ(req("*:*"), "//*[@numFound='0']"); } + @SuppressWarnings({"unchecked"}) public void testTransformerErrorContinue() throws Exception { StringDataSource.xml = wellformedXml; List> rows = new ArrayList<>(); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFieldReader.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFieldReader.java index 347a40bf1ab..3203bdab119 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFieldReader.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFieldReader.java @@ -32,6 +32,7 @@ import java.util.Map; public class TestFieldReader extends AbstractDataImportHandlerTestCase { @Test + @SuppressWarnings({"unchecked"}) public void simple() { DataImporter di = new DataImporter(); di.loadAndInit(config); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFileListEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFileListEntityProcessor.java index dd2cf72f642..c4b4ab0003c 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFileListEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestFileListEntityProcessor.java @@ -50,6 +50,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa createFile(tmpdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), false); createFile(tmpdir, "b.xml", "b.xml".getBytes(StandardCharsets.UTF_8), false); createFile(tmpdir, "c.props", "c.props".getBytes(StandardCharsets.UTF_8), false); + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( FileListEntityProcessor.FILE_NAME, "xml$", FileListEntityProcessor.BASE_DIR, tmpdir.getAbsolutePath()); @@ -68,6 +69,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa } @Test + @SuppressWarnings({"unchecked"}) public void testBiggerSmallerFiles() throws IOException { File tmpdir = createTempDir().toFile(); @@ -91,6 +93,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa minLength = content.length; smallestFile = "c.props"; } + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( FileListEntityProcessor.FILE_NAME, ".*", FileListEntityProcessor.BASE_DIR, tmpdir.getAbsolutePath(), @@ -120,7 +123,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa } @SuppressWarnings("unchecked") - static List getFiles(VariableResolver resolver, Map attrs) { + static List getFiles(VariableResolver resolver, @SuppressWarnings({"rawtypes"})Map attrs) { Context c = getContext(null, resolver, null, Context.FULL_DUMP, Collections.EMPTY_LIST, attrs); FileListEntityProcessor fileListEntityProcessor = new FileListEntityProcessor(); @@ -137,12 +140,14 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa @SuppressForbidden(reason = "Needs currentTimeMillis to set last modified time") @Test + @SuppressWarnings({"unchecked"}) public void testNTOT() throws IOException { File tmpdir = createTempDir().toFile(); createFile(tmpdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), true); createFile(tmpdir, "b.xml", "b.xml".getBytes(StandardCharsets.UTF_8), true); createFile(tmpdir, "c.props", "c.props".getBytes(StandardCharsets.UTF_8), true); + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( FileListEntityProcessor.FILE_NAME, "xml$", FileListEntityProcessor.BASE_DIR, tmpdir.getAbsolutePath(), @@ -178,6 +183,7 @@ public class TestFileListEntityProcessor extends AbstractDataImportHandlerTestCa createFile(childdir, "a.xml", "a.xml".getBytes(StandardCharsets.UTF_8), true); createFile(childdir, "b.xml", "b.xml".getBytes(StandardCharsets.UTF_8), true); createFile(childdir, "c.props", "c.props".getBytes(StandardCharsets.UTF_8), true); + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( FileListEntityProcessor.FILE_NAME, "^.*\\.xml$", FileListEntityProcessor.BASE_DIR, childdir.getAbsolutePath(), diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestJdbcDataSourceConvertType.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestJdbcDataSourceConvertType.java index 94f437c3709..ef1cc7b5b2c 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestJdbcDataSourceConvertType.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestJdbcDataSourceConvertType.java @@ -48,7 +48,7 @@ public class TestJdbcDataSourceConvertType extends AbstractDataImportHandlerTest convertTypeTest("true", Long.class); } - private void convertTypeTest(String convertType, Class resultClass) throws Throwable { + private void convertTypeTest(String convertType, @SuppressWarnings({"rawtypes"})Class resultClass) throws Throwable { JdbcDataSource dataSource = new JdbcDataSource(); Properties p = new Properties(); p.put("driver", "org.apache.derby.jdbc.EmbeddedDriver"); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java index eb9989c181a..492e18a07f2 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestLineEntityProcessor.java @@ -42,12 +42,14 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase { * /> */ + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( LineEntityProcessor.URL, "dummy.lis", LineEntityProcessor.ACCEPT_LINE_REGEX, null, LineEntityProcessor.SKIP_LINE_REGEX, null ); + @SuppressWarnings({"unchecked"}) Context c = getContext( null, //parentEntity new VariableResolver(), //resolver @@ -82,12 +84,14 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase { * acceptLineRegex="xml" * /> */ + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( LineEntityProcessor.URL, "dummy.lis", LineEntityProcessor.ACCEPT_LINE_REGEX, "xml", LineEntityProcessor.SKIP_LINE_REGEX, null ); + @SuppressWarnings({"unchecked"}) Context c = getContext( null, //parentEntity new VariableResolver(), //resolver @@ -120,12 +124,14 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase { * omitLineRegex="\\.xsd" * /> */ + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( LineEntityProcessor.URL, "dummy.lis", LineEntityProcessor.ACCEPT_LINE_REGEX, "\\.xml", LineEntityProcessor.SKIP_LINE_REGEX, "\\.xsd" ); + @SuppressWarnings({"unchecked"}) Context c = getContext( null, //parentEntity new VariableResolver(), //resolver @@ -157,11 +163,13 @@ public class TestLineEntityProcessor extends AbstractDataImportHandlerTestCase { * omitLineRegex="\\.xsd" * /> */ + @SuppressWarnings({"rawtypes"}) Map attrs = createMap( LineEntityProcessor.URL, "dummy.lis", LineEntityProcessor.SKIP_LINE_REGEX, "\\.xsd" ); + @SuppressWarnings({"unchecked"}) Context c = getContext( null, //parentEntity new VariableResolver(), //resolver diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java index 23854382dde..007e63fa248 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestPlainTextEntityProcessor.java @@ -46,6 +46,7 @@ public class TestPlainTextEntityProcessor extends AbstractDataImportHandlerTestC redirectTempProperties(di); TestDocBuilder.SolrWriterImpl sw = new TestDocBuilder.SolrWriterImpl(); + @SuppressWarnings({"unchecked"}) RequestInfo rp = new RequestInfo(null, createMap("command", "full-import"), null); di.runCmd(rp, sw); assertEquals(DS.s, sw.docs.get(0).getFieldValue("x")); @@ -142,12 +143,14 @@ public class TestPlainTextEntityProcessor extends AbstractDataImportHandlerTestC redirectTempProperties(di); TestDocBuilder.SolrWriterImpl sw = new TestDocBuilder.SolrWriterImpl(); + @SuppressWarnings({"unchecked"}) RequestInfo rp = new RequestInfo(null, createMap("command", "full-import"), null); di.runCmd(rp, sw); assertEquals(DS.s, sw.docs.get(0).getFieldValue("plainText")); } + @SuppressWarnings({"rawtypes"}) public static class DS extends DataSource { static String s = "hello world"; diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestRegexTransformer.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestRegexTransformer.java index e792804634f..9af9b290bfa 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestRegexTransformer.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestRegexTransformer.java @@ -69,12 +69,15 @@ public class TestRegexTransformer extends AbstractDataImportHandlerTestCase { assertEquals("Noble", result.get("firstName")); assertEquals("Paul", result.get("lastName")); src= new HashMap<>(); + @SuppressWarnings({"unchecked", "rawtypes"}) List l= new ArrayList(); l.add("Mr Noble Paul") ; l.add("Mr Shalin Mangar") ; src.put("fullName", l); result = new RegexTransformer().transformRow(src, context); + @SuppressWarnings({"rawtypes"}) List l1 = (List) result.get("firstName"); + @SuppressWarnings({"rawtypes"}) List l2 = (List) result.get("lastName"); assertEquals("Noble", l1.get(0)); assertEquals("Shalin", l1.get(1)); @@ -150,6 +153,7 @@ public class TestRegexTransformer extends AbstractDataImportHandlerTestCase { VariableResolver resolver = new VariableResolver(); resolver.addNamespace("e", row); + @SuppressWarnings({"unchecked"}) Map eAttrs = createMap("name", "e"); Context context = getContext(null, resolver, null, Context.FULL_DUMP, fields, eAttrs); @@ -175,6 +179,7 @@ public class TestRegexTransformer extends AbstractDataImportHandlerTestCase { ArrayList strings = new ArrayList<>(); strings.add("hello"); strings.add("world"); + @SuppressWarnings({"unchecked"}) Map result = new RegexTransformer().transformRow(createMap("person", strings), context); assertEquals(strings,result.get("participant")); } diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestScriptTransformer.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestScriptTransformer.java index 9cd606dca0b..2000231d26c 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestScriptTransformer.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestScriptTransformer.java @@ -128,6 +128,7 @@ public class TestScriptTransformer extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void testCheckScript() throws Exception { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance() @@ -137,13 +138,14 @@ public class TestScriptTransformer extends AbstractDataImportHandlerTestCase { DIHConfiguration dc = di.readFromXml(document); Context c = getContext("checkNextToken", dc.getScript().getText()); + @SuppressWarnings({"rawtypes"}) Map map = new HashMap(); map.put("nextToken", "hello"); EntityProcessorWrapper sep = new EntityProcessorWrapper(new SqlEntityProcessor(), null, null); sep.init(c); sep.applyTransformer(map); assertEquals("true", map.get("$hasMore")); - map = new HashMap(); + map = new HashMap<>(); map.put("nextToken", ""); sep.applyTransformer(map); assertNull(map.get("$hasMore")); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java index a2a9fffa9ab..1753b81de04 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestSolrEntityProcessorUnit.java @@ -87,7 +87,7 @@ public class TestSolrEntityProcessorUnit extends AbstractDataImportHandlerTestCa Map next = processor.nextRow(); assertNotNull(next); - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) List multiField = (List) next.get("description"); assertEquals(testDoc.getValues("description").size(), multiField.size()); assertEquals(testDoc.getValues("description"), multiField); @@ -161,6 +161,7 @@ public class TestSolrEntityProcessorUnit extends AbstractDataImportHandlerTestCa types.add(new FldType(ID, ONE_ONE, new SVal('A', 'Z', 4, 40))); types.add(new FldType("description", new IRange(1, 3), new SVal('a', 'c', 1, 1))); + @SuppressWarnings({"rawtypes"}) Set previousIds = new HashSet<>(); List docs = new ArrayList<>(numDocs); for (int i = 0; i < numDocs; i++) { diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestTemplateTransformer.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestTemplateTransformer.java index b5c38117ac3..11ea30be4f3 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestTemplateTransformer.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestTemplateTransformer.java @@ -36,6 +36,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testTransformRow() { + @SuppressWarnings({"rawtypes"}) List fields = new ArrayList(); fields.add(createMap("column", "firstName")); fields.add(createMap("column", "lastName")); @@ -52,6 +53,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase { TemplateTransformer.TEMPLATE,"Mr ${e.name}")); List mails = Arrays.asList("a@b.com", "c@d.com"); + @SuppressWarnings({"rawtypes"}) Map row = createMap( "firstName", "Shalin", "middleName", "Shekhar", @@ -73,6 +75,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testTransformRowMultiValue() { + @SuppressWarnings({"rawtypes"}) List fields = new ArrayList(); fields.add(createMap("column", "year")); fields.add(createMap("column", "month")); @@ -89,6 +92,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase { TemplateTransformer.TEMPLATE, "${e.year}-${e.month}-${e.day}" )); + @SuppressWarnings({"rawtypes"}) Map row = createMap( "year", "2016", "month", "Apr", "day", "30" ); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java index 00285649fe6..ef88fffb7d4 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolver.java @@ -146,6 +146,7 @@ public class TestVariableResolver extends AbstractDataImportHandlerTestCase { m.put("class", E.class.getName()); l.add(m); resolver.setEvaluators(new DataImporter().getEvaluators(l)); + @SuppressWarnings({"unchecked"}) ContextImpl context = new ContextImpl(null, resolver, null, Context.FULL_DUMP, Collections.EMPTY_MAP, null, null); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestWriterImpl.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestWriterImpl.java index e5c2a949f25..24eb28bcd3a 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestWriterImpl.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestWriterImpl.java @@ -43,6 +43,7 @@ public class TestWriterImpl extends AbstractDataImportHandlerTestCase { @Test @SuppressWarnings("unchecked") public void testDataConfigWithDataSource() throws Exception { + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "desc", "one")); rows.add(createMap("id", "2", "desc", "two")); @@ -51,6 +52,7 @@ public class TestWriterImpl extends AbstractDataImportHandlerTestCase { MockDataSource.setIterator("select * from x", rows.iterator()); + @SuppressWarnings({"rawtypes"}) Map extraParams = createMap("writerImpl", TestSolrWriter.class.getName(), "commit", "true"); runFullImport(loadDataConfig("data-config-with-datasource.xml"), diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java index 72da77a60ba..e2200eab783 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java @@ -42,12 +42,15 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase int rowsToRead = -1; @Test + @SuppressWarnings({"unchecked"}) public void withFieldsAndXpath() throws Exception { File tmpdir = createTempDir().toFile(); createFile(tmpdir, "x.xsl", xsl.getBytes(StandardCharsets.UTF_8), false); + @SuppressWarnings({"rawtypes"}) Map entityAttrs = createMap("name", "e", "url", "cd.xml", XPathEntityProcessor.FOR_EACH, "/catalog/cd"); + @SuppressWarnings({"rawtypes"}) List fields = new ArrayList(); fields.add(createMap("column", "title", "xpath", "/catalog/cd/title")); fields.add(createMap("column", "artist", "xpath", "/catalog/cd/artist")); @@ -70,9 +73,12 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase } @Test + @SuppressWarnings({"unchecked"}) public void testMultiValued() throws Exception { + @SuppressWarnings({"rawtypes"}) Map entityAttrs = createMap("name", "e", "url", "testdata.xml", XPathEntityProcessor.FOR_EACH, "/root"); + @SuppressWarnings({"rawtypes"}) List fields = new ArrayList(); fields.add(createMap("column", "a", "xpath", "/root/a", DataImporter.MULTI_VALUED, "true")); Context c = getContext(null, @@ -86,6 +92,7 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase break; result.add(row); } + @SuppressWarnings({"rawtypes"}) List l = (List)result.get(0).get("a"); assertEquals(3, l.size()); assertEquals("1", l.get(0)); @@ -216,9 +223,12 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase } @Test + @SuppressWarnings({"unchecked"}) public void testMultiValuedFlatten() throws Exception { + @SuppressWarnings({"rawtypes"}) Map entityAttrs = createMap("name", "e", "url", "testdata.xml", XPathEntityProcessor.FOR_EACH, "/root"); + @SuppressWarnings({"rawtypes"}) List fields = new ArrayList(); fields.add(createMap("column", "a", "xpath", "/root/a" ,"flatten","true")); Context c = getContext(null, @@ -236,12 +246,15 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase } @Test + @SuppressWarnings({"unchecked"}) public void withFieldsAndXpathStream() throws Exception { final Object monitor = new Object(); final boolean[] done = new boolean[1]; + @SuppressWarnings({"rawtypes"}) Map entityAttrs = createMap("name", "e", "url", "cd.xml", XPathEntityProcessor.FOR_EACH, "/catalog/cd", "stream", "true", "batchSize","1"); + @SuppressWarnings({"rawtypes"}) List fields = new ArrayList(); fields.add(createMap("column", "title", "xpath", "/catalog/cd/title")); fields.add(createMap("column", "artist", "xpath", "/catalog/cd/artist")); @@ -331,11 +344,13 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase } @Test + @SuppressWarnings({"unchecked"}) public void withDefaultSolrAndXsl() throws Exception { File tmpdir = createTempDir().toFile(); AbstractDataImportHandlerTestCase.createFile(tmpdir, "x.xsl", xsl.getBytes(StandardCharsets.UTF_8), false); + @SuppressWarnings({"rawtypes"}) Map entityAttrs = createMap("name", "e", XPathEntityProcessor.USE_SOLR_ADD_SCHEMA, "true", "xsl", "" + new File(tmpdir, "x.xsl").toURI(), "url", "cd.xml"); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java index 2b0757a4ac9..fe8c6571830 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestXPathRecordReader.java @@ -510,6 +510,7 @@ public class TestXPathRecordReader extends AbstractDataImportHandlerTestCase { } @Test + @SuppressWarnings({"unchecked"}) public void testPutNullTest(){ String xml = "\n" + " \n" + diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java index 9279d282753..a67e8eedc38 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestZKPropertiesWriter.java @@ -95,6 +95,7 @@ public class TestZKPropertiesWriter extends AbstractDataImportHandlerTestCase { @SuppressForbidden(reason = "Needs currentTimeMillis to construct date stamps") @Test + @SuppressWarnings({"unchecked"}) public void testZKPropertiesWriter() throws Exception { // test using ZooKeeper assertTrue("Not using ZooKeeper", h.getCoreContainer().isZooKeeperAware()); @@ -121,6 +122,7 @@ public class TestZKPropertiesWriter extends AbstractDataImportHandlerTestCase { props.put("last_index_time", oneSecondAgo); spw.persist(props); + @SuppressWarnings({"rawtypes"}) List rows = new ArrayList(); rows.add(createMap("id", "1", "year_s", "2013")); MockDataSource.setIterator("select " + df.format(oneSecondAgo) + " from dummy", rows.iterator());