diff --git a/dspace-api/src/main/java/org/dspace/core/Context.java b/dspace-api/src/main/java/org/dspace/core/Context.java index be52595c09..7bbea212c3 100644 --- a/dspace-api/src/main/java/org/dspace/core/Context.java +++ b/dspace-api/src/main/java/org/dspace/core/Context.java @@ -10,10 +10,10 @@ package org.dspace.core; import java.sql.SQLException; import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.EmptyStackException; import java.util.LinkedList; import java.util.List; import java.util.Locale; +import java.util.NoSuchElementException; import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; @@ -157,8 +157,6 @@ public class Context implements AutoCloseable { /** * Initializes a new context object. - * - * @throws SQLException if there was an error obtaining a database connection */ protected void init() { updateDatabase(); @@ -310,7 +308,7 @@ public class Context implements AutoCloseable { Boolean previousState; try { previousState = authStateChangeHistory.pop(); - } catch (EmptyStackException ex) { + } catch (NoSuchElementException ex) { log.warn(LogManager.getHeader(this, "restore_auth_sys_state", "not previous state info available " + ex.getLocalizedMessage())); @@ -325,8 +323,7 @@ public class Context implements AutoCloseable { // if previousCaller is not the current caller *only* log a warning if (!previousCaller.equals(caller)) { - log - .warn(LogManager + log.warn(LogManager .getHeader( this, "restore_auth_sys_state", @@ -741,7 +738,7 @@ public class Context implements AutoCloseable { dbConnection.setConnectionMode(false, false); break; default: - log.warn("New context mode detected that has nog been configured."); + log.warn("New context mode detected that has not been configured."); break; } } catch (SQLException ex) { @@ -803,7 +800,7 @@ public class Context implements AutoCloseable { * entity. This means changes to the entity will be tracked and persisted to the database. * * @param entity The entity to reload - * @param The class of the enity. The entity must implement the {@link ReloadableEntity} interface. + * @param The class of the entity. The entity must implement the {@link ReloadableEntity} interface. * @return A (possibly) NEW reference to the entity that should be used for further processing. * @throws SQLException When reloading the entity from the database fails. */ @@ -816,7 +813,7 @@ public class Context implements AutoCloseable { * Remove an entity from the cache. This is necessary when batch processing a large number of items. * * @param entity The entity to reload - * @param The class of the enity. The entity must implement the {@link ReloadableEntity} interface. + * @param The class of the entity. The entity must implement the {@link ReloadableEntity} interface. * @throws SQLException When reloading the entity from the database fails. */ @SuppressWarnings("unchecked") diff --git a/dspace-api/src/main/java/org/dspace/core/Utils.java b/dspace-api/src/main/java/org/dspace/core/Utils.java index 8968c8950f..17fe7c4d03 100644 --- a/dspace-api/src/main/java/org/dspace/core/Utils.java +++ b/dspace-api/src/main/java/org/dspace/core/Utils.java @@ -17,6 +17,7 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.rmi.dgc.VMID; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -33,7 +34,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.coverity.security.Escape; -import java.nio.charset.StandardCharsets; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringSubstitutor; import org.apache.logging.log4j.LogManager; diff --git a/dspace-api/src/main/java/org/dspace/discovery/DiscoverQuery.java b/dspace-api/src/main/java/org/dspace/discovery/DiscoverQuery.java index f9ca9c2e9c..e133ad0ed1 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/DiscoverQuery.java +++ b/dspace-api/src/main/java/org/dspace/discovery/DiscoverQuery.java @@ -15,7 +15,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -23,7 +22,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.dspace.discovery.configuration.DiscoverySearchFilterFacet; /** - * This class represents a query which the discovery backend can use + * This class represents a query which the discovery back-end can use. * * @author Kevin Van de Velde (kevin at atmire dot com) */ @@ -273,7 +272,7 @@ public class DiscoverQuery { /** * Sets the fields which you want Discovery to return in the search results. * It is HIGHLY recommended to limit the fields returned, as by default - * some backends (like Solr) will return everything. + * some back-ends (like Solr) will return everything. * * @param field field to add to the list of fields returned */ diff --git a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java index 40d031ac29..6f2cb4b4fb 100644 --- a/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java +++ b/dspace-api/src/main/java/org/dspace/eperson/dao/impl/SubscriptionDAOImpl.java @@ -9,7 +9,6 @@ package org.dspace.eperson.dao.impl; import java.sql.SQLException; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import javax.persistence.Query; import javax.persistence.criteria.CriteriaBuilder; diff --git a/dspace-api/src/main/java/org/dspace/statistics/Dataset.java b/dspace-api/src/main/java/org/dspace/statistics/Dataset.java index f5a5e05e04..c1d6bc0dd6 100644 --- a/dspace-api/src/main/java/org/dspace/statistics/Dataset.java +++ b/dspace-api/src/main/java/org/dspace/statistics/Dataset.java @@ -10,6 +10,7 @@ package org.dspace.statistics; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.text.ParseException; import java.util.ArrayList; @@ -18,13 +19,12 @@ import java.util.List; import java.util.Map; import au.com.bytecode.opencsv.CSVWriter; -import java.nio.charset.StandardCharsets; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; /** * @author kevinvandevelde at atmire.com - * Date: 21-jan-2009 + * Date: 21-Jan-2009 * Time: 13:44:48 */ public class Dataset {