From 0b15664f1c667c6bab69d44ffa6f5cf966ae38cf Mon Sep 17 00:00:00 2001 From: Daniel Trebbien Date: Sun, 30 Jul 2017 13:26:05 -0700 Subject: [PATCH] Utilize parameterized logging and remove toString() calls As suggested in the SLF4J FAQ: https://www.slf4j.org/faq.html#logging_performance .. parameterized logging can improve the efficiency of logger calls when logging at the specified level is disabled. In addition, per the FAQ: https://www.slf4j.org/faq.html#paramException since SLF4J 1.6.0 it is possible to use parameterized logging and also log an exception/throwable. toString() is called automatically: https://www.slf4j.org/faq.html#string_contents These changes were suggested by SLF4J Helper for NetBeans IDE: http://plugins.netbeans.org/plugin/72557/ --- .../DefaultArchivaConfiguration.java | 2 +- .../AbstractRepositoryPurgeTest.java | 2 +- .../lucene/NexusIndexerConsumer.java | 2 +- .../filelock/DefaultFileLockManagerTest.java | 20 +++++++++---------- .../DefaultFileLockManagerTimeoutTest.java | 4 ++-- .../DefaultRepositoryProxyConnectors.java | 11 +++++----- .../AbstractRepositoryAdminTest.java | 4 ++-- .../functors/ConsumerProcessFileClosure.java | 4 ++-- .../indexing/ArchivaIndexingTaskExecutor.java | 6 +++--- .../rest/services/DefaultCommonServices.java | 2 +- .../rest/services/DefaultPluginsServices.java | 2 +- .../services/DefaultRepositoriesService.java | 18 ++++++++--------- .../web/api/DefaultFileUploadService.java | 4 ++-- .../ldap/ArchivaLdapConnectionFactory.java | 2 +- .../ArchivaUserManagerAuthenticator.java | 2 +- .../web/startup/SecuritySynchronization.java | 2 +- .../archiva/webdav/ArchivaDavResource.java | 4 ++-- .../apache/archiva/webdav/util/MimeTypes.java | 4 ++-- .../archiva/audit/DefaultAuditManager.java | 2 +- .../DefaultCassandraArchivaManager.java | 2 +- .../file/FileMetadataRepository.java | 2 +- .../repository/jcr/JcrMetadataRepository.java | 4 ++-- .../DefaultRepositoryStatisticsManager.java | 2 +- 23 files changed, 53 insertions(+), 54 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index 45477877f..f8aea6e7a 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -703,7 +703,7 @@ public class DefaultArchivaConfiguration } catch ( IOException e ) { - log.error( "Unable to create " + filetype + " file: " + e.getMessage(), e ); + log.error( "Unable to create {} file: {}", filetype, e.getMessage(), e ); return false; } } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index 9412ac73c..1a997eea7 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -144,7 +144,7 @@ public abstract class AbstractRepositoryPurgeTest if ( path.contains( " " ) ) { LoggerFactory.getLogger( AbstractRepositoryPurgeTest.class.getName() ).error( - "You are building and testing with a path: \n " + path + " containing space. Consider relocating." ); + "You are building and testing with a path: \n {} containing space. Consider relocating.", path ); return path.replaceAll( " ", "&20" ); } return path; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java index aa999bd6f..66f067f34 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java @@ -219,7 +219,7 @@ public class NexusIndexerConsumer } catch ( TaskQueueException e ) { - log.error( "Error queueing task: " + task + ": " + e.getMessage(), e ); + log.error( "Error queueing task: {}: {}", task, e.getMessage(), e ); } } diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java index af189ba49..adcdbc7a8 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java @@ -112,7 +112,7 @@ public class DefaultFileLockManagerTest { logger.info("thread1 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -132,7 +132,7 @@ public class DefaultFileLockManagerTest { logger.info("thread2 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -156,7 +156,7 @@ public class DefaultFileLockManagerTest { logger.info("thread3 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -177,7 +177,7 @@ public class DefaultFileLockManagerTest { logger.info("thread4 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -198,7 +198,7 @@ public class DefaultFileLockManagerTest { logger.info("thread5 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -221,7 +221,7 @@ public class DefaultFileLockManagerTest { logger.info("thread6 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -242,7 +242,7 @@ public class DefaultFileLockManagerTest { logger.info("thread7 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -265,7 +265,7 @@ public class DefaultFileLockManagerTest { logger.info("thread8 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -286,7 +286,7 @@ public class DefaultFileLockManagerTest { logger.info("thread9 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -308,7 +308,7 @@ public class DefaultFileLockManagerTest { logger.info("thread10 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java index 666efee18..514dfde02 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java @@ -76,14 +76,14 @@ public class DefaultFileLockManagerTimeoutTest try { Files.copy(largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { - logger.warn("Copy failed "+e.getMessage()); + logger.warn("Copy failed {}", e.getMessage()); // On windows a FileSystemException is thrown // We ignore this } lock = fileLockManager.writeFileLock(file); } catch (FileSystemException ex) { - logger.error("Exception from filesystem "+ex.getMessage()); + logger.error("Exception from filesystem {}", ex.getMessage()); ex.printStackTrace(); throw ex; } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java index 5d6087415..1397c7eb5 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -428,10 +428,9 @@ public class DefaultRepositoryProxyConnectors "Transfer error from repository {} for resource {}, continuing to next repository. Error message: {}", targetRepository.getRepository().getId(), path, e.getMessage() ); log.debug( MarkerFactory.getDetachedMarker( "transfer.error" ), - "Transfer error from repository \"" + targetRepository.getRepository().getId() - + "\" for resource " + path + ", continuing to next repository. Error message: {}", - e.getMessage(), e - ); + "Transfer error from repository \"{}" + + "\" for resource {}, continuing to next repository. Error message: {}", + targetRepository.getRepository().getId(), path, e.getMessage(), e ); } catch ( RepositoryAdminException e ) { @@ -830,8 +829,8 @@ public class DefaultRepositoryProxyConnectors } catch ( TaskQueueException e ) { - log.error( "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName() - + "']." ); + log.error( "Unable to queue repository task to execute consumers on resource file ['{}" + + "'].", localFile.getName() ); } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java index 96d217d59..bfaa9c691 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java @@ -89,8 +89,8 @@ public abstract class AbstractRepositoryAdminTest if ( path.contains( SPACE ) ) { LoggerFactory.getLogger( AbstractRepositoryAdminTest.class.getName() ).error( - "You are building and testing with {appserver.base}: \n " + path - + " containing space. Consider relocating." ); + "You are building and testing with {appserver.base}: \n {}" + + " containing space. Consider relocating.", path ); } return path.replaceAll( SPACE, "&20" ); } diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java index ca44dd9ba..85375bc00 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java @@ -77,8 +77,8 @@ public class ConsumerProcessFileClosure /* Intentionally Catch all exceptions. * So that the discoverer processing can continue. */ - log.error( "Consumer [" + id + "] had an error when processing file [" - + basefile.getAbsolutePath() + "]: " + e.getMessage(), e ); + log.error( "Consumer [{}] had an error when processing file [" + + "{}]: {}", id, basefile.getAbsolutePath(), e.getMessage(), e ); } } } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java index 71fb58460..1509bef12 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java @@ -135,7 +135,7 @@ public class ArchivaIndexingTaskExecutor } catch ( RepositoryAdminException e ) { - log.error( "Error occurred while creating context: " + e.getMessage() ); + log.error( "Error occurred while creating context: {}", e.getMessage() ); throw new TaskExecutionException( "Error occurred while creating context: " + e.getMessage(), e ); } } @@ -227,7 +227,7 @@ public class ArchivaIndexingTaskExecutor } catch ( IOException e ) { - log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage(), + log.error( "Error occurred while executing indexing task '{}': {}", indexingTask, e.getMessage(), e ); throw new TaskExecutionException( "Error occurred while executing indexing task '" + indexingTask + "'", e ); @@ -261,7 +261,7 @@ public class ArchivaIndexingTaskExecutor } catch ( IOException e ) { - log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage() ); + log.error( "Error occurred while executing indexing task '{}': {}", indexingTask, e.getMessage() ); throw new TaskExecutionException( "Error occurred while executing indexing task '" + indexingTask + "'", e ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java index b7cb60d34..180cee747 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java @@ -83,7 +83,7 @@ public class DefaultCommonServices } catch ( IOException e ) { - log.warn( "skip error loading properties {}", resourceName.toString() ); + log.warn( "skip error loading properties {}", resourceName ); } return fromProperties( properties ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java index 208400c83..d6f190819 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -72,7 +72,7 @@ public class DefaultPluginsServices { sb.append( repoType ).append( "|" ); } - log.debug( "getAdminPlugins: {}", sb.toString() ); + log.debug( "getAdminPlugins: {}", sb ); if ( sb.length() > 1 ) { adminPlugins = sb.substring( 0, sb.length() - 1 ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java index e0660c269..a5f6844ca 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java @@ -352,7 +352,7 @@ public class DefaultRepositoriesService } catch ( AuthorizationException e ) { - log.error( "error reading permission: " + e.getMessage(), e ); + log.error( "error reading permission: {}", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } @@ -370,7 +370,7 @@ public class DefaultRepositoriesService } catch ( AuthorizationException e ) { - log.error( "error reading permission: " + e.getMessage(), e ); + log.error( "error reading permission: {}", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } @@ -394,7 +394,7 @@ public class DefaultRepositoriesService if ( StringUtils.isEmpty( artifactSourcePath ) ) { - log.error( "cannot find artifact " + artifactTransferRequest.toString() ); + log.error( "cannot find artifact {}", artifactTransferRequest ); throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString(), null ); } @@ -403,7 +403,7 @@ public class DefaultRepositoriesService if ( !artifactFile.exists() ) { - log.error( "cannot find artifact " + artifactTransferRequest.toString() ); + log.error( "cannot find artifact {}", artifactTransferRequest ); throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString(), null ); } @@ -487,17 +487,17 @@ public class DefaultRepositoriesService } catch ( RepositoryException e ) { - log.error( "RepositoryException: " + e.getMessage(), e ); + log.error( "RepositoryException: {}", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } catch ( RepositoryAdminException e ) { - log.error( "RepositoryAdminException: " + e.getMessage(), e ); + log.error( "RepositoryAdminException: {}", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } catch ( IOException e ) { - log.error( "IOException: " + e.getMessage(), e ); + log.error( "IOException: {}", e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } return true; @@ -517,8 +517,8 @@ public class DefaultRepositoriesService } catch ( TaskQueueException e ) { - log.error( "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName() - + "']." ); + log.error( "Unable to queue repository task to execute consumers on resource file ['{}" + + "'].", localFile.getName() ); } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java index e4d6676d6..af0164d9e 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java @@ -569,8 +569,8 @@ public class DefaultFileUploadService } catch ( TaskQueueException e ) { - log.error( "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName() - + "']." ); + log.error( "Unable to queue repository task to execute consumers on resource file ['{}" + + "'].", localFile.getName() ); } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ldap/ArchivaLdapConnectionFactory.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ldap/ArchivaLdapConnectionFactory.java index 45945f104..55dad7b39 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ldap/ArchivaLdapConnectionFactory.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ldap/ArchivaLdapConnectionFactory.java @@ -73,7 +73,7 @@ public class ArchivaLdapConnectionFactory } catch ( InvalidNameException e ) { - log.error("Error during initialization of LdapConnectionFactory "+e.getMessage(),e); + log.error( "Error during initialization of LdapConnectionFactory {}", e.getMessage(), e ); // throw new RuntimeException( "Error while initializing connection factory.", e ); } catch ( RepositoryAdminException e ) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java index b1cbc9cf8..0acc266bf 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaUserManagerAuthenticator.java @@ -89,7 +89,7 @@ public class ArchivaUserManagerAuthenticator } catch ( RepositoryAdminException e ) { - log.error("Error during repository initialization "+e.getMessage(),e); + log.error( "Error during repository initialization {}", e.getMessage(), e ); // throw new AuthenticationException( e.getMessage(), e ); } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java index 0e28b51af..4ddbbd9c0 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java @@ -152,7 +152,7 @@ public class SecuritySynchronization catch ( RoleManagerException e ) { // Log error. - log.error( "Unable to create roles for configured repositories: " + e.getMessage(), e ); + log.error( "Unable to create roles for configured repositories: {}", e.getMessage(), e ); } } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java index 074d13bda..6a14e2130 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java @@ -723,8 +723,8 @@ public class ArchivaDavResource } catch ( TaskQueueException e ) { - log.error( "Unable to queue repository task to execute consumers on resource file ['" + localFile.getName() - + "']." ); + log.error( "Unable to queue repository task to execute consumers on resource file ['{}" + + "'].", localFile.getName() ); } } } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/MimeTypes.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/MimeTypes.java index 092c4b100..e42d6344c 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/MimeTypes.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/util/MimeTypes.java @@ -100,7 +100,7 @@ public class MimeTypes } catch ( IOException e ) { - log.error( "Unable to load mime map " + resourceName + " : " + e.getMessage(), e ); + log.error( "Unable to load mime map {} : {}", resourceName, e.getMessage(), e ); } } @@ -146,7 +146,7 @@ public class MimeTypes } catch ( IOException e ) { - log.error( "Unable to read mime types from input stream : " + e.getMessage(), e ); + log.error( "Unable to read mime types from input stream : {}", e.getMessage(), e ); } } diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java index 44086185c..510dc8191 100644 --- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java +++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java @@ -134,7 +134,7 @@ public class DefaultAuditManager } catch ( ParseException e ) { - log.error( "Invalid audit event found in the metadata repository: " + e.getMessage() ); + log.error( "Invalid audit event found in the metadata repository: {}", e.getMessage() ); // continue and ignore this one } } diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java index 44b02997d..d0185d9fc 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java @@ -458,7 +458,7 @@ public class DefaultCassandraArchivaManager { // ensure keyspace exists, here if the keyspace doesn't exist we suppose nothing exist if ( cluster.describeKeyspace( keyspaceName ) == null ) { - logger.info( "Creating Archiva Cassandra '" + keyspaceName + "' keyspace." ); + logger.info( "Creating Archiva Cassandra '{}' keyspace.", keyspaceName ); cluster.addKeyspace( HFactory.createKeyspaceDefinition( keyspaceName, // ThriftKsDef.DEF_STRATEGY_CLASS, // replicationFactor, // diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java index 2cea31c36..7a3af1aaf 100644 --- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java @@ -570,7 +570,7 @@ public class FileMetadataRepository MetadataFacetFactory factory = metadataFacetFactories.get( facetId ); if ( factory == null ) { - log.error( "Attempted to load unknown artifact metadata facet: " + facetId ); + log.error( "Attempted to load unknown artifact metadata facet: {}", facetId ); } else { diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java index 2b76db4af..f8393b888 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java @@ -1353,7 +1353,7 @@ public class JcrMetadataRepository getJcrSession().save(); } catch ( InvalidItemStateException e ) { // olamy this might happen when deleting a repo while is under scanning - log.warn( "skip InvalidItemStateException:" + e.getMessage(), e ); + log.warn( "skip InvalidItemStateException:{}", e.getMessage(), e ); } catch ( RepositoryException e ) { @@ -1493,7 +1493,7 @@ public class JcrMetadataRepository MetadataFacetFactory factory = metadataFacetFactories.get( name ); if ( factory == null ) { - log.error( "Attempted to load unknown project version metadata facet: " + name ); + log.error( "Attempted to load unknown project version metadata facet: {}", name ); } else { diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java index f7c4dcc84..9611bbb67 100644 --- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java +++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java @@ -156,7 +156,7 @@ public class DefaultRepositoryStatisticsManager } catch ( ParseException e ) { - log.error( "Invalid scan result found in the metadata repository: " + e.getMessage() ); + log.error( "Invalid scan result found in the metadata repository: {}", e.getMessage() ); // continue and ignore this one } } -- 2.39.5