as there is String concat use log.isDebugEnabled

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174420 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-22 22:18:06 +00:00
parent 98db72a675
commit 0157bc252d
3 changed files with 61 additions and 41 deletions

View File

@ -25,6 +25,8 @@ import org.apache.archiva.audit.AuditListener;
import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
import org.apache.archiva.scheduler.repository.RepositoryTask; import org.apache.archiva.scheduler.repository.RepositoryTask;
import org.apache.archiva.webdav.util.IndexWriter;
import org.apache.archiva.webdav.util.MimeTypes;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.util.Text; import org.apache.jackrabbit.util.Text;
@ -50,8 +52,6 @@ import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.jackrabbit.webdav.property.DavPropertySet; import org.apache.jackrabbit.webdav.property.DavPropertySet;
import org.apache.jackrabbit.webdav.property.DefaultDavProperty; import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
import org.apache.jackrabbit.webdav.property.ResourceType; import org.apache.jackrabbit.webdav.property.ResourceType;
import org.apache.archiva.webdav.util.IndexWriter;
import org.apache.archiva.webdav.util.MimeTypes;
import org.codehaus.plexus.taskqueue.TaskQueueException; import org.codehaus.plexus.taskqueue.TaskQueueException;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
@ -316,11 +316,12 @@ public class ArchivaDavResource
} }
queueRepositoryTask( localFile ); queueRepositoryTask( localFile );
if ( log.isDebugEnabled() )
log.debug( {
"File '" + resource.getDisplayName() + ( exists ? "' modified " : "' created " ) + "(current user '" log.debug(
+ this.principal + "')" ); "File '" + resource.getDisplayName() + ( exists ? "' modified " : "' created " ) + "(current user '"
+ this.principal + "')" );
}
triggerAuditEvent( resource, exists ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE ); triggerAuditEvent( resource, exists ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE );
} }
else if ( !inputContext.hasStream() && isCollection() ) // New directory else if ( !inputContext.hasStream() && isCollection() ) // New directory
@ -399,8 +400,11 @@ public class ArchivaDavResource
triggerAuditEvent( member, AuditEvent.REMOVE_FILE ); triggerAuditEvent( member, AuditEvent.REMOVE_FILE );
} }
log.debug( ( resource.isDirectory() ? "Directory '" : "File '" ) + member.getDisplayName() if ( log.isDebugEnabled() )
+ "' removed (current user '" + this.principal + "')" ); {
log.debug( ( resource.isDirectory() ? "Directory '" : "File '" ) + member.getDisplayName()
+ "' removed (current user '" + this.principal + "')" );
}
} }
catch ( IOException e ) catch ( IOException e )
{ {
@ -451,9 +455,11 @@ public class ArchivaDavResource
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_FILE ); triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_FILE );
} }
if ( log.isDebugEnabled() )
log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' moved to '" {
+ destination + "' (current user '" + this.principal + "')" ); log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' moved to '"
+ destination + "' (current user '" + this.principal + "')" );
}
} }
catch ( IOException e ) catch ( IOException e )
{ {
@ -489,8 +495,12 @@ public class ArchivaDavResource
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE ); triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE );
} }
log.debug( ( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' copied to '" if ( log.isDebugEnabled() )
+ destination + "' (current user '" + this.principal + "')" ); {
log.debug(
( isCollection() ? "Directory '" : "File '" ) + getLocalResource().getName() + "' copied to '"
+ destination + "' (current user '" + this.principal + "')" );
}
} }
catch ( IOException e ) catch ( IOException e )
{ {

View File

@ -24,19 +24,6 @@ import org.apache.archiva.audit.AuditListener;
import org.apache.archiva.audit.Auditable; import org.apache.archiva.audit.Auditable;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
import org.apache.archiva.security.ServletAuthenticator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavResource;
import org.apache.jackrabbit.webdav.DavResourceFactory;
import org.apache.jackrabbit.webdav.DavResourceLocator;
import org.apache.jackrabbit.webdav.DavServletRequest;
import org.apache.jackrabbit.webdav.DavServletResponse;
import org.apache.jackrabbit.webdav.DavSession;
import org.apache.jackrabbit.webdav.lock.LockManager;
import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.common.utils.VersionUtil; import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ArchivaConfiguration;
@ -57,9 +44,22 @@ import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.metadata.RepositoryMetadataMerge; import org.apache.archiva.repository.metadata.RepositoryMetadataMerge;
import org.apache.archiva.repository.metadata.RepositoryMetadataReader; import org.apache.archiva.repository.metadata.RepositoryMetadataReader;
import org.apache.archiva.repository.metadata.RepositoryMetadataWriter; import org.apache.archiva.repository.metadata.RepositoryMetadataWriter;
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
import org.apache.archiva.security.ServletAuthenticator;
import org.apache.archiva.webdav.util.MimeTypes; import org.apache.archiva.webdav.util.MimeTypes;
import org.apache.archiva.webdav.util.RepositoryPathUtil; import org.apache.archiva.webdav.util.RepositoryPathUtil;
import org.apache.archiva.webdav.util.WebdavMethodUtil; import org.apache.archiva.webdav.util.WebdavMethodUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavResource;
import org.apache.jackrabbit.webdav.DavResourceFactory;
import org.apache.jackrabbit.webdav.DavResourceLocator;
import org.apache.jackrabbit.webdav.DavServletRequest;
import org.apache.jackrabbit.webdav.DavServletResponse;
import org.apache.jackrabbit.webdav.DavSession;
import org.apache.jackrabbit.webdav.lock.LockManager;
import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.Relocation; import org.apache.maven.model.Relocation;
@ -510,9 +510,12 @@ public class ArchivaDavResourceFactory
String event = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE ) String event = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE )
+ PROXIED_SUFFIX; + PROXIED_SUFFIX;
log.debug( "Proxied artifact '" + resourceFile.getName() + "' in repository '" if ( log.isDebugEnabled() )
+ managedRepository.getId() + "' (current user '" + activePrincipal + "')" ); {
log.debug( "Proxied artifact '" + resourceFile.getName() + "' in repository '"
+ managedRepository.getId() + "' (current user '" + activePrincipal
+ "')" );
}
triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(), triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(),
logicalResource.getPath(), event, activePrincipal ); logicalResource.getPath(), event, activePrincipal );
} }
@ -649,10 +652,11 @@ public class ArchivaDavResourceFactory
File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact ); File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact );
resource.setPath( managedRepository.toPath( 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 ); return ( proxiedFile != null );
} }
} }
@ -958,9 +962,12 @@ public class ArchivaDavResourceFactory
catch ( DavException e ) catch ( DavException e )
{ {
// TODO: review exception handling // TODO: review exception handling
log.debug( if ( log.isDebugEnabled() )
"Skipping repository '" + managedRepository + "' for user '" + activePrincipal + "': " {
+ e.getMessage() ); log.debug(
"Skipping repository '" + managedRepository + "' for user '" + activePrincipal
+ "': " + e.getMessage() );
}
} }
} }
else else
@ -979,9 +986,12 @@ public class ArchivaDavResourceFactory
catch ( UnauthorizedException e ) catch ( UnauthorizedException e )
{ {
// TODO: review exception handling // TODO: review exception handling
log.debug( if ( log.isDebugEnabled() )
"Skipping repository '" + managedRepository + "' for user '" + activePrincipal + "': " {
+ e.getMessage() ); log.debug(
"Skipping repository '" + managedRepository + "' for user '" + activePrincipal
+ "': " + e.getMessage() );
}
} }
} }
} }

View File

@ -76,7 +76,7 @@ public class RepositoryServlet
private final Object reloadLock = new Object(); private final Object reloadLock = new Object();
public void init( javax.servlet.ServletConfig servletConfig ) public void init( ServletConfig servletConfig )
throws ServletException throws ServletException
{ {
super.init( servletConfig ); super.init( servletConfig );