]> source.dussan.org Git - archiva.git/commitdiff
simplify some log.debug as slf4j now supports varargs
authorOlivier Lamy <olamy@apache.org>
Fri, 7 Sep 2012 08:32:10 +0000 (08:32 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 7 Sep 2012 08:32:10 +0000 (08:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1381934 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java

index 19fad186edcb2dd3fad9719454b142480f87d192..faa2e171f20cf6de7331be49339f9cf93a1331fd 100644 (file)
@@ -235,12 +235,12 @@ public abstract class AbstractNexusRepositorySearch
 
         public void artifactError( ArtifactContext ac, Exception e )
         {
-            log.debug( "artifactError " + ac.getArtifact().getPath(), e );
+            log.debug( "artifactError {}", ac.getArtifact().getPath(), e );
         }
 
         public void artifactDiscovered( ArtifactContext ac )
         {
-            log.debug( "artifactDiscovered {}:", ac.getArtifact().getPath(), ac.getArtifactInfo() );
+            log.debug( "artifactDiscovered {}:{}", ac.getArtifact().getPath(), ac.getArtifactInfo() );
         }
     }
 
index 18739140131a1bd4cc751dfff149cce05a62f70a..8fd1f02397d395e1790eb1f4c2bda8c10d44fce1 100644 (file)
@@ -63,7 +63,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -80,7 +79,7 @@ import java.util.zip.ZipEntry;
  * @author Olivier Lamy
  * @since 1.4-M3
  */
-@Service( "browseService#rest" )
+@Service ( "browseService#rest" )
 public class DefaultBrowseService
     extends AbstractRestService
     implements BrowseService
@@ -774,8 +773,7 @@ public class DefaultBrowseService
             throw new ArchivaRestServiceException( e.getMessage(),
                                                    Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
-        log.debug( "artifact: {}:{}:{}:{}:{} not found",
-                   Arrays.asList( groupId, artifactId, version, classifier, type ).toArray( new String[5] ) );
+        log.debug( "artifact: {}:{}:{}:{}:{} not found", groupId, artifactId, version, classifier, type );
         // 404 ?
         return new ArtifactContent();
     }
index 1d6d3fb96550e7748e77d6375ced7ff07b07e25a..33ca9723d69a5d84b8aba26737e5b48f46a8933c 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.archiva.security;
  * under the License.
  */
 
-import com.google.common.collect.Lists;
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
@@ -44,7 +43,7 @@ import java.util.List;
 /**
  * DefaultUserRepositories
  */
-@Service("userRepositories")
+@Service ( "userRepositories" )
 public class DefaultUserRepositories
     implements UserRepositories
 {
@@ -120,11 +119,10 @@ public class DefaultUserRepositories
                 catch ( AuthorizationException e )
                 {
                     // swallow.
-                    if ( log.isDebugEnabled() )
-                    {
-                        log.debug( "Not authorizing '{}' for repository '{}': {}",
-                                   Lists.<Object>newArrayList( principal, repo.getId(), e.getMessage() ) );
-                    }
+
+                    log.debug( "Not authorizing '{}' for repository '{}': {}", principal, repo.getId(),
+                               e.getMessage() );
+
                 }
             }
 
index 0b3c3ea12bf7c8092fa46c684525b65e30ad956a..a4a56fafcd6ed45d8c57e0addfe9cddb583dc5c6 100644 (file)
@@ -38,6 +38,16 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.archiva.model.ArtifactReference;
 import org.apache.archiva.policies.ProxyDownloadException;
 import org.apache.archiva.proxy.RepositoryProxyConnectors;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.authorization.UnauthorizedException;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManager;
 import org.apache.archiva.repository.ManagedRepositoryContent;
 import org.apache.archiva.repository.RepositoryContentFactory;
 import org.apache.archiva.repository.RepositoryException;
@@ -76,17 +86,7 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.codehaus.plexus.digest.ChecksumFile;
 import org.codehaus.plexus.digest.Digester;
 import org.codehaus.plexus.digest.DigesterException;
-import org.apache.archiva.redback.authentication.AuthenticationException;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.apache.archiva.redback.authorization.UnauthorizedException;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserManager;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
@@ -112,7 +112,7 @@ import java.util.Set;
 /**
  *
  */
-@Service( "davResourceFactory#archiva" )
+@Service ( "davResourceFactory#archiva" )
 public class ArchivaDavResourceFactory
     implements DavResourceFactory, Auditable
 {
@@ -145,7 +145,7 @@ public class ArchivaDavResourceFactory
      *
      */
     @Inject
-    @Named( value = "repositoryProxyConnectors#default" )
+    @Named ( value = "repositoryProxyConnectors#default" )
     private RepositoryProxyConnectors connectors;
 
     /**
@@ -175,7 +175,7 @@ public class ArchivaDavResourceFactory
      *
      */
     @Inject
-    @Named( value = "httpAuthenticator#basic" )
+    @Named ( value = "httpAuthenticator#basic" )
     private HttpAuthenticator httpAuth;
 
     @Inject
@@ -208,7 +208,7 @@ public class ArchivaDavResourceFactory
      *
      */
     @Inject
-    @Named( value = "archivaTaskScheduler#repository" )
+    @Named ( value = "archivaTaskScheduler#repository" )
     private RepositoryArchivaTaskScheduler scheduler;
 
     private ApplicationContext applicationContext;
@@ -559,12 +559,9 @@ public class ArchivaDavResourceFactory
                             String event = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE )
                                 + PROXIED_SUFFIX;
 
-                            if ( log.isDebugEnabled() )
-                            {
-                                log.debug( "Proxied artifact '" + resourceFile.getName() + "' in repository '"
-                                               + managedRepository.getId() + "' (current user '" + activePrincipal
-                                               + "')" );
-                            }
+                            log.debug( "Proxied artifact '{}' in repository '{}' (current user '{}')",
+                                       resourceFile.getName(), managedRepository.getId(), activePrincipal );
+
                             triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(),
                                                logicalResource.getPath(), event, activePrincipal );
                         }
@@ -696,7 +693,7 @@ public class ArchivaDavResourceFactory
 
             return ( proxiedFile != null );
         }
-        
+
         // Not any of the above? Then it's gotta be an artifact reference.
         try
         {
@@ -710,11 +707,10 @@ public class ArchivaDavResourceFactory
                 File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact );
 
                 resource.setPath( managedRepository.toPath( artifact ) );
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "Proxied artifact '" + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
-                                   + artifact.getVersion() + "'" );
-                }
+
+                log.debug( "Proxied artifact '{}:{}:{}'", artifact.getGroupId(), artifact.getArtifactId(),
+                           artifact.getVersion() );
+
                 return ( proxiedFile != null );
             }
         }
@@ -772,7 +768,7 @@ public class ArchivaDavResourceFactory
             Model model = null;
             try
             {
-                model = mavenXpp3Reader.read(reader);
+                model = mavenXpp3Reader.read( reader );
             }
             finally
             {
@@ -1051,11 +1047,10 @@ public class ArchivaDavResourceFactory
                                 catch ( DavException e )
                                 {
                                     // TODO: review exception handling
-                                    if ( log.isDebugEnabled() )
-                                    {
-                                        log.debug( "Skipping repository '" + managedRepository + "' for user '"
-                                                       + activePrincipal + "': " + e.getMessage() );
-                                    }
+
+                                    log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
+                                               activePrincipal, e.getMessage() );
+
                                 }
 
                             }
@@ -1075,11 +1070,10 @@ public class ArchivaDavResourceFactory
                                 catch ( UnauthorizedException e )
                                 {
                                     // TODO: review exception handling
-                                    if ( log.isDebugEnabled() )
-                                    {
-                                        log.debug( "Skipping repository '" + managedRepository + "' for user '"
-                                                       + activePrincipal + "': " + e.getMessage() );
-                                    }
+
+                                    log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
+                                               activePrincipal, e.getMessage() );
+
                                 }
                             }
                         }
@@ -1259,11 +1253,9 @@ public class ArchivaDavResourceFactory
                 catch ( UnauthorizedException e )
                 {
                     // TODO: review exception handling
-                    if ( log.isDebugEnabled() )
-                    {
-                        log.debug( "Skipping repository '" + repository + "' for user '" + activePrincipal + "': "
-                                       + e.getMessage() );
-                    }
+
+                    log.debug( "Skipping repository '{}' for user '{}': {}", repository, activePrincipal,
+                               e.getMessage() );
                 }
             }
             IndexingContext indexingContext = indexMerger.buildMergedIndex( authzRepos, true );
index 40ffbff22b677adc64385f38c26e7cdc4f9391e5..220b412028dcf0a508e2667d48d6846588272508 100644 (file)
@@ -22,22 +22,22 @@ package org.apache.archiva.reports.consumers;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
-import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
-import org.apache.archiva.reports.RepositoryProblemFacet;
-import org.apache.commons.collections.CollectionUtils;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.ConfigurationNames;
 import org.apache.archiva.configuration.FileTypes;
 import org.apache.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
 import org.apache.archiva.redback.components.registry.Registry;
 import org.apache.archiva.redback.components.registry.RegistryListener;
+import org.apache.archiva.reports.RepositoryProblemFacet;
+import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
@@ -57,11 +57,9 @@ import java.util.List;
  * Search the artifact repository of known SHA1 Checksums for potential duplicate artifacts.
  * <p/>
  * TODO: no need for this to be a scanner - we can just query the database / content repository to get a full list
- *
- *
  */
-@Service( "knownRepositoryContentConsumer#duplicate-artifacts" )
-@Scope( "prototype" )
+@Service ( "knownRepositoryContentConsumer#duplicate-artifacts" )
+@Scope ( "prototype" )
 public class DuplicateArtifactsConsumer
     extends AbstractMonitoredConsumer
     implements KnownRepositoryContentConsumer, RegistryListener
@@ -92,7 +90,6 @@ public class DuplicateArtifactsConsumer
 
     /**
      * FIXME: can be of other types
-     *
      */
     @Inject
     private RepositorySessionFactory repositorySessionFactory;
@@ -105,10 +102,9 @@ public class DuplicateArtifactsConsumer
 
     /**
      * FIXME: needs to be selected based on the repository in question
-     *
      */
     @Inject
-    @Named( value = "repositoryPathTranslator#maven2" )
+    @Named ( value = "repositoryPathTranslator#maven2" )
     private RepositoryPathTranslator pathTranslator;
 
     private RepositorySession repositorySession;
@@ -201,16 +197,15 @@ public class DuplicateArtifactsConsumer
             for ( ArtifactMetadata dupArtifact : results )
             {
                 String id = path.substring( path.lastIndexOf( "/" ) + 1 );
-                if ( dupArtifact.getId().equals( id )
-                    && dupArtifact.getNamespace().equals( originalArtifact.getNamespace() )
-                    && dupArtifact.getProject().equals( originalArtifact.getProject() )
-                    && dupArtifact.getVersion().equals( originalArtifact.getVersion() ) )
+                if ( dupArtifact.getId().equals( id ) && dupArtifact.getNamespace().equals(
+                    originalArtifact.getNamespace() ) && dupArtifact.getProject().equals(
+                    originalArtifact.getProject() ) && dupArtifact.getVersion().equals(
+                    originalArtifact.getVersion() ) )
                 {
                     // Skip reference to itself.
-                    if ( log.isDebugEnabled() )
-                    {
-                        log.debug( "Not counting duplicate for artifact " + dupArtifact + " for path " + path );
-                    }
+
+                    log.debug( "Not counting duplicate for artifact {} for path {}", dupArtifact, path );
+
                     continue;
                 }