mirror of https://github.com/apache/archiva.git
clean up warnings in webdav module
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dddb1c3b45
commit
f8373b46e0
|
@ -19,11 +19,9 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.jackrabbit.util.Text;
|
||||||
import org.apache.jackrabbit.webdav.DavLocatorFactory;
|
import org.apache.jackrabbit.webdav.DavLocatorFactory;
|
||||||
import org.apache.jackrabbit.webdav.DavResourceLocator;
|
import org.apache.jackrabbit.webdav.DavResourceLocator;
|
||||||
import org.apache.jackrabbit.util.Text;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
|
||||||
import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
|
import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,6 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
||||||
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
|
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
|
||||||
import org.apache.maven.archiva.model.ArtifactReference;
|
import org.apache.maven.archiva.model.ArtifactReference;
|
||||||
import org.apache.maven.archiva.model.VersionedReference;
|
|
||||||
import org.apache.maven.archiva.policies.ProxyDownloadException;
|
import org.apache.maven.archiva.policies.ProxyDownloadException;
|
||||||
import org.apache.maven.archiva.proxy.RepositoryProxyConnectors;
|
import org.apache.maven.archiva.proxy.RepositoryProxyConnectors;
|
||||||
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
||||||
|
@ -80,7 +79,6 @@ import org.codehaus.plexus.redback.authorization.UnauthorizedException;
|
||||||
import org.codehaus.plexus.redback.policy.AccountLockedException;
|
import org.codehaus.plexus.redback.policy.AccountLockedException;
|
||||||
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
|
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
|
||||||
import org.codehaus.plexus.redback.system.SecuritySession;
|
import org.codehaus.plexus.redback.system.SecuritySession;
|
||||||
import org.codehaus.plexus.redback.system.SecuritySystemConstants;
|
|
||||||
import org.codehaus.plexus.redback.users.User;
|
import org.codehaus.plexus.redback.users.User;
|
||||||
import org.codehaus.plexus.redback.users.UserManager;
|
import org.codehaus.plexus.redback.users.UserManager;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
@ -986,7 +984,7 @@ public class ArchivaDavResourceFactory
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VersionedReference versionRef = metadataTools.toVersionedReference( requestedResource );
|
metadataTools.toVersionedReference( requestedResource );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch ( RepositoryMetadataException re )
|
catch ( RepositoryMetadataException re )
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.jackrabbit.webdav.DavSession;
|
||||||
|
|
||||||
public class ArchivaDavSession implements DavSession
|
public class ArchivaDavSession implements DavSession
|
||||||
{
|
{
|
||||||
private final HashSet lockTokens = new HashSet();
|
private final HashSet<String> lockTokens = new HashSet<String>();
|
||||||
|
|
||||||
public void addLockToken(String token)
|
public void addLockToken(String token)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,27 +34,20 @@ import org.codehaus.plexus.redback.policy.AccountLockedException;
|
||||||
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
|
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
|
||||||
import org.codehaus.plexus.redback.users.UserManager;
|
import org.codehaus.plexus.redback.users.UserManager;
|
||||||
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
|
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class ArchivaDavSessionProvider
|
public class ArchivaDavSessionProvider
|
||||||
implements DavSessionProvider
|
implements DavSessionProvider
|
||||||
{
|
{
|
||||||
private Logger log = LoggerFactory.getLogger( ArchivaDavSessionProvider.class );
|
|
||||||
|
|
||||||
private ServletAuthenticator servletAuth;
|
private ServletAuthenticator servletAuth;
|
||||||
|
|
||||||
private HttpAuthenticator httpAuth;
|
private HttpAuthenticator httpAuth;
|
||||||
|
|
||||||
private ArchivaXworkUser archivaXworkUser;
|
|
||||||
|
|
||||||
public ArchivaDavSessionProvider( ServletAuthenticator servletAuth, HttpAuthenticator httpAuth, ArchivaXworkUser archivaXworkUser )
|
public ArchivaDavSessionProvider( ServletAuthenticator servletAuth, HttpAuthenticator httpAuth, ArchivaXworkUser archivaXworkUser )
|
||||||
{
|
{
|
||||||
this.servletAuth = servletAuth;
|
this.servletAuth = servletAuth;
|
||||||
this.httpAuth = httpAuth;
|
this.httpAuth = httpAuth;
|
||||||
this.archivaXworkUser = archivaXworkUser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean attachSession( WebdavRequest request )
|
public boolean attachSession( WebdavRequest request )
|
||||||
|
|
|
@ -63,8 +63,6 @@ public class ArchivaVirtualDavResource
|
||||||
|
|
||||||
private static final String COMPLIANCE_CLASS = "1";
|
private static final String COMPLIANCE_CLASS = "1";
|
||||||
|
|
||||||
private MimeTypes mimeTypes;
|
|
||||||
|
|
||||||
private ArchivaDavResourceLocator locator;
|
private ArchivaDavResourceLocator locator;
|
||||||
|
|
||||||
private DavResourceFactory factory;
|
private DavResourceFactory factory;
|
||||||
|
@ -84,7 +82,6 @@ public class ArchivaVirtualDavResource
|
||||||
{
|
{
|
||||||
this.localResources = localResources;
|
this.localResources = localResources;
|
||||||
this.logicalResource = logicalResource;
|
this.logicalResource = logicalResource;
|
||||||
this.mimeTypes = mimeTypes;
|
|
||||||
this.locator = locator;
|
this.locator = locator;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.properties = new DavPropertySet();
|
this.properties = new DavPropertySet();
|
||||||
|
@ -122,6 +119,7 @@ public class ArchivaVirtualDavResource
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public MultiStatusResponse alterProperties( List arg0 )
|
public MultiStatusResponse alterProperties( List arg0 )
|
||||||
throws DavException
|
throws DavException
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,8 +37,6 @@ import java.io.File;
|
||||||
*/
|
*/
|
||||||
public class IndexWriter
|
public class IndexWriter
|
||||||
{
|
{
|
||||||
private final DavResource resource;
|
|
||||||
|
|
||||||
private final String logicalResource;
|
private final String logicalResource;
|
||||||
|
|
||||||
private final List<File> localResources;
|
private final List<File> localResources;
|
||||||
|
@ -47,7 +45,6 @@ public class IndexWriter
|
||||||
|
|
||||||
public IndexWriter(DavResource resource, File localResource, String logicalResource)
|
public IndexWriter(DavResource resource, File localResource, String logicalResource)
|
||||||
{
|
{
|
||||||
this.resource = resource;
|
|
||||||
this.localResources = new ArrayList<File>();
|
this.localResources = new ArrayList<File>();
|
||||||
this.localResources.add( localResource );
|
this.localResources.add( localResource );
|
||||||
this.logicalResource = logicalResource;
|
this.logicalResource = logicalResource;
|
||||||
|
@ -56,7 +53,6 @@ public class IndexWriter
|
||||||
|
|
||||||
public IndexWriter( DavResource resource, List<File> localResources, String logicalResource )
|
public IndexWriter( DavResource resource, List<File> localResources, String logicalResource )
|
||||||
{
|
{
|
||||||
this.resource = resource;
|
|
||||||
this.logicalResource = logicalResource;
|
this.logicalResource = logicalResource;
|
||||||
this.localResources = localResources;
|
this.localResources = localResources;
|
||||||
this.isVirtual = true;
|
this.isVirtual = true;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class MimeTypes
|
||||||
|
|
||||||
private String resource = "org/apache/maven/archiva/webdav/util/mime.types";
|
private String resource = "org/apache/maven/archiva/webdav/util/mime.types";
|
||||||
|
|
||||||
private Map mimeMap = new HashMap();
|
private Map<String, String> mimeMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger( MimeTypes.class );
|
private Logger log = LoggerFactory.getLogger( MimeTypes.class );
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,11 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class WebdavMethodUtil
|
public class WebdavMethodUtil
|
||||||
{
|
{
|
||||||
private static final List READ_METHODS;
|
private static final List<String> READ_METHODS;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
READ_METHODS = new ArrayList();
|
READ_METHODS = new ArrayList<String>();
|
||||||
READ_METHODS.add( "HEAD" );
|
READ_METHODS.add( "HEAD" );
|
||||||
READ_METHODS.add( "GET" );
|
READ_METHODS.add( "GET" );
|
||||||
READ_METHODS.add( "PROPFIND" );
|
READ_METHODS.add( "PROPFIND" );
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class ArchivaDavSessionProviderTest extends TestCase
|
||||||
assertNull(request.getDavSession());
|
assertNull(request.getDavSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private class HttpServletRequestMock implements HttpServletRequest
|
private class HttpServletRequestMock implements HttpServletRequest
|
||||||
{
|
{
|
||||||
public Object getAttribute(String arg0) {
|
public Object getAttribute(String arg0) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.maven.archiva.webdav;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.jackrabbit.webdav.DavException;
|
import org.apache.jackrabbit.webdav.DavException;
|
||||||
|
@ -36,13 +37,12 @@ import org.apache.jackrabbit.webdav.lock.Scope;
|
||||||
import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
|
import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
|
||||||
import org.apache.jackrabbit.webdav.lock.Type;
|
import org.apache.jackrabbit.webdav.lock.Type;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
|
import org.apache.maven.archiva.repository.audit.AuditListener;
|
||||||
import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
|
import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
|
||||||
import org.apache.maven.archiva.webdav.util.MimeTypes;
|
import org.apache.maven.archiva.webdav.util.MimeTypes;
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||||
import org.codehaus.plexus.spring.PlexusToSpringUtils;
|
import org.codehaus.plexus.spring.PlexusToSpringUtils;
|
||||||
|
|
||||||
import edu.emory.mathcs.backport.java.util.Collections;
|
|
||||||
|
|
||||||
public class DavResourceTest extends PlexusInSpringTestCase
|
public class DavResourceTest extends PlexusInSpringTestCase
|
||||||
{
|
{
|
||||||
private DavSession session;
|
private DavSession session;
|
||||||
|
@ -98,7 +98,7 @@ public class DavResourceTest extends PlexusInSpringTestCase
|
||||||
private DavResource getDavResource(String logicalPath, File file)
|
private DavResource getDavResource(String logicalPath, File file)
|
||||||
{
|
{
|
||||||
return new ArchivaDavResource( file.getAbsolutePath(), logicalPath, repository, session, resourceLocator,
|
return new ArchivaDavResource( file.getAbsolutePath(), logicalPath, repository, session, resourceLocator,
|
||||||
resourceFactory, mimeTypes, Collections.emptyList(), consumers );
|
resourceFactory, mimeTypes, Collections.<AuditListener>emptyList(), consumers );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteNonExistantResourceShould404()
|
public void testDeleteNonExistantResourceShould404()
|
||||||
|
@ -299,7 +299,7 @@ public class DavResourceTest extends PlexusInSpringTestCase
|
||||||
|
|
||||||
public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException {
|
public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException {
|
||||||
return new ArchivaDavResource( baseDir.getAbsolutePath(), "/", repository, session, resourceLocator,
|
return new ArchivaDavResource( baseDir.getAbsolutePath(), "/", repository, session, resourceLocator,
|
||||||
resourceFactory, mimeTypes, Collections.emptyList(), consumers );
|
resourceFactory, mimeTypes, Collections.<AuditListener>emptyList(), consumers );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServlet Tests, Proxied, Get of Metadata, exists on remote repository only.
|
* RepositoryServlet Tests, Proxied, Get of Metadata, exists on remote repository only.
|
||||||
|
@ -45,7 +44,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
|
String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
|
||||||
version, timestamp, buildNumber, lastUpdated);
|
version, timestamp, buildNumber, lastUpdated);
|
||||||
|
|
||||||
File metadataFile = populateRepo( remoteSnapshots, path, expectedMetadata );
|
populateRepo( remoteSnapshots, path, expectedMetadata );
|
||||||
|
|
||||||
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
||||||
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
||||||
|
@ -74,7 +73,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
String expectedMetadata = createVersionMetadata( "org.apache.maven.plugins", "maven-assembly-plugin", version,
|
String expectedMetadata = createVersionMetadata( "org.apache.maven.plugins", "maven-assembly-plugin", version,
|
||||||
timestamp, buildNumber, lastUpdated );
|
timestamp, buildNumber, lastUpdated );
|
||||||
|
|
||||||
File metadataFile = populateRepo( remoteSnapshots, path, expectedMetadata );
|
populateRepo( remoteSnapshots, path, expectedMetadata );
|
||||||
|
|
||||||
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
||||||
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
||||||
|
@ -99,7 +98,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
|
String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
|
||||||
"4.0-alpha-2" );
|
"4.0-alpha-2" );
|
||||||
|
|
||||||
File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
|
populateRepo( remoteSnapshots, path, expectedMetadata );
|
||||||
|
|
||||||
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
||||||
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
||||||
|
@ -126,7 +125,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
String expectedMetadata = createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin",
|
String expectedMetadata = createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin",
|
||||||
latest, release, new String[] { "1.0-alpha-4" } );
|
latest, release, new String[] { "1.0-alpha-4" } );
|
||||||
|
|
||||||
File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
|
populateRepo( remoteSnapshots, path, expectedMetadata );
|
||||||
|
|
||||||
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
||||||
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
||||||
|
@ -150,7 +149,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
String path = "org/apache/archiva/maven-metadata.xml";
|
String path = "org/apache/archiva/maven-metadata.xml";
|
||||||
String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
|
String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
|
||||||
|
|
||||||
File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
|
populateRepo( remoteSnapshots, path, expectedMetadata );
|
||||||
|
|
||||||
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
setupConnector( REPOID_INTERNAL, remoteSnapshots );
|
||||||
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.maven.archiva.webdav.httpunit;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.meterware.httpunit.HeaderOnlyWebRequest;
|
import com.meterware.httpunit.HeaderOnlyWebRequest;
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MkColMethodWebRequest
|
* MkColMethodWebRequest
|
||||||
|
|
Loading…
Reference in New Issue