code formatting
This commit is contained in:
parent
eadfd8d71d
commit
a02f3f0d2b
|
@ -70,7 +70,8 @@ public class XMLIterator implements Iterator<String> {
|
||||||
super();
|
super();
|
||||||
this.element = element;
|
this.element = element;
|
||||||
if (element.contains(",")) {
|
if (element.contains(",")) {
|
||||||
elements= Arrays.stream(element.split(","))
|
elements = Arrays
|
||||||
|
.stream(element.split(","))
|
||||||
.filter(StringUtils::isNoneBlank)
|
.filter(StringUtils::isNoneBlank)
|
||||||
.map(String::toLowerCase)
|
.map(String::toLowerCase)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -155,15 +156,15 @@ public class XMLIterator implements Iterator<String> {
|
||||||
XMLEvent peek = parser.peek();
|
XMLEvent peek = parser.peek();
|
||||||
if (peek != null && peek.isStartElement()) {
|
if (peek != null && peek.isStartElement()) {
|
||||||
String name = peek.asStartElement().getName().getLocalPart();
|
String name = peek.asStartElement().getName().getLocalPart();
|
||||||
if( isCheckTag(name))
|
if (isCheckTag(name))
|
||||||
return peek;
|
return peek;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (parser.hasNext()) {
|
while (parser.hasNext()) {
|
||||||
XMLEvent event= parser.nextEvent();
|
XMLEvent event = parser.nextEvent();
|
||||||
if (event != null && event.isStartElement()) {
|
if (event != null && event.isStartElement()) {
|
||||||
String name = event.asStartElement().getName().getLocalPart();
|
String name = event.asStartElement().getName().getLocalPart();
|
||||||
if( isCheckTag(name))
|
if (isCheckTag(name))
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,12 +182,13 @@ public class XMLIterator implements Iterator<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCheckTag(final String tagName) {
|
private boolean isCheckTag(final String tagName) {
|
||||||
if (elements!= null) {
|
if (elements != null) {
|
||||||
final String found =elements.stream()
|
final String found = elements
|
||||||
|
.stream()
|
||||||
.filter(e -> e.equalsIgnoreCase(tagName))
|
.filter(e -> e.equalsIgnoreCase(tagName))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (found!= null)
|
if (found != null)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (element.equalsIgnoreCase(tagName)) {
|
if (element.equalsIgnoreCase(tagName)) {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.collection.plugin.file;
|
package eu.dnetlib.dhp.collection.plugin.file;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.collection.ApiDescriptor;
|
|
||||||
import eu.dnetlib.dhp.common.aggregation.AggregatorReport;
|
|
||||||
import eu.dnetlib.dhp.common.collection.CollectorException;
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
@ -12,10 +14,9 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import eu.dnetlib.dhp.collection.ApiDescriptor;
|
||||||
import java.util.HashMap;
|
import eu.dnetlib.dhp.common.aggregation.AggregatorReport;
|
||||||
import java.util.Objects;
|
import eu.dnetlib.dhp.common.collection.CollectorException;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
|
Loading…
Reference in New Issue