Skip to content

Commit

Permalink
Fixed CI=true build
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhofmann committed Oct 7, 2022
1 parent 0c00a44 commit 44c1d0d
Show file tree
Hide file tree
Showing 19 changed files with 71 additions and 210 deletions.
37 changes: 19 additions & 18 deletions ubo-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,24 +144,6 @@
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<exclusions>
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom2</artifactId>
</exclusion>
<exclusion>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
Expand Down Expand Up @@ -252,6 +234,25 @@
<artifactId>commons-discovery</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom2</artifactId>
</exclusion>
<exclusion>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
Expand Down
163 changes: 0 additions & 163 deletions ubo-common/src/main/java/org/mycore/ubo/BatchEditor.java

This file was deleted.

10 changes: 6 additions & 4 deletions ubo-common/src/main/java/org/mycore/ubo/DozBibCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
Expand Down Expand Up @@ -91,7 +92,7 @@ public DozBibCommands() {

/** Exports all entries as MODS dump to a zipped xml file in the given directory */
public static void exportMODS(String dir) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT);
Date now = new Date();
String date = df.format(now);
String fileName = "export-" + date + ".zip";
Expand Down Expand Up @@ -197,18 +198,19 @@ public static void migrate2mcrobject() throws Exception {
public static void importMODSCollection(String fileName) throws Exception {
File file = new File(fileName);
if (!file.isFile()) {
throw new MCRException(MessageFormat.format("File {0} is not a file.", file.getAbsolutePath()));
throw new MCRException(String.format(Locale.ROOT, "File %s is not a file.", file.getAbsolutePath()));
}
SAXBuilder s = new SAXBuilder(XMLReaders.NONVALIDATING, null, null);
Document doc = s.build(file);
MCRXMLHelper.validate(doc, MCRMODSCommands.MODS_V3_XSD_URI);
Element root = doc.getRootElement();
if (!root.getNamespace().equals(MCRConstants.MODS_NAMESPACE)) {
throw new MCRException(MessageFormat.format("File {0} is not a MODS document.", file.getAbsolutePath()));
throw new MCRException(
String.format(Locale.ROOT, "File %s is not a MODS document.", file.getAbsolutePath()));
}
if (!root.getName().equals("modsCollection")) {
throw new MCRException(
MessageFormat.format("File {0} does not contain a mods:modsCollection.", file.getAbsolutePath()));
String.format(Locale.ROOT, "File %s does not contain a mods:modsCollection.", file.getAbsolutePath()));
}
for (Element mods : root.getChildren("mods", MCRConstants.MODS_NAMESPACE)) {
MCRMODSWrapper wrapper = new MCRMODSWrapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -396,6 +397,6 @@ private String getContributorName(Element contributor) {
}

private String normalizeTitle(String title) {
return title.toLowerCase().replaceAll("[^a-z]+", "");
return title.toLowerCase(Locale.ROOT).replaceAll("[^a-z]+", "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import org.jdom2.Document;
Expand Down Expand Up @@ -194,7 +195,7 @@ public DeDupCriterion buildFromTitleAuthor(String title, String author) {
* Accents, umlauts, case are normalized. Punctuation and non-alphabetic/non-digit characters are removed.
*/
public static String normalizeText(String text) {
text = text.toLowerCase();
text = text.toLowerCase(Locale.ROOT);
text = new MCRHyphenNormalizer().normalize(text).replace("-", " ");
text = Normalizer.normalize(text, Form.NFD).replaceAll("\\p{M}", ""); // canonical decomposition, then remove accents
text = text.replace("ue", "u").replace("oe", "o").replace("ae", "a").replace("ß", "s").replace("ss", "s");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -43,7 +44,7 @@ public abstract class ImportJob {

private static final Logger LOGGER = LogManager.getLogger(ImportJob.class);

private static final SimpleDateFormat ID_BUILDER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final SimpleDateFormat ID_BUILDER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);

private static final String PROJECT_ID = MCRConfiguration2.getString("UBO.projectid.default").get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import org.jdom2.Document;
import org.jdom2.Element;
Expand Down Expand Up @@ -60,7 +61,8 @@ private URL buildQueryURL() throws MalformedURLException {

private URL buildQueryURL(int start) throws MalformedURLException {
String encodedQuery = URLEncoder.encode(getQuery(), StandardCharsets.UTF_8);
String queryString = String.format(QUERY_PATTERN, encodedQuery, API_KEY, INST_TOKEN, getCount(), start);
String queryString
= String.format(Locale.ROOT, QUERY_PATTERN, encodedQuery, API_KEY, INST_TOKEN, getCount(), start);
return new URL(API_URL + queryString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Locale;
import java.util.function.Consumer;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -59,7 +60,8 @@ public ScopusAffiliationQuery(String affiliation){
}

protected URL buildAffiliationQuery() throws MalformedURLException {
String queryString = String.format(AFFILIATION_QUERY_PATTERN, getAffiliation(), API_KEY, INST_TOKEN,getCount(), getStart());
String queryString = String.format(Locale.ROOT, AFFILIATION_QUERY_PATTERN, getAffiliation(), API_KEY,
INST_TOKEN, getCount(), getStart());
return new URL(API_URL + queryString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -99,15 +100,16 @@ private boolean isAlreadyStored(String scopusID) {
}

private Element retrieveAndConvertPublication(String externalID) {
String uri = MessageFormat.format(IMPORT_URI, externalID);
String uri = new MessageFormat(IMPORT_URI, Locale.ROOT).format(externalID);
return MCRURIResolver.instance().resolve(uri);
}

/** If mods:genre was not mapped by conversion/import function, ignore this publication and do not import */
private static boolean shouldIgnore(Element publication) {
return !publication.getDescendants(new ElementFilter("genre", MCRConstants.MODS_NAMESPACE)).hasNext();
}
private final static SimpleDateFormat ID_BUILDER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

private final static SimpleDateFormat ID_BUILDER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);

private MCRObject buildMCRObject(Element publicationXML) {
MCRObject obj = new MCRObject(new Document(publicationXML));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Locale;

import org.jdom2.Document;
import org.jdom2.JDOMException;
Expand Down Expand Up @@ -43,7 +44,7 @@ public ScopusQuery(String query, int count) throws MalformedURLException {

private URL buildQueryURL() throws MalformedURLException {
String encodedQuery = URLEncoder.encode(getQuery(), StandardCharsets.UTF_8);
String queryString = String.format(QUERY_PATTERN, encodedQuery, API_KEY, INST_TOKEN, getCount());
String queryString = String.format(Locale.ROOT, QUERY_PATTERN, encodedQuery, API_KEY, INST_TOKEN, getCount());
return new URL(API_URL + queryString);
}

Expand Down
Loading

0 comments on commit 44c1d0d

Please sign in to comment.