Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 25
distribution: temurin
cache: maven

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void setOpenAIRE(String searchTrigger, String fullName) {
nameElement.click();

driver.waitAndFindElements(By.xpath(".//ul[contains(@class,'typeahead')]/li/a")).stream()
.filter(e -> e.getText().contains(fullName)).limit(1).forEach(e -> e.click());
.filter(e -> e.getText().contains(fullName)).limit(1).forEach(WebElement::click);
}

public void setTitle(String title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void chooseClassiRoot(HttpServletRequest request) {
private Collection<Element> getRoleElements() {
MCRCategoryDAO categoryDao = MCRCategoryDAOFactory.obtainInstance();
List<MCRCategory> allClassi = categoryDao.getRootCategories();
ArrayList<Element> list = new ArrayList<Element>(allClassi.size());
ArrayList<Element> list = new ArrayList<>(allClassi.size());
for (MCRCategory category : allClassi) {
if (MCRAccessManager.checkPermission(category.getId().toString(), MCRAccessManager.PERMISSION_READ)) {
Element role = new Element("classification");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class MIROwnerStrategy implements MCRAccessCheckStrategy {
private static final Pattern TYPE_PATTERN = Pattern.compile("[^_]*_([^_]*)_*");

private static LoadingCache<MCRObjectID, String> CREATOR_CACHE = CacheBuilder.newBuilder().weakKeys()
.maximumSize(5000).build(new CacheLoader<MCRObjectID, String>() {
.maximumSize(5000).build(new CacheLoader<>() {

@Override
public String load(MCRObjectID mcrObjectID) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
package org.mycore.mir.authorization;

import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -295,9 +296,7 @@ private static List<MCRCategoryID> generateMCRCategoryIDList(String objectType,
.map(s -> s.substring((objectType + ":").length()))
.map(MCRCategoryID::ofString)
.filter(c -> accessClasses.contains(c.getRootID()))
.sorted((c1, c2) -> {
return accessClasses.indexOf(c1.getRootID()) - accessClasses.indexOf(c2.getRootID());
})
.sorted(Comparator.comparingInt(c -> accessClasses.indexOf(c.getRootID())))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private Boolean verifyResponse(final String response, final String ip) {
final Gson gson = new Gson();
final ReCaptchaResult rcResult = gson.fromJson(json, ReCaptchaResult.class);

return Boolean.valueOf(rcResult.success);
return rcResult.success;
} catch (final IOException | InterruptedException e) {
LOGGER.warn("ReCaptcha response could not be verified!", e);
return Boolean.FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
Expand Down Expand Up @@ -125,7 +126,7 @@ private static Optional<String> detectPPN(MCRObject mcrObject, String defaultPPN
return null;
}
})
.filter(o -> o != null)
.filter(Objects::nonNull)
.collect(Collectors.toList());

for (URI possiblePPNURI : possiblePPNURIs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static List<String> migrateDerivateDisplay(String targetCategory) {
.filter(
der -> "false".equals(der.getRootElement().getChild("derivate").getAttributeValue("display", "true")))
.map(MCRDerivate::new)
.peek(der -> addContentIfNeeded(der))
.peek(MIRMigration202006Utils::addContentIfNeeded)
.map(der -> getMigrationCommand(der, categoryID))
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -298,9 +298,7 @@ public static void tryMigrationOfTitleInfoOrAbstractRequired(String mycoreObject
.map(en -> Optional.ofNullable(titleInfo.getChild(en, MCRConstants.MODS_NAMESPACE))
.orElse(titleInfo.getChild(en)))
.filter(Objects::nonNull)
.forEach(child -> {
fixHTML(xout, child);
});
.forEach(child -> fixHTML(xout, child));
embedDocumentAsAltFormat(domOutputter, element, decodedDocument);
} catch (JDOMException | IOException | TransformerException e) {
throw new MCRException("Error while building document!", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ public static void checkNameIdentifierType(String objectID, String dryStr)
HashSet<String> labelLanguages = getAllRegularLabelLanguagesPresentInCategory(rootCategory, new HashSet<>());

AtomicBoolean update = new AtomicBoolean(false);
mcrModsWrapper.getElements("mods:name").forEach(name -> {
fixModsName(NAME_IDENTIFIER, rootID, labelLanguages, update, name);
});
mcrModsWrapper.getElements("mods:name")
.forEach(name -> fixModsName(NAME_IDENTIFIER, rootID, labelLanguages, update, name));

if (update.get() && !dry) {
LOGGER.info("Save updated object: " + mcrObjectID);
Expand All @@ -73,9 +72,9 @@ public static void checkNameIdentifierType(String objectID, String dryStr)

private static void fixModsName(String classification, MCRCategoryID rootID, HashSet<String> labelLanguages,
AtomicBoolean update, Element name) {
name.getChildren(NAME_IDENTIFIER, MCRConstants.MODS_NAMESPACE).forEach(nameIdentifier -> {
fixModsNameIdentifier(classification, rootID, labelLanguages, update, nameIdentifier);
});
name.getChildren(NAME_IDENTIFIER, MCRConstants.MODS_NAMESPACE)
.forEach(nameIdentifier -> fixModsNameIdentifier(classification, rootID, labelLanguages, update,
nameIdentifier));
}

private static void fixModsNameIdentifier(String classification, MCRCategoryID rootID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,11 @@ public void ingestResource(MCRObject mcrObject, Deposit deposit) throws SwordErr
public Document buildDCDocument(Map<String, List<String>> dublinCoreMetadata) {
final Element dcRootElement = new Element("dc");
final Document dc = new Document(dcRootElement);
dublinCoreMetadata.entrySet().forEach(dcElementValueEntry -> {
final String elemenName = dcElementValueEntry.getKey();
dcElementValueEntry.getValue().forEach(value -> {
final Element dcElement = new Element(elemenName, DC_NAMESPACE);
dcElement.setText(value);
dcRootElement.addContent(dcElement);
});
});
dublinCoreMetadata.forEach((elemenName, value1) -> value1.forEach(value -> {
final Element dcElement = new Element(elemenName, DC_NAMESPACE);
dcElement.setText(value);
dcRootElement.addContent(dcElement);
}));
return dc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ public void addMetadata(MCRObject object, DepositReceipt receipt) throws SwordEr

elementList.stream()
.filter(dcElement -> dcElement.getText().trim().length() > 0)
.forEach(dcElement -> {
receipt.addDublinCore(dcElement.getName(), dcElement.getText().trim());
});
.forEach(dcElement -> receipt.addDublinCore(dcElement.getName(), dcElement.getText().trim()));

MCRSwordUtil.addDatesToEntry(receipt.getWrappedEntry(), object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testMigrationTransformer_success() throws IOException, JDOMException
assertNull(identifierElement);
final List<Element> fundingReferenceElements = wrapper.getElements(FUNDING_REFERENCE_XPATH);
assertEquals(1, fundingReferenceElements.size());
final Element fundingReferenceElement = fundingReferenceElements.get(0);
final Element fundingReferenceElement = fundingReferenceElements.getFirst();
final Element awardTitleElement = fundingReferenceElement.getChild("awardTitle");
assertNotNull(awardTitleElement);
assertEquals(AWARD_TITLE, awardTitleElement.getText());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MIRWizardCommandChain {
private boolean success = true;

public MIRWizardCommandChain() {
setCommands(new ArrayList<MIRWizardCommand>());
setCommands(new ArrayList<>());
}

public List<MIRWizardCommand> getCommands() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class MIRWizardCommandResult {

private boolean success;

private Map<String, String> attributes = new HashMap<String, String>();
private Map<String, String> attributes = new HashMap<>();

private Element result;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class MIRWizardStartupHandler implements MCRStartupHandler.AutoExecutable
private static final String WIZARD_FILTER_CLASS = MIRWizardRequestFilter.class.getName();

static void outputLoginToken(ServletContext servletContext) {
final StringBuffer sb = new StringBuffer();
final StringBuilder sb = new StringBuilder();

final String line = "=".repeat(80);
sb.append("\n\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ private MIRWizardInitDatabase(String name) {
@Override
public void doExecute() {
try {
StringBuffer res = new StringBuffer();
StringBuilder res = new StringBuilder();

HashMap<String, String> initProps = new HashMap<String, String>();
HashMap<String, String> initProps = new HashMap<>();
initProps.put("hibernate.hbm2ddl.auto", "create");
MCRJPABootstrapper.initializeJPA(PERSISTENCE_UNIT_NAME, initProps);

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
<changelog.since>2024-12-18</changelog.since>
<!-- until snapshot matches released version (required for 'mvn changes:changes-check') -->
<changes.version>2025.02</changes.version>
<java.target.version>21</java.target.version>
<java.target.version>25</java.target.version>
<jetty.version>12.1.6</jetty.version>
<maven.compiler.arg>-Werror</maven.compiler.arg>
<mycore.version>2026.06.0-SNAPSHOT</mycore.version>
<pmd.failOnViolation>true</pmd.failOnViolation>
<pmd.version>7.11.0</pmd.version>
<pmd.version>7.16.0</pmd.version>
<selenium.version>4.23.0</selenium.version>
<site.suffix />
<solr-runner.solrVersionString>9.10.1</solr-runner.solrVersionString>
Expand Down
Loading