forked from antonis.lempesis/dnet-hadoop
cleanup
This commit is contained in:
parent
77ac995770
commit
439c6255a2
|
@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test;
|
|||
/** @author mhorst, claudio.atzori */
|
||||
public class GenerateOoziePropertiesMojoTest {
|
||||
|
||||
private GenerateOoziePropertiesMojo mojo = new GenerateOoziePropertiesMojo();
|
||||
private final GenerateOoziePropertiesMojo mojo = new GenerateOoziePropertiesMojo();
|
||||
|
||||
@BeforeEach
|
||||
public void clearSystemProperties() {
|
||||
|
|
|
@ -366,7 +366,7 @@ public class WritePredefinedProjectPropertiesTest {
|
|||
}
|
||||
|
||||
private Properties getStoredProperties(File testFolder)
|
||||
throws FileNotFoundException, IOException {
|
||||
throws IOException {
|
||||
Properties properties = new Properties();
|
||||
properties.load(new FileInputStream(getPropertiesFileLocation(testFolder)));
|
||||
return properties;
|
||||
|
|
|
@ -21,7 +21,7 @@ public class DHPUtils {
|
|||
public static String md5(final String s) {
|
||||
try {
|
||||
final MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(s.getBytes("UTF-8"));
|
||||
md.update(s.getBytes(StandardCharsets.UTF_8));
|
||||
return new String(Hex.encodeHex(md.digest()));
|
||||
} catch (final Exception e) {
|
||||
System.err.println("Error creating id");
|
||||
|
|
|
@ -17,7 +17,7 @@ public class NormalizeDate extends AbstractExtensionFunction {
|
|||
"yyyy-MM-dd'T'hh:mm:ss", "yyyy-MM-dd", "yyyy/MM/dd", "yyyy"
|
||||
};
|
||||
|
||||
private static final String normalizeOutFormat = new String("yyyy-MM-dd'T'hh:mm:ss'Z'");
|
||||
private static final String normalizeOutFormat = "yyyy-MM-dd'T'hh:mm:ss'Z'";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
|
@ -21,7 +21,7 @@ public class MessageManager {
|
|||
|
||||
private Connection connection;
|
||||
|
||||
private Map<String, Channel> channels = new HashMap<>();
|
||||
private final Map<String, Channel> channels = new HashMap<>();
|
||||
|
||||
private boolean durable;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public class AtomicActionDeserializer extends JsonDeserializer {
|
|||
|
||||
@Override
|
||||
public Object deserialize(JsonParser jp, DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
throws IOException {
|
||||
JsonNode node = jp.getCodec().readTree(jp);
|
||||
String classTag = node.get("clazz").asText();
|
||||
JsonNode payload = node.get("payload");
|
||||
|
|
|
@ -13,7 +13,7 @@ import eu.dnetlib.dhp.schema.oaf.*;
|
|||
public class ModelSupport {
|
||||
|
||||
/** Defines the mapping between the actual entity type and the main entity type */
|
||||
private static Map<EntityType, MainEntityType> entityMapping = Maps.newHashMap();
|
||||
private static final Map<EntityType, MainEntityType> entityMapping = Maps.newHashMap();
|
||||
|
||||
static {
|
||||
entityMapping.put(EntityType.publication, MainEntityType.result);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ISClient implements Serializable {
|
|||
|
||||
private static final String INPUT_ACTION_SET_ID_SEPARATOR = ",";
|
||||
|
||||
private ISLookUpService isLookup;
|
||||
private final ISLookUpService isLookup;
|
||||
|
||||
public ISClient(String isLookupUrl) {
|
||||
isLookup = ISLookupClientFactory.getLookUpService(isLookupUrl);
|
||||
|
|
|
@ -123,10 +123,10 @@ public class PromoteActionPayloadFunctions {
|
|||
* @param <G> Type of graph table row
|
||||
*/
|
||||
public static class TableAggregator<G extends Oaf> extends Aggregator<G, G, G> {
|
||||
private SerializableSupplier<G> zeroFn;
|
||||
private SerializableSupplier<BiFunction<G, G, G>> mergeAndGetFn;
|
||||
private SerializableSupplier<Function<G, Boolean>> isNotZeroFn;
|
||||
private Class<G> rowClazz;
|
||||
private final SerializableSupplier<G> zeroFn;
|
||||
private final SerializableSupplier<BiFunction<G, G, G>> mergeAndGetFn;
|
||||
private final SerializableSupplier<Function<G, Boolean>> isNotZeroFn;
|
||||
private final Class<G> rowClazz;
|
||||
|
||||
public TableAggregator(
|
||||
SerializableSupplier<G> zeroFn,
|
||||
|
|
|
@ -20,7 +20,7 @@ public class DnetCollectorWorkerApplication {
|
|||
|
||||
private static final Logger log = LoggerFactory.getLogger(DnetCollectorWorkerApplication.class);
|
||||
|
||||
private static CollectorPluginFactory collectorPluginFactory = new CollectorPluginFactory();
|
||||
private static final CollectorPluginFactory collectorPluginFactory = new CollectorPluginFactory();
|
||||
|
||||
private static ArgumentApplicationParser argumentParser;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ public class CollectorPluginErrorLogList extends LinkedList<String> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
String log = new String();
|
||||
String log = "";
|
||||
int index = 0;
|
||||
for (final String errorMessage : this) {
|
||||
log += String.format("Retry #%s: %s / ", index++, errorMessage);
|
||||
|
|
|
@ -11,22 +11,22 @@ import java.util.regex.Pattern;
|
|||
public class XmlCleaner {
|
||||
|
||||
/** Pattern for numeric entities. */
|
||||
private static Pattern validCharacterEntityPattern = Pattern.compile("^&#x?\\d{2,4};"); // $NON-NLS-1$
|
||||
private static final Pattern validCharacterEntityPattern = Pattern.compile("^&#x?\\d{2,4};"); // $NON-NLS-1$
|
||||
// private static Pattern validCharacterEntityPattern = Pattern.compile("^&#?\\d{2,4};");
|
||||
// //$NON-NLS-1$
|
||||
|
||||
// see https://www.w3.org/TR/REC-xml/#charsets , not only limited to 
|
||||
private static Pattern invalidControlCharPattern = Pattern.compile("&#x?1[0-9a-fA-F];");
|
||||
private static final Pattern invalidControlCharPattern = Pattern.compile("&#x?1[0-9a-fA-F];");
|
||||
|
||||
/**
|
||||
* Pattern that negates the allowable XML 4 byte unicode characters. Valid are: #x9 | #xA | #xD | [#x20-#xD7FF] |
|
||||
* [#xE000-#xFFFD] | [#x10000-#x10FFFF]
|
||||
*/
|
||||
private static Pattern invalidCharacterPattern = Pattern.compile("[^\t\r\n\u0020-\uD7FF\uE000-\uFFFD]"); // $NON-NLS-1$
|
||||
private static final Pattern invalidCharacterPattern = Pattern.compile("[^\t\r\n\u0020-\uD7FF\uE000-\uFFFD]"); // $NON-NLS-1$
|
||||
|
||||
// Map entities to their unicode equivalent
|
||||
private static Set<String> goodEntities = new HashSet<>();
|
||||
private static Map<String, String> badEntities = new HashMap<>();
|
||||
private static final Set<String> goodEntities = new HashSet<>();
|
||||
private static final Map<String, String> badEntities = new HashMap<>();
|
||||
|
||||
static {
|
||||
// pre-defined XML entities
|
||||
|
|
|
@ -21,8 +21,8 @@ import eu.dnetlib.message.MessageManager;
|
|||
|
||||
public class DnetCollectorWorkerApplicationTests {
|
||||
|
||||
private ArgumentApplicationParser argumentParser = mock(ArgumentApplicationParser.class);
|
||||
private MessageManager messageManager = mock(MessageManager.class);
|
||||
private final ArgumentApplicationParser argumentParser = mock(ArgumentApplicationParser.class);
|
||||
private final MessageManager messageManager = mock(MessageManager.class);
|
||||
|
||||
private DnetCollectorWorker worker;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package eu.dnetlib.dhp.oa.dedup;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.Normalizer;
|
||||
import java.util.*;
|
||||
|
@ -73,7 +74,7 @@ public class DedupUtility {
|
|||
public static String md5(final String s) {
|
||||
try {
|
||||
final MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(s.getBytes("UTF-8"));
|
||||
md.update(s.getBytes(StandardCharsets.UTF_8));
|
||||
return new String(Hex.encodeHex(md.digest()));
|
||||
} catch (final Exception e) {
|
||||
System.err.println("Error creating id");
|
||||
|
|
|
@ -15,7 +15,7 @@ public class SparkReporter implements Serializable, Reporter {
|
|||
|
||||
private final List<Tuple2<String, String>> relations = new ArrayList<>();
|
||||
|
||||
private Map<String, LongAccumulator> accumulators;
|
||||
private final Map<String, LongAccumulator> accumulators;
|
||||
|
||||
public SparkReporter(Map<String, LongAccumulator> accumulators) {
|
||||
this.accumulators = accumulators;
|
||||
|
|
|
@ -106,7 +106,7 @@ public class DedupUtility {
|
|||
public static String md5(final String s) {
|
||||
try {
|
||||
final MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(s.getBytes("UTF-8"));
|
||||
md.update(s.getBytes(StandardCharsets.UTF_8));
|
||||
return new String(Hex.encodeHex(md.digest()));
|
||||
} catch (final Exception e) {
|
||||
System.err.println("Error creating id");
|
||||
|
|
|
@ -410,14 +410,10 @@ public abstract class AbstractMdRecordToOafMapper {
|
|||
|
||||
final String identifier = n.valueOf("./*[local-name()='identifier']");
|
||||
final String baseURL = n.valueOf("./*[local-name()='baseURL']");
|
||||
;
|
||||
final String metadataNamespace = n.valueOf("./*[local-name()='metadataNamespace']");
|
||||
;
|
||||
final boolean altered = n.valueOf("@altered").equalsIgnoreCase("true");
|
||||
final String datestamp = n.valueOf("./*[local-name()='datestamp']");
|
||||
;
|
||||
final String harvestDate = n.valueOf("@harvestDate");
|
||||
;
|
||||
|
||||
return oaiIProvenance(identifier, baseURL, metadataNamespace, altered, datestamp, harvestDate);
|
||||
}
|
||||
|
|
|
@ -514,9 +514,7 @@ public class MigrateDbEntitiesApplication extends AbstractMigrationApplication
|
|||
if (arr.length == 3) {
|
||||
final String issn = StringUtils.isNotBlank(arr[0]) ? arr[0] : null;
|
||||
final String eissn = StringUtils.isNotBlank(arr[1]) ? arr[1] : null;
|
||||
;
|
||||
final String lissn = StringUtils.isNotBlank(arr[2]) ? arr[2] : null;
|
||||
;
|
||||
if (issn != null || eissn != null || lissn != null) {
|
||||
return journal(name, issn, eissn, eissn, null, null, null, null, null, null, null, info);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class DbClient implements Closeable {
|
|||
|
||||
private static final Log log = LogFactory.getLog(DbClient.class);
|
||||
|
||||
private Connection connection;
|
||||
private final Connection connection;
|
||||
|
||||
public DbClient(final String address, final String login, final String password) {
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package eu.dnetlib.dhp.oa.graph.raw.common;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.Normalizer;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -141,7 +142,7 @@ public class PacePerson {
|
|||
public String hash() {
|
||||
return Hashing
|
||||
.murmur3_128()
|
||||
.hashString(getNormalisedFullname(), Charset.forName(UTF8))
|
||||
.hashString(getNormalisedFullname(), StandardCharsets.UTF_8)
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public abstract class AbstractScholexplorerParser {
|
|||
|
||||
protected static final Log log = LogFactory.getLog(AbstractScholexplorerParser.class);
|
||||
static final Pattern pattern = Pattern.compile("10\\.\\d{4,9}/[-._;()/:A-Z0-9]+$", Pattern.CASE_INSENSITIVE);
|
||||
private List<String> datasetSubTypes = Arrays
|
||||
private final List<String> datasetSubTypes = Arrays
|
||||
.asList(
|
||||
"dataset",
|
||||
"software",
|
||||
|
|
|
@ -18,7 +18,7 @@ import eu.dnetlib.dhp.utils.DHPUtils;
|
|||
|
||||
public class CrossRefParserJSON {
|
||||
|
||||
private static List<ScholixCollectedFrom> collectedFrom = generateCrossrefCollectedFrom("complete");
|
||||
private static final List<ScholixCollectedFrom> collectedFrom = generateCrossrefCollectedFrom("complete");
|
||||
|
||||
public static ScholixResource parseRecord(final String record) {
|
||||
if (record == null)
|
||||
|
|
|
@ -16,7 +16,7 @@ public class DataciteClient {
|
|||
private String host;
|
||||
private String index = "datacite";
|
||||
private String indexType = "dump";
|
||||
private Datacite2Scholix d2s;
|
||||
private final Datacite2Scholix d2s;
|
||||
|
||||
public DataciteClient(String host) {
|
||||
this.host = host;
|
||||
|
|
|
@ -12,7 +12,7 @@ import eu.dnetlib.dhp.oa.provision.model.SortableRelation;
|
|||
*/
|
||||
public class RelationPartitioner extends Partitioner {
|
||||
|
||||
private int numPartitions;
|
||||
private final int numPartitions;
|
||||
|
||||
public RelationPartitioner(int numPartitions) {
|
||||
this.numPartitions = numPartitions;
|
||||
|
|
|
@ -46,7 +46,7 @@ public class StreamingInputDocumentFactory {
|
|||
|
||||
private static final String INDEX_RECORD_ID = INDEX_FIELD_PREFIX + "indexrecordidentifier";
|
||||
|
||||
private static final String outFormat = new String("yyyy-MM-dd'T'hh:mm:ss'Z'");
|
||||
private static final String outFormat = "yyyy-MM-dd'T'hh:mm:ss'Z'";
|
||||
|
||||
private static final List<String> dateFormats = Arrays
|
||||
.asList("yyyy-MM-dd'T'hh:mm:ss", "yyyy-MM-dd", "dd-MM-yyyy", "dd/MM/yyyy", "yyyy");
|
||||
|
@ -61,15 +61,18 @@ public class StreamingInputDocumentFactory {
|
|||
|
||||
private static final int MAX_FIELD_LENGTH = 25000;
|
||||
|
||||
private ThreadLocal<XMLInputFactory> inputFactory = ThreadLocal.withInitial(() -> XMLInputFactory.newInstance());
|
||||
private final ThreadLocal<XMLInputFactory> inputFactory = ThreadLocal
|
||||
.withInitial(() -> XMLInputFactory.newInstance());
|
||||
|
||||
private ThreadLocal<XMLOutputFactory> outputFactory = ThreadLocal.withInitial(() -> XMLOutputFactory.newInstance());
|
||||
private final ThreadLocal<XMLOutputFactory> outputFactory = ThreadLocal
|
||||
.withInitial(() -> XMLOutputFactory.newInstance());
|
||||
|
||||
private ThreadLocal<XMLEventFactory> eventFactory = ThreadLocal.withInitial(() -> XMLEventFactory.newInstance());
|
||||
private final ThreadLocal<XMLEventFactory> eventFactory = ThreadLocal
|
||||
.withInitial(() -> XMLEventFactory.newInstance());
|
||||
|
||||
private String version;
|
||||
private final String version;
|
||||
|
||||
private String dsId;
|
||||
private final String dsId;
|
||||
|
||||
private String resultName = DEFAULTDNETRESULT;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import eu.dnetlib.dhp.schema.oaf.OafEntity;
|
|||
|
||||
public class TemplateFactory {
|
||||
|
||||
private TemplateResources resources;
|
||||
private final TemplateResources resources;
|
||||
|
||||
private static final char DELIMITER = '$';
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@ import com.google.common.io.Resources;
|
|||
|
||||
public class TemplateResources {
|
||||
|
||||
private String record = read("eu/dnetlib/dhp/oa/provision/template/record.st");
|
||||
private final String record = read("eu/dnetlib/dhp/oa/provision/template/record.st");
|
||||
|
||||
private String instance = read("eu/dnetlib/dhp/oa/provision/template/instance.st");
|
||||
private final String instance = read("eu/dnetlib/dhp/oa/provision/template/instance.st");
|
||||
|
||||
private String rel = read("eu/dnetlib/dhp/oa/provision/template/rel.st");
|
||||
private final String rel = read("eu/dnetlib/dhp/oa/provision/template/rel.st");
|
||||
|
||||
private String webresource = read("eu/dnetlib/dhp/oa/provision/template/webresource.st");
|
||||
private final String webresource = read("eu/dnetlib/dhp/oa/provision/template/webresource.st");
|
||||
|
||||
private String child = read("eu/dnetlib/dhp/oa/provision/template/child.st");
|
||||
private final String child = read("eu/dnetlib/dhp/oa/provision/template/child.st");
|
||||
|
||||
private String entity = read("eu/dnetlib/dhp/oa/provision/template/entity.st");
|
||||
private final String entity = read("eu/dnetlib/dhp/oa/provision/template/entity.st");
|
||||
|
||||
private static String read(final String classpathResource) throws IOException {
|
||||
return Resources.toString(Resources.getResource(classpathResource), StandardCharsets.UTF_8);
|
||||
|
|
|
@ -48,13 +48,13 @@ import eu.dnetlib.dhp.schema.oaf.Result;
|
|||
public class XmlRecordFactory implements Serializable {
|
||||
|
||||
public static final String REL_SUBTYPE_DEDUP = "dedup";
|
||||
private Map<String, LongAccumulator> accumulators;
|
||||
private final Map<String, LongAccumulator> accumulators;
|
||||
|
||||
private Set<String> specialDatasourceTypes;
|
||||
private final Set<String> specialDatasourceTypes;
|
||||
|
||||
private ContextMapper contextMapper;
|
||||
private final ContextMapper contextMapper;
|
||||
|
||||
private String schemaLocation;
|
||||
private final String schemaLocation;
|
||||
|
||||
private boolean indent = false;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class XmlSerializationUtils {
|
|||
|
||||
public static String mapStructuredProperty(String name, StructuredProperty t) {
|
||||
return asXmlElement(
|
||||
name, t.getValue(), t.getQualifier(), t.getDataInfo() != null ? t.getDataInfo() : null);
|
||||
name, t.getValue(), t.getQualifier(), t.getDataInfo());
|
||||
}
|
||||
|
||||
public static String mapQualifier(String name, Qualifier q) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
|
||||
public class GraphJoinerTest {
|
||||
|
||||
private ClassLoader cl = getClass().getClassLoader();
|
||||
private final ClassLoader cl = getClass().getClassLoader();
|
||||
private Path workingDir;
|
||||
private Path inputDir;
|
||||
private Path outputDir;
|
||||
|
|
Loading…
Reference in New Issue