From e5c46a956178dc27e47902a967198d0b320e17bb Mon Sep 17 00:00:00 2001 From: Markus Weigelt Date: Fri, 4 Feb 2022 14:10:09 +0100 Subject: [PATCH 1/4] change peeking iterator to PeekingIterator of org.apache.commons dependency --- Kitodo/pom.xml | 5 ----- .../production/migration/NewspaperProcessesMigrator.java | 7 ++++--- pom.xml | 8 -------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Kitodo/pom.xml b/Kitodo/pom.xml index dcd62779e97..24b4a7e2f42 100644 --- a/Kitodo/pom.xml +++ b/Kitodo/pom.xml @@ -461,11 +461,6 @@ - - com.google.collect - com.springsource.com.google.common.collect - 0.8.0.20080820 - org.primefaces.extensions diff --git a/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java b/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java index 797ff5486e8..708c0b588a3 100644 --- a/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java +++ b/Kitodo/src/main/java/org/kitodo/production/migration/NewspaperProcessesMigrator.java @@ -11,8 +11,7 @@ package org.kitodo.production.migration; -import com.google.common.collect.Iterators; -import com.google.common.collect.PeekingIterator; + import java.io.File; import java.io.IOException; @@ -33,6 +32,8 @@ import javax.naming.ConfigurationException; +import org.apache.commons.collections4.iterators.PeekingIterator; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.kitodo.api.MdSec; @@ -755,7 +756,7 @@ private String getYearTitle(String year) { */ public boolean hasNextYear() { if (Objects.isNull(yearsIterator)) { - yearsIterator = Iterators.peekingIterator(years.entrySet().iterator()); + yearsIterator = new PeekingIterator(years.entrySet().iterator()); } return yearsIterator.hasNext(); } diff --git a/pom.xml b/pom.xml index 85ce18a9e9a..cabf0b4b81d 100644 --- a/pom.xml +++ b/pom.xml @@ -90,14 +90,6 @@ false - - maven-eu - maven-eu Repository - https://maven-eu.nuxeo.org/nexus/content/repositories/public/ - - false - - From 28644d58c0e3cfed427e84af394e3537d62ba61e Mon Sep 17 00:00:00 2001 From: Markus Weigelt Date: Mon, 7 Feb 2022 11:24:09 +0100 Subject: [PATCH 2/4] fix npe when object parameter is null --- Kitodo/src/main/java/org/kitodo/production/helper/Helper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java b/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java index 313627a13e2..4ca92008e6b 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java @@ -135,7 +135,7 @@ public static void setErrorMessage(String control, String message, Exception e) */ public static void setErrorMessage(String title, Object... parameters) { if (Objects.nonNull(parameters) && parameters.length > 0) { - setErrorMessage(getTranslation(title, Arrays.stream(parameters).map(Object::toString).toArray(String[]::new))); + setErrorMessage(getTranslation(title, Arrays.stream(parameters).map(object -> Objects.nonNull(object) ? Objects.toString(object) : "").toArray(String[]::new))); } else { setErrorMessage(getTranslation(title)); } From adaf87de368d2a5e9d894b68744fc679ae2d75eb Mon Sep 17 00:00:00 2001 From: Markus Weigelt Date: Mon, 7 Feb 2022 11:42:35 +0100 Subject: [PATCH 3/4] fix checkstyle problem --- Kitodo/src/main/java/org/kitodo/production/helper/Helper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java b/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java index 4ca92008e6b..57239076dc4 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java @@ -135,7 +135,8 @@ public static void setErrorMessage(String control, String message, Exception e) */ public static void setErrorMessage(String title, Object... parameters) { if (Objects.nonNull(parameters) && parameters.length > 0) { - setErrorMessage(getTranslation(title, Arrays.stream(parameters).map(object -> Objects.nonNull(object) ? Objects.toString(object) : "").toArray(String[]::new))); + setErrorMessage(getTranslation(title, Arrays.stream(parameters) + .map(object -> Objects.nonNull(object) ? Objects.toString(object) : "").toArray(String[]::new))); } else { setErrorMessage(getTranslation(title)); } From 10b940fb55f491f240d2a39196e7763e168e5740 Mon Sep 17 00:00:00 2001 From: Markus Weigelt Date: Mon, 7 Feb 2022 11:44:57 +0100 Subject: [PATCH 4/4] change to string of null values cause "null" is more clear than of empty string --- Kitodo/src/main/java/org/kitodo/production/helper/Helper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java b/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java index 57239076dc4..d8372f25489 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/Helper.java @@ -135,8 +135,8 @@ public static void setErrorMessage(String control, String message, Exception e) */ public static void setErrorMessage(String title, Object... parameters) { if (Objects.nonNull(parameters) && parameters.length > 0) { - setErrorMessage(getTranslation(title, Arrays.stream(parameters) - .map(object -> Objects.nonNull(object) ? Objects.toString(object) : "").toArray(String[]::new))); + setErrorMessage(getTranslation(title, + Arrays.stream(parameters).map(object -> Objects.toString(object)).toArray(String[]::new))); } else { setErrorMessage(getTranslation(title)); }