Replace new uses of Log4J v1 with v2. Ban v1 artifacts. #3190.

This commit is contained in:
Mark H. Wood
2021-03-17 06:04:49 -04:00
parent 2b4f22be65
commit dc487fd29d
43 changed files with 213 additions and 146 deletions

View File

@@ -413,6 +413,12 @@
<groupId>org.apache.jena</groupId> <groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId> <artifactId>apache-jena-libs</artifactId>
<type>pom</type> <type>pom</type>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-cli</groupId> <groupId>commons-cli</groupId>
@@ -546,6 +552,10 @@
<groupId>net.bytebuddy</groupId> <groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId> <artifactId>byte-buddy</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -14,7 +14,8 @@ import java.util.List;
import java.util.TreeMap; import java.util.TreeMap;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.scripts.DSpaceRunnable; import org.dspace.scripts.DSpaceRunnable;
import org.dspace.scripts.configuration.ScriptConfiguration; import org.dspace.scripts.configuration.ScriptConfiguration;
import org.dspace.scripts.factory.ScriptServiceFactory; import org.dspace.scripts.factory.ScriptServiceFactory;
@@ -36,7 +37,7 @@ import org.jdom.input.SAXBuilder;
*/ */
public class ScriptLauncher { public class ScriptLauncher {
private static final Logger log = Logger.getLogger(ScriptLauncher.class); private static final Logger log = LogManager.getLogger();
/** /**
* The service manager kernel * The service manager kernel

View File

@@ -13,7 +13,8 @@ import java.io.InputStreamReader;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@@ -26,7 +27,7 @@ import org.json.JSONTokener;
* @see SHERPAPublisher * @see SHERPAPublisher
* *
* @author Kim Shepherd * @author Kim Shepherd
* *
*/ */
public class SHERPAPublisherResponse { public class SHERPAPublisherResponse {
// Is this response to be treated as an error? // Is this response to be treated as an error?
@@ -52,7 +53,7 @@ public class SHERPAPublisherResponse {
JSON, XML JSON, XML
}; };
private static Logger log = Logger.getLogger(SHERPAPublisherResponse.class); private static Logger log = LogManager.getLogger();
/** /**
* Parse SHERPA v2 API for a given format * Parse SHERPA v2 API for a given format

View File

@@ -16,7 +16,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.core.I18nUtil; import org.dspace.core.I18nUtil;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@@ -29,9 +30,9 @@ import org.json.JSONTokener;
* The structure is based on journal data, which in turn contains data about publishers and policies * The structure is based on journal data, which in turn contains data about publishers and policies
* *
* @see SHERPAJournal * @see SHERPAJournal
* *
* @author Kim Shepherd * @author Kim Shepherd
* *
*/ */
public class SHERPAResponse { public class SHERPAResponse {
// Is this response to be treated as an error? // Is this response to be treated as an error?
@@ -57,7 +58,7 @@ public class SHERPAResponse {
JSON, XML JSON, XML
}; };
private static Logger log = Logger.getLogger(SHERPAResponse.class); private static Logger log = LogManager.getLogger();
/** /**
* Parse SHERPA v2 API for a given format * Parse SHERPA v2 API for a given format

View File

@@ -21,7 +21,8 @@ import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService; import org.dspace.content.service.BitstreamService;
import org.dspace.core.Constants; import org.dspace.core.Constants;
@@ -45,7 +46,7 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
/** /**
* log4j logger * log4j logger
*/ */
private static Logger log = Logger.getLogger(Bitstream.class); private static final Logger log = LogManager.getLogger();
@Column(name = "bitstream_id", insertable = false, updatable = false) @Column(name = "bitstream_id", insertable = false, updatable = false)
private Integer legacyId; private Integer legacyId;

View File

@@ -27,7 +27,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.content.comparator.NameAscendingComparator; import org.dspace.content.comparator.NameAscendingComparator;
import org.dspace.content.factory.ContentServiceFactory; import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService; import org.dspace.content.service.ItemService;
@@ -57,7 +58,7 @@ public class Item extends DSpaceObject implements DSpaceObjectLegacySupport {
/** /**
* log4j logger * log4j logger
*/ */
private static Logger log = Logger.getLogger(Item.class); private static final Logger log = LogManager.getLogger();
/** /**
* Wild card for Dublin Core metadata qualifiers/languages * Wild card for Dublin Core metadata qualifiers/languages

View File

@@ -10,7 +10,8 @@ package org.dspace.discovery;
import java.io.IOException; import java.io.IOException;
import org.apache.commons.validator.routines.UrlValidator; import org.apache.commons.validator.routines.UrlValidator;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrRequest;
@@ -28,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
*/ */
public class SolrSearchCore { public class SolrSearchCore {
private final Logger log = Logger.getLogger(SolrSearchCore.class); private final Logger log = LogManager.getLogger();
@Autowired @Autowired
protected IndexingService indexingService; protected IndexingService indexingService;
@Autowired @Autowired

View File

@@ -11,7 +11,7 @@ import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.apache.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.service.AuthorizeService; import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Collection; import org.dspace.content.Collection;
@@ -32,7 +32,8 @@ import org.springframework.beans.factory.annotation.Autowired;
*/ */
public class ExternalDataServiceImpl implements ExternalDataService { public class ExternalDataServiceImpl implements ExternalDataService {
private static final Logger log = Logger.getLogger(ExternalDataServiceImpl.class); private static final Logger log
= org.apache.logging.log4j.LogManager.getLogger();
@Autowired @Autowired
private List<ExternalDataProvider> externalDataProviders; private List<ExternalDataProvider> externalDataProviders;

View File

@@ -15,7 +15,7 @@ import static java.util.Calendar.DAY_OF_YEAR;
import static java.util.Collections.singletonList; import static java.util.Collections.singletonList;
import static org.apache.commons.cli.Option.builder; import static org.apache.commons.cli.Option.builder;
import static org.apache.commons.lang.time.DateFormatUtils.format; import static org.apache.commons.lang.time.DateFormatUtils.format;
import static org.apache.log4j.Logger.getLogger; import static org.apache.logging.log4j.LogManager.getLogger;
import static org.dspace.core.LogManager.getHeader; import static org.dspace.core.LogManager.getHeader;
import static org.dspace.statistics.SolrLoggerServiceImpl.DATE_FORMAT_8601; import static org.dspace.statistics.SolrLoggerServiceImpl.DATE_FORMAT_8601;
@@ -33,7 +33,7 @@ import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocument;
@@ -55,9 +55,9 @@ import org.dspace.statistics.service.SolrLoggerService;
*/ */
public class AnonymizeStatistics { public class AnonymizeStatistics {
private static Logger log = getLogger(AnonymizeStatistics.class); private static final Logger log = getLogger();
private static Context context = new Context(); private static final Context context = new Context();
private static String action = "anonymize_statistics"; private static final String action = "anonymize_statistics";
private static final String HELP_OPTION = "h"; private static final String HELP_OPTION = "h";
private static final String SLEEP_OPTION = "s"; private static final String SLEEP_OPTION = "s";
@@ -66,9 +66,9 @@ public class AnonymizeStatistics {
private static int sleep; private static int sleep;
private static SolrLoggerService solrLoggerService = private static final SolrLoggerService solrLoggerService =
StatisticsServiceFactory.getInstance().getSolrLoggerService(); StatisticsServiceFactory.getInstance().getSolrLoggerService();
private static ConfigurationService configurationService = private static final ConfigurationService configurationService =
DSpaceServicesFactory.getInstance().getConfigurationService(); DSpaceServicesFactory.getInstance().getConfigurationService();
private static int batchSize = 100; private static int batchSize = 100;

View File

@@ -9,7 +9,7 @@ package org.dspace.statistics.export;
import java.util.UUID; import java.util.UUID;
import org.apache.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dspace.content.Bitstream; import org.dspace.content.Bitstream;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -27,7 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
*/ */
public class IrusExportUsageEventListener extends AbstractUsageEventListener { public class IrusExportUsageEventListener extends AbstractUsageEventListener {
/* Log4j logger*/ /* Log4j logger*/
private static Logger log = Logger.getLogger(IrusExportUsageEventListener.class); private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
@Autowired @Autowired
ConfigurationService configurationService; ConfigurationService configurationService;
@@ -37,6 +37,7 @@ public class IrusExportUsageEventListener extends AbstractUsageEventListener {
* *
* @param event includes all the information related to the event that occurred * @param event includes all the information related to the event that occurred
*/ */
@Override
public void receiveEvent(Event event) { public void receiveEvent(Event event) {
if (configurationService.getBooleanProperty("irus.statistics.tracker.enabled", false)) { if (configurationService.getBooleanProperty("irus.statistics.tracker.enabled", false)) {
if (event instanceof UsageEvent) { if (event instanceof UsageEvent) {

View File

@@ -19,7 +19,8 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.CharEncoding; import org.apache.commons.codec.CharEncoding;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.content.DCDate; import org.dspace.content.DCDate;
import org.dspace.content.Entity; import org.dspace.content.Entity;
import org.dspace.content.EntityType; import org.dspace.content.EntityType;
@@ -41,7 +42,7 @@ import org.dspace.statistics.export.service.OpenUrlService;
*/ */
public abstract class ExportEventProcessor { public abstract class ExportEventProcessor {
private static Logger log = Logger.getLogger(ExportEventProcessor.class); private static final Logger log = LogManager.getLogger();
protected static final String ENTITY_TYPE_DEFAULT = "Publication"; protected static final String ENTITY_TYPE_DEFAULT = "Publication";
@@ -50,14 +51,17 @@ public abstract class ExportEventProcessor {
protected final static String UTF_8 = CharEncoding.UTF_8; protected final static String UTF_8 = CharEncoding.UTF_8;
private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); private final ConfigurationService configurationService
private EntityService entityService = ContentServiceFactory.getInstance().getEntityService(); = DSpaceServicesFactory.getInstance().getConfigurationService();
private ItemService itemService = ContentServiceFactory.getInstance().getItemService(); private final EntityService entityService
private OpenUrlService openUrlService = OpenURLTrackerLoggerServiceFactory.getInstance().getOpenUrlService(); = ContentServiceFactory.getInstance().getEntityService();
private final ItemService itemService
= ContentServiceFactory.getInstance().getItemService();
private final OpenUrlService openUrlService
= OpenURLTrackerLoggerServiceFactory.getInstance().getOpenUrlService();
private final Context context;
private Context context; private final HttpServletRequest request;
private HttpServletRequest request;
/** /**
* Creates a new ExportEventProcessor based on the params and initializes the services * Creates a new ExportEventProcessor based on the params and initializes the services

View File

@@ -16,7 +16,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.statistics.export.OpenURLTracker; import org.dspace.statistics.export.OpenURLTracker;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
*/ */
public class OpenUrlServiceImpl implements OpenUrlService { public class OpenUrlServiceImpl implements OpenUrlService {
private Logger log = Logger.getLogger(OpenUrlService.class); private final Logger log = LogManager.getLogger();
@Autowired @Autowired
protected FailedOpenURLTrackerService failedOpenUrlTrackerService; protected FailedOpenURLTrackerService failedOpenUrlTrackerService;
@@ -38,6 +39,7 @@ public class OpenUrlServiceImpl implements OpenUrlService {
* @param urlStr - the url to be processed * @param urlStr - the url to be processed
* @throws SQLException * @throws SQLException
*/ */
@Override
public void processUrl(Context c, String urlStr) throws SQLException { public void processUrl(Context c, String urlStr) throws SQLException {
log.debug("Prepared to send url to tracker URL: " + urlStr); log.debug("Prepared to send url to tracker URL: " + urlStr);
@@ -107,6 +109,7 @@ public class OpenUrlServiceImpl implements OpenUrlService {
* @param context * @param context
* @throws SQLException * @throws SQLException
*/ */
@Override
public void reprocessFailedQueue(Context context) throws SQLException { public void reprocessFailedQueue(Context context) throws SQLException {
if (failedOpenUrlTrackerService == null) { if (failedOpenUrlTrackerService == null) {
log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing"); log.error("Error retrieving the \"failedOpenUrlTrackerService\" instance, aborting the processing");
@@ -124,6 +127,7 @@ public class OpenUrlServiceImpl implements OpenUrlService {
* @param url * @param url
* @throws SQLException * @throws SQLException
*/ */
@Override
public void logfailed(Context context, String url) throws SQLException { public void logfailed(Context context, String url) throws SQLException {
Date now = new Date(); Date now = new Date();
if (StringUtils.isBlank(url)) { if (StringUtils.isBlank(url)) {

View File

@@ -7,7 +7,8 @@
*/ */
package org.dspace.submit.step; package org.dspace.submit.step;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/** /**
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it) * @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
@@ -16,7 +17,6 @@ public class ExtractionStep extends MetadataStep {
/** /**
* log4j logger * log4j logger
*/ */
private static Logger log = Logger private static final Logger log = LogManager.getLogger();
.getLogger(ExtractionStep.class);
} }

View File

@@ -21,7 +21,8 @@ import gr.ekt.bte.core.Record;
import gr.ekt.bte.core.Value; import gr.ekt.bte.core.Value;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpException; import org.apache.http.HttpException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.content.InProgressSubmission; import org.dspace.content.InProgressSubmission;
import org.dspace.content.Item; import org.dspace.content.Item;
@@ -41,14 +42,14 @@ public class MetadataStep extends AbstractProcessingStep {
/** /**
* log4j logger * log4j logger
*/ */
private static Logger log = Logger.getLogger(MetadataStep.class); private static final Logger log = LogManager.getLogger();
protected List<MetadataListener> listeners = DSpaceServicesFactory.getInstance().getServiceManager() protected List<MetadataListener> listeners = DSpaceServicesFactory.getInstance().getServiceManager()
.getServicesByType(MetadataListener.class); .getServicesByType(MetadataListener.class);
protected Map<String, List<MetadataValue>> metadataMap = new HashMap<String, List<MetadataValue>>(); protected Map<String, List<MetadataValue>> metadataMap = new HashMap<>();
private Map<String, Set<String>> results = new HashMap<String, Set<String>>(); private final Map<String, Set<String>> results = new HashMap<>();
private Map<String, String> mappingIdentifier = new HashMap<String, String>(); private final Map<String, String> mappingIdentifier = new HashMap<>();
@Override @Override
public void doPreProcessing(Context context, InProgressSubmission wsi) { public void doPreProcessing(Context context, InProgressSubmission wsi) {
@@ -60,7 +61,7 @@ public class MetadataStep extends AbstractProcessingStep {
if (mm != null && !mm.isEmpty()) { if (mm != null && !mm.isEmpty()) {
metadataMap.put(metadata, mm); metadataMap.put(metadata, mm);
} else { } else {
metadataMap.put(metadata, new ArrayList<MetadataValue>()); metadataMap.put(metadata, new ArrayList<>());
} }
mappingIdentifier.put(metadata, listener.getMetadata().get(metadata)); mappingIdentifier.put(metadata, listener.getMetadata().get(metadata));
} }
@@ -160,7 +161,7 @@ public class MetadataStep extends AbstractProcessingStep {
String key = mappingIdentifier.get(metadata); String key = mappingIdentifier.get(metadata);
Set<String> identifiers = null; Set<String> identifiers = null;
if (!results.containsKey(key)) { if (!results.containsKey(key)) {
identifiers = new HashSet<String>(); identifiers = new HashSet<>();
} else { } else {
identifiers = results.get(key); identifiers = results.get(key);
} }
@@ -169,7 +170,7 @@ public class MetadataStep extends AbstractProcessingStep {
} }
public List<Record> convertFields(List<Record> recordSet, Map<String, String> fieldMap) { public List<Record> convertFields(List<Record> recordSet, Map<String, String> fieldMap) {
List<Record> result = new ArrayList<Record>(); List<Record> result = new ArrayList<>();
for (Record publication : recordSet) { for (Record publication : recordSet) {
for (String fieldName : fieldMap.keySet()) { for (String fieldName : fieldMap.keySet()) {
String md = null; String md = null;

View File

@@ -21,7 +21,8 @@ import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.impl.HttpSolrClient;
@@ -51,19 +52,19 @@ import org.dspace.services.factory.DSpaceServicesFactory;
/** /**
* CLI tool to upgrade legacy id references in SOLR statistics to DSpace 6 UUID's. * CLI tool to upgrade legacy id references in SOLR statistics to DSpace 6 UUID's.
* *
* This command will need to be run iteratively over each statistics shard until all legacy id values have * This command will need to be run iteratively over each statistics shard until all legacy id values have
* been replaced. * been replaced.
* *
* If a legacy id cannot be resolved from the database, the id will remain unchanged. * If a legacy id cannot be resolved from the database, the id will remain unchanged.
* "field:* AND NOT(field:*-*)" can be used to locate legacy ids * "field:* AND NOT(field:*-*)" can be used to locate legacy ids
* *
* See DS-3602 for the origin of this issue. This code is targeted for inclusion in the DSpace 6.1 release. * See DS-3602 for the origin of this issue. This code is targeted for inclusion in the DSpace 6.1 release.
* *
* Recommendation: for a large repository, run this command with -Xmx2000m if possible. * Recommendation: for a large repository, run this command with -Xmx2000m if possible.
* *
* To process 1,000,000 statistics records, it took 60 min to complete. * To process 1,000,000 statistics records, it took 60 min to complete.
* *
* @author Terry Brady, Georgetown University Library * @author Terry Brady, Georgetown University Library
*/ */
@@ -109,7 +110,7 @@ public class SolrUpgradePre6xStatistics {
} }
//Logger //Logger
private static final Logger log = Logger.getLogger(SolrUpgradePre6xStatistics.class); private static final Logger log = LogManager.getLogger();
//DSpace Servcies //DSpace Servcies
private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
@@ -202,7 +203,7 @@ public class SolrUpgradePre6xStatistics {
/** /**
* Compute the time since the last batch was processed * Compute the time since the last batch was processed
* *
* @param fromStart * @param fromStart
* if true, report on processing time since the start of the program * if true, report on processing time since the start of the program
* @return the time in ms since the start time * @return the time in ms since the start time
@@ -223,9 +224,9 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Format ms count as h:mm:ss * Format ms count as h:mm:ss
* *
* @param dur Duration in ms * @param dur Duration in ms
* *
* @return duration formatted as h:mm:ss * @return duration formatted as h:mm:ss
*/ */
private String duration(long dur) { private String duration(long dur) {
@@ -238,7 +239,7 @@ public class SolrUpgradePre6xStatistics {
/** /**
* Print a status message appended with the processing time for the operation * Print a status message appended with the processing time for the operation
* *
* @param header * @param header
* Message to display * Message to display
* @param fromStart * @param fromStart
@@ -313,7 +314,7 @@ public class SolrUpgradePre6xStatistics {
/** /**
* Entry point for command-line invocation * Entry point for command-line invocation
* *
* @param args * @param args
* command-line arguments; see help for description * command-line arguments; see help for description
* @throws ParseException * @throws ParseException
@@ -437,7 +438,7 @@ public class SolrUpgradePre6xStatistics {
* Process records with a legacy id. From the command line, the user may specify * Process records with a legacy id. From the command line, the user may specify
* records of a specific type to update Otherwise, the following sequence will * records of a specific type to update Otherwise, the following sequence will
* be applied in order to optimize hibernate caching. * be applied in order to optimize hibernate caching.
* *
* Communities and Collections - retain in the cache since each is likely to be * Communities and Collections - retain in the cache since each is likely to be
* re-used Items - retain in the cache until a new item is processed Bitstreams * re-used Items - retain in the cache until a new item is processed Bitstreams
* - retain in the cache until a new bitstream is processed * - retain in the cache until a new bitstream is processed
@@ -462,12 +463,12 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Update records associated with a particular object id * Update records associated with a particular object id
* *
* @param query Query to retrieve all of the statistics records associated with * @param query Query to retrieve all of the statistics records associated with
* a particular object * a particular object
* *
* @param field Field to use for grouping records * @param field Field to use for grouping records
* *
* @return number of items processed. 0 indicates that no more work is available * @return number of items processed. 0 indicates that no more work is available
* (or the max processed has been reached). * (or the max processed has been reached).
*/ */
@@ -508,14 +509,14 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Map solr fields from legacy ids to UUIDs. * Map solr fields from legacy ids to UUIDs.
* *
* The id field is interpreted by the type field. The scopeId field is * The id field is interpreted by the type field. The scopeId field is
* interpreted by scopeType field. * interpreted by scopeType field.
* *
* Legacy ids will be unchanged if they cannot be mapped * Legacy ids will be unchanged if they cannot be mapped
* *
* @param input The SOLR statistics document to be updated * @param input The SOLR statistics document to be updated
* *
* @param col The SOLR field to update (if present) * @param col The SOLR field to update (if present)
*/ */
private void mapField(SolrInputDocument input, FIELD col) throws SQLException { private void mapField(SolrInputDocument input, FIELD col) throws SQLException {
@@ -581,7 +582,7 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Determine if the last processed item should be cleared from the hibernate * Determine if the last processed item should be cleared from the hibernate
* cache * cache
* *
* @param item Current item being processed * @param item Current item being processed
*/ */
private void checkLastItem(Item item) throws SQLException { private void checkLastItem(Item item) throws SQLException {
@@ -599,7 +600,7 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Determine if the last processed bitstream should be cleared from the * Determine if the last processed bitstream should be cleared from the
* hibernate cache * hibernate cache
* *
* @param bitstream Current bitstream being processed * @param bitstream Current bitstream being processed
*/ */
private void checkLastBitstream(Bitstream bitstream) throws SQLException { private void checkLastBitstream(Bitstream bitstream) throws SQLException {
@@ -617,9 +618,9 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Retrieve the UUID corresponding to a legacy id found in a SOLR statistics * Retrieve the UUID corresponding to a legacy id found in a SOLR statistics
* record * record
* *
* @param col Solr Statistic Field being processed * @param col Solr Statistic Field being processed
* *
* @param val Value to lookup as a legacy id * @param val Value to lookup as a legacy id
*/ */
private UUID mapId(FIELD col, int val) throws SQLException { private UUID mapId(FIELD col, int val) throws SQLException {
@@ -647,9 +648,9 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Retrieve the UUID corresponding to a legacy id found in a SOLR statistics * Retrieve the UUID corresponding to a legacy id found in a SOLR statistics
* record * record
* *
* @param type Identifying type field for id OR scopeType field for scopeId * @param type Identifying type field for id OR scopeType field for scopeId
* *
* @param val Value to lookup as a legacy id * @param val Value to lookup as a legacy id
*/ */
private UUID mapType(int type, int val) throws SQLException { private UUID mapType(int type, int val) throws SQLException {
@@ -679,9 +680,9 @@ public class SolrUpgradePre6xStatistics {
/* /*
* Retrieve the UUID corresponding to a legacy owner found in a SOLR statistics * Retrieve the UUID corresponding to a legacy owner found in a SOLR statistics
* record Legacy owner fields are prefixed in solr with "e" or "g" * record Legacy owner fields are prefixed in solr with "e" or "g"
* *
* @param owntype Identifying type field (e - eperson, g - group) * @param owntype Identifying type field (e - eperson, g - group)
* *
* @param val Value to lookup as a legacy id * @param val Value to lookup as a legacy id
*/ */
private UUID mapOwner(String owntype, int val) throws SQLException { private UUID mapOwner(String owntype, int val) throws SQLException {

View File

@@ -9,7 +9,8 @@ package org.dspace.builder;
import java.sql.SQLException; import java.sql.SQLException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.content.EntityType; import org.dspace.content.EntityType;
import org.dspace.content.service.EntityTypeService; import org.dspace.content.service.EntityTypeService;
@@ -19,7 +20,7 @@ import org.dspace.discovery.SearchServiceException;
public class EntityTypeBuilder extends AbstractBuilder<EntityType, EntityTypeService> { public class EntityTypeBuilder extends AbstractBuilder<EntityType, EntityTypeService> {
/* Log4j logger*/ /* Log4j logger*/
private static final Logger log = Logger.getLogger(EntityTypeBuilder.class); private static final Logger log = LogManager.getLogger();
private EntityType entityType; private EntityType entityType;

View File

@@ -10,7 +10,8 @@ package org.dspace.builder;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.Relationship; import org.dspace.content.Relationship;
@@ -22,7 +23,7 @@ import org.dspace.discovery.SearchServiceException;
public class RelationshipBuilder extends AbstractBuilder<Relationship, RelationshipService> { public class RelationshipBuilder extends AbstractBuilder<Relationship, RelationshipService> {
/* Log4j logger*/ /* Log4j logger*/
private static final Logger log = Logger.getLogger(RelationshipBuilder.class); private static final Logger log = LogManager.getLogger();
private Relationship relationship; private Relationship relationship;

View File

@@ -10,7 +10,8 @@ package org.dspace.builder;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.content.EntityType; import org.dspace.content.EntityType;
import org.dspace.content.Relationship; import org.dspace.content.Relationship;
@@ -22,7 +23,7 @@ import org.dspace.discovery.SearchServiceException;
public class RelationshipTypeBuilder extends AbstractBuilder<RelationshipType, RelationshipTypeService> { public class RelationshipTypeBuilder extends AbstractBuilder<RelationshipType, RelationshipTypeService> {
/* Log4j logger*/ /* Log4j logger*/
private static final Logger log = Logger.getLogger(RelationshipTypeBuilder.class); private static final Logger log = LogManager.getLogger();
private RelationshipType relationshipType; private RelationshipType relationshipType;

View File

@@ -11,7 +11,8 @@ import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.ResourcePolicy; import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.service.ResourcePolicyService; import org.dspace.authorize.service.ResourcePolicyService;
@@ -24,7 +25,7 @@ import org.dspace.eperson.Group;
public class ResourcePolicyBuilder extends AbstractBuilder<ResourcePolicy, ResourcePolicyService> { public class ResourcePolicyBuilder extends AbstractBuilder<ResourcePolicy, ResourcePolicyService> {
/* Log4j logger*/ /* Log4j logger*/
private static final Logger log = Logger.getLogger(ResourcePolicyBuilder.class); private static final Logger log = LogManager.getLogger();
private ResourcePolicy resourcePolicy; private ResourcePolicy resourcePolicy;

View File

@@ -24,7 +24,8 @@ import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.CharEncoding; import org.apache.commons.codec.CharEncoding;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.AbstractIntegrationTestWithDatabase; import org.dspace.AbstractIntegrationTestWithDatabase;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.builder.BitstreamBuilder; import org.dspace.builder.BitstreamBuilder;
@@ -65,7 +66,7 @@ import org.junit.Test;
//@RunWith(MockitoJUnitRunner.class) //@RunWith(MockitoJUnitRunner.class)
public class ITIrusExportUsageEventListener extends AbstractIntegrationTestWithDatabase { public class ITIrusExportUsageEventListener extends AbstractIntegrationTestWithDatabase {
private static Logger log = Logger.getLogger(ITIrusExportUsageEventListener.class); private static final Logger log = LogManager.getLogger();
protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService(); protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();

View File

@@ -13,7 +13,8 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.AbstractIntegrationTest; import org.dspace.AbstractIntegrationTest;
import org.dspace.app.scripts.handler.impl.TestDSpaceRunnableHandler; import org.dspace.app.scripts.handler.impl.TestDSpaceRunnableHandler;
import org.dspace.scripts.DSpaceRunnable; import org.dspace.scripts.DSpaceRunnable;
@@ -31,7 +32,7 @@ import org.junit.Test;
*/ */
public class ITRetryFailedOpenUrlTracker extends AbstractIntegrationTest { public class ITRetryFailedOpenUrlTracker extends AbstractIntegrationTest {
private static Logger log = Logger.getLogger(ITRetryFailedOpenUrlTracker.class); private static final Logger log = LogManager.getLogger();
protected FailedOpenURLTrackerService failedOpenURLTrackerService = protected FailedOpenURLTrackerService failedOpenURLTrackerService =
@@ -41,8 +42,8 @@ public class ITRetryFailedOpenUrlTracker extends AbstractIntegrationTest {
.getServiceByName("testProcessedUrls", .getServiceByName("testProcessedUrls",
ArrayList.class); ArrayList.class);
private ScriptService scriptService = ScriptServiceFactory.getInstance().getScriptService(); private final ScriptService scriptService
= ScriptServiceFactory.getInstance().getScriptService();
/** /**
* Clean up the logged entries from the db after each test * Clean up the logged entries from the db after each test

View File

@@ -16,7 +16,8 @@ import java.util.Arrays;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.atteo.evo.inflector.English; import org.atteo.evo.inflector.English;
import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ConverterService;
import org.dspace.app.rest.model.DSpaceObjectRest; import org.dspace.app.rest.model.DSpaceObjectRest;
@@ -49,8 +50,7 @@ public class IdentifierRestController implements InitializingBean {
public static final String PARAM = "id"; public static final String PARAM = "id";
private static final Logger log = private static final Logger log = LogManager.getLogger();
Logger.getLogger(IdentifierRestController.class);
@Autowired @Autowired
private ConverterService converter; private ConverterService converter;

View File

@@ -17,7 +17,8 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.exception.MethodNotAllowedException; import org.dspace.app.rest.exception.MethodNotAllowedException;
import org.dspace.app.rest.exception.UnprocessableEntityException; import org.dspace.app.rest.exception.UnprocessableEntityException;
import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ContextUtil;
@@ -45,7 +46,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/core/items" + REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID + "/mappedCollections") @RequestMapping("/api/core/items" + REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID + "/mappedCollections")
public class MappedCollectionRestController { public class MappedCollectionRestController {
private static final Logger log = Logger.getLogger(MappedCollectionRestController.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
private ItemService itemService; private ItemService itemService;

View File

@@ -21,9 +21,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.apache.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ContextUtil;
import org.dspace.app.rest.utils.ScopeResolver;
import org.dspace.app.util.SyndicationFeed; import org.dspace.app.util.SyndicationFeed;
import org.dspace.app.util.factory.UtilServiceFactory; import org.dspace.app.util.factory.UtilServiceFactory;
import org.dspace.app.util.service.OpenSearchService; import org.dspace.app.util.service.OpenSearchService;
@@ -59,7 +58,7 @@ import org.w3c.dom.Document;
@RequestMapping("/opensearch") @RequestMapping("/opensearch")
public class OpenSearchController { public class OpenSearchController {
private static final Logger log = Logger.getLogger(ScopeResolver.class); private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
private static final String errorpath = "/error"; private static final String errorpath = "/error";
private List<String> searchIndices = null; private List<String> searchIndices = null;

View File

@@ -17,7 +17,8 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ConverterService;
import org.dspace.app.rest.model.DSpaceObjectRest; import org.dspace.app.rest.model.DSpaceObjectRest;
import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ContextUtil;
@@ -59,8 +60,7 @@ public class UUIDLookupRestController implements InitializingBean {
@Autowired @Autowired
private Utils utils; private Utils utils;
private static final Logger log = private static final Logger log = LogManager.getLogger();
Logger.getLogger(UUIDLookupRestController.class);
@Autowired @Autowired
private DiscoverableEndpointsService discoverableEndpointsService; private DiscoverableEndpointsService discoverableEndpointsService;

View File

@@ -9,7 +9,8 @@ package org.dspace.app.rest.authorization.impl;
import java.sql.SQLException; import java.sql.SQLException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.authorization.AuthorizationFeature; import org.dspace.app.rest.authorization.AuthorizationFeature;
import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation; import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation;
import org.dspace.app.rest.authorization.AuthorizeServiceRestUtil; import org.dspace.app.rest.authorization.AuthorizeServiceRestUtil;
@@ -37,7 +38,7 @@ import org.springframework.stereotype.Component;
description = "It can be used to verify if bitstreams can be created in a specific bundle") description = "It can be used to verify if bitstreams can be created in a specific bundle")
public class CreateBitstreamFeature implements AuthorizationFeature { public class CreateBitstreamFeature implements AuthorizationFeature {
Logger log = Logger.getLogger(CreateBitstreamFeature.class); Logger log = LogManager.getLogger();
public final static String NAME = "canCreateBitstream"; public final static String NAME = "canCreateBitstream";

View File

@@ -9,7 +9,8 @@ package org.dspace.app.rest.authorization.impl;
import java.sql.SQLException; import java.sql.SQLException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.authorization.AuthorizationFeature; import org.dspace.app.rest.authorization.AuthorizationFeature;
import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation; import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation;
import org.dspace.app.rest.authorization.AuthorizeServiceRestUtil; import org.dspace.app.rest.authorization.AuthorizeServiceRestUtil;
@@ -38,7 +39,7 @@ import org.springframework.stereotype.Component;
description = "It can be used to verify if an item can be moved to a different collection") description = "It can be used to verify if an item can be moved to a different collection")
public class MoveFeature implements AuthorizationFeature { public class MoveFeature implements AuthorizationFeature {
Logger log = Logger.getLogger(MoveFeature.class); Logger log = LogManager.getLogger();
public final static String NAME = "canMove"; public final static String NAME = "canMove";

View File

@@ -12,7 +12,8 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.authorization.AuthorizationFeature; import org.dspace.app.rest.authorization.AuthorizationFeature;
import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation; import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation;
import org.dspace.app.rest.model.BaseObjectRest; import org.dspace.app.rest.model.BaseObjectRest;
@@ -37,7 +38,7 @@ import org.springframework.stereotype.Component;
* in an item. * in an item.
* *
* Authorization is granted for a bitstream if the user has no access to the bitstream * Authorization is granted for a bitstream if the user has no access to the bitstream
* and the bistream is part of an archived item. * and the bitstream is part of an archived item.
* Authorization is granted for an item if the user has no access to a bitstream in the item, and the item is archived. * Authorization is granted for an item if the user has no access to a bitstream in the item, and the item is archived.
*/ */
@Component @Component
@@ -45,7 +46,7 @@ import org.springframework.stereotype.Component;
description = "It can be used to verify if the user can request a copy of a bitstream") description = "It can be used to verify if the user can request a copy of a bitstream")
public class RequestCopyFeature implements AuthorizationFeature { public class RequestCopyFeature implements AuthorizationFeature {
Logger log = Logger.getLogger(RequestCopyFeature.class); Logger log = LogManager.getLogger();
public final static String NAME = "canRequestACopy"; public final static String NAME = "canRequestACopy";

View File

@@ -20,7 +20,8 @@ import javax.annotation.Nullable;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.link.HalLinkFactory; import org.dspace.app.rest.link.HalLinkFactory;
import org.dspace.app.rest.link.HalLinkService; import org.dspace.app.rest.link.HalLinkService;
import org.dspace.app.rest.model.BaseObjectRest; import org.dspace.app.rest.model.BaseObjectRest;
@@ -52,13 +53,13 @@ import org.springframework.stereotype.Service;
/** /**
* Converts domain objects from the DSpace service layer to rest objects, and from rest objects to resource * Converts domain objects from the DSpace service layer to rest objects, and from rest objects to resource
* objects, applying {@link Projection}s where applicable. * objects, applying {@link Projection}s where applicable.
* *
* @author Luca Giamminonni (luca.giamminonni at 4science dot it) * @author Luca Giamminonni (luca.giamminonni at 4science dot it)
*/ */
@Service @Service
public class ConverterService { public class ConverterService {
private static final Logger log = Logger.getLogger(ConverterService.class); private static final Logger log = LogManager.getLogger();
private final Map<String, Projection> projectionMap = new HashMap<>(); private final Map<String, Projection> projectionMap = new HashMap<>();

View File

@@ -11,7 +11,8 @@ import java.util.List;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.model.SearchFacetEntryRest; import org.dspace.app.rest.model.SearchFacetEntryRest;
import org.dspace.app.rest.model.SearchFacetValueRest; import org.dspace.app.rest.model.SearchFacetValueRest;
import org.dspace.app.rest.model.SearchResultsRest; import org.dspace.app.rest.model.SearchResultsRest;
@@ -31,9 +32,9 @@ import org.springframework.stereotype.Component;
@Component @Component
public class DiscoverFacetsConverter { public class DiscoverFacetsConverter {
private static final Logger log = Logger.getLogger(DiscoverFacetsConverter.class); private static final Logger log = LogManager.getLogger(DiscoverFacetsConverter.class);
private DiscoverFacetValueConverter facetValueConverter = new DiscoverFacetValueConverter(); private final DiscoverFacetValueConverter facetValueConverter = new DiscoverFacetValueConverter();
@Autowired @Autowired
private SearchService searchService; private SearchService searchService;
@@ -56,7 +57,7 @@ public class DiscoverFacetsConverter {
/** /**
* Fill the facet values information in the SearchResultsRest using the information in the api DiscoverResult object * Fill the facet values information in the SearchResultsRest using the information in the api DiscoverResult object
* according to the configuration applied to the discovery query * according to the configuration applied to the discovery query
* *
* @param context * @param context
* The relevant DSpace context * The relevant DSpace context
* @param searchResult * @param searchResult
@@ -104,7 +105,7 @@ public class DiscoverFacetsConverter {
/** /**
* This method will fill the facetEntry with the appropriate min and max values if they're not empty * This method will fill the facetEntry with the appropriate min and max values if they're not empty
* *
* @param context * @param context
* The relevant DSpace context * The relevant DSpace context
* @param field * @param field

View File

@@ -12,7 +12,8 @@ import java.util.Map;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.converter.query.SearchQueryConverter; import org.dspace.app.rest.converter.query.SearchQueryConverter;
import org.dspace.app.rest.model.RestAddressableModel; import org.dspace.app.rest.model.RestAddressableModel;
import org.dspace.app.rest.model.SearchResultEntryRest; import org.dspace.app.rest.model.SearchResultEntryRest;
@@ -34,7 +35,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class DiscoverResultConverter { public class DiscoverResultConverter {
private static final Logger log = Logger.getLogger(DiscoverResultConverter.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
private List<IndexableObjectConverter> converters; private List<IndexableObjectConverter> converters;

View File

@@ -9,7 +9,8 @@ package org.dspace.app.rest.converter;
import java.sql.SQLException; import java.sql.SQLException;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.model.VersionRest; import org.dspace.app.rest.model.VersionRest;
import org.dspace.app.rest.projection.Projection; import org.dspace.app.rest.projection.Projection;
import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ContextUtil;
@@ -29,7 +30,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class VersionConverter implements DSpaceConverter<Version, VersionRest> { public class VersionConverter implements DSpaceConverter<Version, VersionRest> {
private static final Logger log = Logger.getLogger(VersionConverter.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
private AuthorizeService authorizeService; private AuthorizeService authorizeService;

View File

@@ -16,7 +16,8 @@ import javax.mail.MessagingException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.DiscoverableEndpointsService; import org.dspace.app.rest.DiscoverableEndpointsService;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
@@ -67,7 +68,7 @@ import org.springframework.stereotype.Component;
public class ClaimedTaskRestRepository extends DSpaceRestRepository<ClaimedTaskRest, Integer> public class ClaimedTaskRestRepository extends DSpaceRestRepository<ClaimedTaskRest, Integer>
implements InitializingBean { implements InitializingBean {
private static final Logger log = Logger.getLogger(ClaimedTaskRestRepository.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
ItemService itemService; ItemService itemService;
@@ -231,7 +232,7 @@ public class ClaimedTaskRestRepository extends DSpaceRestRepository<ClaimedTaskR
/** /**
* This method delete only the claimed task. The workflow engine will return it to the pool if there are not * This method delete only the claimed task. The workflow engine will return it to the pool if there are not
* enough other claimed tasks for the same workflowitem. * enough other claimed tasks for the same workflowitem.
* *
*/ */
@PreAuthorize("hasPermission(#id, 'CLAIMEDTASK', 'DELETE')") @PreAuthorize("hasPermission(#id, 'CLAIMEDTASK', 'DELETE')")
protected void delete(Context context, Integer id) { protected void delete(Context context, Integer id) {
@@ -251,6 +252,7 @@ public class ClaimedTaskRestRepository extends DSpaceRestRepository<ClaimedTaskR
} }
} }
@Override
public Page<ClaimedTaskRest> findAll(Context context, Pageable pageable) { public Page<ClaimedTaskRest> findAll(Context context, Pageable pageable) {
throw new RepositoryMethodNotImplementedException(ClaimedTaskRest.NAME, "findAll"); throw new RepositoryMethodNotImplementedException(ClaimedTaskRest.NAME, "findAll");
} }

View File

@@ -16,7 +16,8 @@ import javax.servlet.http.HttpServletRequest;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.DiscoverableEndpointsService; import org.dspace.app.rest.DiscoverableEndpointsService;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
@@ -61,7 +62,7 @@ import org.springframework.stereotype.Component;
public class EPersonRestRepository extends DSpaceObjectRestRepository<EPerson, EPersonRest> public class EPersonRestRepository extends DSpaceObjectRestRepository<EPerson, EPersonRest>
implements InitializingBean { implements InitializingBean {
private static final Logger log = Logger.getLogger(EPersonRestRepository.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
AuthorizeService authorizeService; AuthorizeService authorizeService;

View File

@@ -20,7 +20,8 @@ import javax.servlet.http.HttpServletRequest;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.converter.MetadataConverter; import org.dspace.app.rest.converter.MetadataConverter;
import org.dspace.app.rest.exception.DSpaceBadRequestException; import org.dspace.app.rest.exception.DSpaceBadRequestException;
import org.dspace.app.rest.exception.RepositoryMethodNotImplementedException; import org.dspace.app.rest.exception.RepositoryMethodNotImplementedException;
@@ -61,7 +62,7 @@ import org.springframework.stereotype.Component;
@Component(ItemRest.CATEGORY + "." + ItemRest.NAME) @Component(ItemRest.CATEGORY + "." + ItemRest.NAME)
public class ItemRestRepository extends DSpaceObjectRestRepository<Item, ItemRest> { public class ItemRestRepository extends DSpaceObjectRestRepository<Item, ItemRest> {
private static final Logger log = Logger.getLogger(ItemRestRepository.class); private static final Logger log = LogManager.getLogger(ItemRestRepository.class);
public static final String[] COPYVIRTUAL_ALL = {"all"}; public static final String[] COPYVIRTUAL_ALL = {"all"};
public static final String[] COPYVIRTUAL_CONFIGURED = {"configured"}; public static final String[] COPYVIRTUAL_CONFIGURED = {"configured"};

View File

@@ -13,7 +13,8 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.DiscoverableEndpointsService; import org.dspace.app.rest.DiscoverableEndpointsService;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
@@ -51,7 +52,7 @@ import org.springframework.stereotype.Component;
public class PoolTaskRestRepository extends DSpaceRestRepository<PoolTaskRest, Integer> public class PoolTaskRestRepository extends DSpaceRestRepository<PoolTaskRest, Integer>
implements InitializingBean { implements InitializingBean {
private static final Logger log = Logger.getLogger(PoolTaskRestRepository.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
ItemService itemService; ItemService itemService;

View File

@@ -15,7 +15,8 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
import org.dspace.app.rest.converter.ConverterService; import org.dspace.app.rest.converter.ConverterService;
@@ -49,7 +50,7 @@ import org.springframework.stereotype.Component;
@Component(ProcessRest.CATEGORY + "." + ProcessRest.NAME) @Component(ProcessRest.CATEGORY + "." + ProcessRest.NAME)
public class ProcessRestRepository extends DSpaceRestRepository<ProcessRest, Integer> { public class ProcessRestRepository extends DSpaceRestRepository<ProcessRest, Integer> {
private static final Logger log = Logger.getLogger(ProcessRestRepository.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
private ProcessService processService; private ProcessService processService;

View File

@@ -16,7 +16,8 @@ import javax.servlet.http.HttpServletRequest;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
import org.dspace.app.rest.exception.RepositoryMethodNotImplementedException; import org.dspace.app.rest.exception.RepositoryMethodNotImplementedException;
@@ -49,7 +50,7 @@ import org.springframework.stereotype.Component;
@Component(RelationshipRest.CATEGORY + "." + RelationshipRest.NAME) @Component(RelationshipRest.CATEGORY + "." + RelationshipRest.NAME)
public class RelationshipRestRepository extends DSpaceRestRepository<RelationshipRest, Integer> { public class RelationshipRestRepository extends DSpaceRestRepository<RelationshipRest, Integer> {
private static final Logger log = Logger.getLogger(RelationshipRestRepository.class); private static final Logger log = LogManager.getLogger();
private static final String ALL = "all"; private static final String ALL = "all";
private static final String LEFT = "left"; private static final String LEFT = "left";

View File

@@ -16,7 +16,8 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
import org.dspace.app.rest.exception.DSpaceBadRequestException; import org.dspace.app.rest.exception.DSpaceBadRequestException;
@@ -75,7 +76,7 @@ public class WorkflowItemRestRepository extends DSpaceRestRepository<WorkflowIte
public static final String OPERATION_PATH_SECTIONS = "sections"; public static final String OPERATION_PATH_SECTIONS = "sections";
private static final Logger log = Logger.getLogger(WorkflowItemRestRepository.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
XmlWorkflowItemService wis; XmlWorkflowItemService wis;
@@ -202,7 +203,7 @@ public class WorkflowItemRestRepository extends DSpaceRestRepository<WorkflowIte
this.checkIfEditMetadataAllowedInCurrentStep(context, source); this.checkIfEditMetadataAllowedInCurrentStep(context, source);
List<ErrorRest> errors = new ArrayList<ErrorRest>(); List<ErrorRest> errors = new ArrayList<>();
SubmissionConfig submissionConfig = SubmissionConfig submissionConfig =
submissionConfigReader.getSubmissionConfigByName(wsi.getSubmissionDefinition().getName()); submissionConfigReader.getSubmissionConfigByName(wsi.getSubmissionDefinition().getName());
for (int i = 0; i < submissionConfig.getNumberOfSteps(); i++) { for (int i = 0; i < submissionConfig.getNumberOfSteps(); i++) {

View File

@@ -15,7 +15,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.utils.ContextUtil; import org.dspace.app.rest.utils.ContextUtil;
import org.dspace.authenticate.service.AuthenticationService; import org.dspace.authenticate.service.AuthenticationService;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -34,9 +35,9 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
*/ */
public class AnonymousAdditionalAuthorizationFilter extends BasicAuthenticationFilter { public class AnonymousAdditionalAuthorizationFilter extends BasicAuthenticationFilter {
private static final Logger log = Logger.getLogger(AnonymousAdditionalAuthorizationFilter.class); private static final Logger log = LogManager.getLogger();
private AuthenticationService authenticationService; private final AuthenticationService authenticationService;
/** /**
* Constructor for the class * Constructor for the class

View File

@@ -10,7 +10,8 @@ package org.dspace.app.rest.submit.step.validation;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.model.ErrorRest; import org.dspace.app.rest.model.ErrorRest;
import org.dspace.app.rest.repository.WorkspaceItemRestRepository; import org.dspace.app.rest.repository.WorkspaceItemRestRepository;
import org.dspace.app.rest.submit.SubmissionService; import org.dspace.app.rest.submit.SubmissionService;
@@ -32,7 +33,7 @@ public class LicenseValidation extends AbstractValidation {
private static final String ERROR_VALIDATION_LICENSEREQUIRED = "error.validation.license.notgranted"; private static final String ERROR_VALIDATION_LICENSEREQUIRED = "error.validation.license.notgranted";
private static final Logger log = Logger.getLogger(LicenseValidation.class); private static final Logger log = LogManager.getLogger();
@Autowired @Autowired
private BitstreamService bitstreamService; private BitstreamService bitstreamService;

View File

@@ -12,7 +12,8 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.Parameter; import org.dspace.app.rest.Parameter;
import org.dspace.app.rest.SearchRestMethod; import org.dspace.app.rest.SearchRestMethod;
import org.dspace.app.rest.exception.MissingParameterException; import org.dspace.app.rest.exception.MissingParameterException;
@@ -49,7 +50,7 @@ public class RestRepositoryUtils {
private static final String NAME_NOT_FOUND = "Unable to detect parameter names for query method %s! Use @Param or" + private static final String NAME_NOT_FOUND = "Unable to detect parameter names for query method %s! Use @Param or" +
" compile with -parameters on JDK 8."; " compile with -parameters on JDK 8.";
private static final Logger log = Logger.getLogger(RestRepositoryUtils.class); private static final Logger log = LogManager.getLogger();
@Autowired(required = true) @Autowired(required = true)
@Qualifier(value = "mvcConversionService") @Qualifier(value = "mvcConversionService")
@@ -78,7 +79,7 @@ public class RestRepositoryUtils {
* @return the names of the search methods if any. Otherwise an empty list * @return the names of the search methods if any. Otherwise an empty list
*/ */
public List<String> listSearchMethods(DSpaceRestRepository repository) { public List<String> listSearchMethods(DSpaceRestRepository repository) {
List<String> searchMethods = new LinkedList<String>(); List<String> searchMethods = new LinkedList<>();
for (Method method : repository.getClass().getMethods()) { for (Method method : repository.getClass().getMethods()) {
// We need to use AnnotationUtils because the DSpaceRestRepository is possibly enhanced by a Spring AOP // We need to use AnnotationUtils because the DSpaceRestRepository is possibly enhanced by a Spring AOP
// proxy. The regular "method.getAnnotation()" method would then search the proxy instead of the // proxy. The regular "method.getAnnotation()" method would then search the proxy instead of the
@@ -136,7 +137,7 @@ public class RestRepositoryUtils {
public Object executeQueryMethod(DSpaceRestRepository repository, MultiValueMap<String, Object> parameters, public Object executeQueryMethod(DSpaceRestRepository repository, MultiValueMap<String, Object> parameters,
Method method, Pageable pageable, Sort sort, PagedResourcesAssembler assembler) { Method method, Pageable pageable, Sort sort, PagedResourcesAssembler assembler) {
MultiValueMap<String, Object> result = new LinkedMultiValueMap<String, Object>(parameters); MultiValueMap<String, Object> result = new LinkedMultiValueMap<>(parameters);
MethodParameters methodParameters = new MethodParameters(method, PARAM_ANNOTATION); MethodParameters methodParameters = new MethodParameters(method, PARAM_ANNOTATION);
for (MethodParameter parameter : methodParameters.getParameters()) { for (MethodParameter parameter : methodParameters.getParameters()) {

15
pom.xml
View File

@@ -116,6 +116,21 @@
</rules> </rules>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>ban-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>log4j:log4j</exclude>
</excludes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>
<!-- Used to compile all Java classes --> <!-- Used to compile all Java classes -->