fixed compiler warnining and removed unused imports

This commit is contained in:
Martijn van Groningen 2016-07-29 15:06:49 +02:00
parent 81112508ea
commit 7b36a72ccb
2 changed files with 7 additions and 12 deletions

View File

@ -23,18 +23,13 @@ import org.elasticsearch.ingest.AbstractProcessor;
import org.elasticsearch.ingest.ConfigurationUtils;
import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.Processor;
import org.elasticsearch.ingest.Processor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.elasticsearch.ingest.ConfigurationUtils.newConfigurationException;
import static org.elasticsearch.ingest.ConfigurationUtils.readList;
import static org.elasticsearch.ingest.ConfigurationUtils.readMap;
import static org.elasticsearch.ingest.ConfigurationUtils.readStringProperty;
@ -59,7 +54,7 @@ public final class ForEachProcessor extends AbstractProcessor {
@Override
public void execute(IngestDocument ingestDocument) throws Exception {
List<Object> values = ingestDocument.getFieldValue(field, List.class);
List values = ingestDocument.getFieldValue(field, List.class);
List<Object> newValues = new ArrayList<>(values.size());
for (Object value : values) {
Object previousValue = ingestDocument.getIngestMetadata().put("_value", value);

View File

@ -53,7 +53,7 @@ public class ForEachProcessorTests extends ESTestCase {
);
processor.execute(ingestDocument);
List<String> result = ingestDocument.getFieldValue("values", List.class);
List result = ingestDocument.getFieldValue("values", List.class);
assertThat(result.get(0), equalTo("FOO"));
assertThat(result.get(1), equalTo("BAR"));
assertThat(result.get(2), equalTo("BAZ"));
@ -176,9 +176,9 @@ public class ForEachProcessorTests extends ESTestCase {
ForEachProcessor processor = new ForEachProcessor("_tag", "values", innerProcessor);
processor.execute(ingestDocument);
@SuppressWarnings("unchecked")
List<String> result = ingestDocument.getFieldValue("values", List.class);
assertThat(result.size(), equalTo(numValues));
for (String r : result) {
assertThat(r, equalTo("."));
}
@ -203,12 +203,12 @@ public class ForEachProcessorTests extends ESTestCase {
));
processor.execute(ingestDocument);
List<Object> result = ingestDocument.getFieldValue("values", List.class);
List result = ingestDocument.getFieldValue("values", List.class);
assertThat(result.get(0), equalTo("STRING"));
assertThat(result.get(1), equalTo(1));
assertThat(result.get(2), equalTo(null));
List<String> errors = ingestDocument.getFieldValue("errors", List.class);
List errors = ingestDocument.getFieldValue("errors", List.class);
assertThat(errors.size(), equalTo(2));
}
@ -229,7 +229,7 @@ public class ForEachProcessorTests extends ESTestCase {
ForEachProcessor forEachProcessor = new ForEachProcessor("_tag", "values", processor);
forEachProcessor.execute(ingestDocument);
List<String> result = ingestDocument.getFieldValue("values", List.class);
List result = ingestDocument.getFieldValue("values", List.class);
assertThat(result.get(0), equalTo("new_value"));
assertThat(result.get(1), equalTo("new_value"));
assertThat(result.get(2), equalTo("new_value"));
@ -262,7 +262,7 @@ public class ForEachProcessorTests extends ESTestCase {
"_tag", "values1", new ForEachProcessor("_tag", "_ingest._value.values2", testProcessor));
processor.execute(ingestDocument);
List<String> result = ingestDocument.getFieldValue("values1.0.values2", List.class);
List result = ingestDocument.getFieldValue("values1.0.values2", List.class);
assertThat(result.get(0), equalTo("ABC"));
assertThat(result.get(1), equalTo("DEF"));