From cf347e1eb8d664e495c590b72904f1455d24fbe1 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 1 Apr 2018 18:30:12 +0200 Subject: [PATCH] Reducing compiler warnings --- .../archiva/configuration/FileTypes.java | 3 +- ...ectorConfigurationOrderComparatorTest.java | 1 + .../archiva-core-consumers/pom.xml | 1 - .../mock/RepositoryProviderMock.java | 5 ++-- .../archiva-maven2-indexer/pom.xml | 1 - .../mock/RepositoryProviderMock.java | 1 + .../admin/mock/MavenIndexContextMock.java | 1 + .../archiva-scheduler-repository-api/pom.xml | 3 -- ...ivaRepositoryScanningTaskExecutorTest.java | 3 +- .../DefaultArchivaAdministrationService.java | 9 +++--- .../rest/services/DefaultBrowseService.java | 6 ++-- .../services/DefaultRepositoriesService.java | 2 +- .../services/DefaultSystemStatusService.java | 14 ++++++++- .../utils/AddAdminRepoConsumerClosure.java | 29 ++++++++----------- .../web/api/DefaultFileUploadService.java | 11 ++++--- .../archiva-web/archiva-webdav/pom.xml | 2 -- .../archiva/webdav/ArchivaDavResource.java | 16 +++++----- .../webdav/ArchivaDavResourceFactory.java | 21 +++++--------- .../webdav/ArchivaVirtualDavResource.java | 12 ++++---- .../plugins/maven2-repository/pom.xml | 1 - 20 files changed, 69 insertions(+), 73 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java index 6eae941c4..c5d8931ee 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java @@ -27,6 +27,7 @@ import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.configuration.CombinedConfiguration; import org.apache.tools.ant.types.selectors.SelectorUtils; @@ -102,7 +103,7 @@ public class FileTypes if ( repositoryScanningConfiguration != null ) { FileType filetype = - (FileType) CollectionUtils.find( config.getRepositoryScanning().getFileTypes(), selectedFiletype ); + IterableUtils.find( config.getRepositoryScanning().getFileTypes(), selectedFiletype ); if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) ) { diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java index 62a666c20..db61ddd77 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java @@ -37,6 +37,7 @@ import static org.junit.Assert.fail; * * */ +@SuppressWarnings( "deprecation" ) @RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ProxyConnectorConfigurationOrderComparatorTest { diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index 1de2ce6f0..d5dc6f583 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -229,7 +229,6 @@ org.springframework*;version="[3,4)", org.apache.archiva.redback.components.registry, org.apache.archiva.metadata.model*;version=${project.version}, - org.apache.archiva.metadata.repository.storage.maven2*;version=${project.version}, org.slf4j;resolution:=optional diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index af3597e21..303fd7653 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -143,6 +143,7 @@ public class RepositoryProviderMock implements RepositoryProvider return remoteRepository; } + @SuppressWarnings("unchecked") @Override public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException { @@ -175,7 +176,7 @@ public class RepositoryProviderMock implements RepositoryProvider } @Override - public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository ) throws RepositoryException + public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository ) { ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration( ); configuration.setId( managedRepository.getId( ) ); @@ -202,7 +203,7 @@ public class RepositoryProviderMock implements RepositoryProvider @Override - public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) throws RepositoryException + public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) { RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( ); configuration.setId( remoteRepository.getId( ) ); diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml b/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml index 2a2e1c4d0..de6700c32 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml @@ -276,7 +276,6 @@ org.apache.archiva.common.plexusbridge;version=${project.version}, org.apache.commons.io;version="[1.4,2)", org.apache.commons.lang*;version="[2.4,3)", - org.apache.lucene*;version="[3,4)", org.springframework*;version="[3,4)", org.apache.maven.index*, org.apache.archiva.redback.components.scheduler, diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java index dafcae9c8..691d7eefa 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java @@ -143,6 +143,7 @@ public class RepositoryProviderMock implements RepositoryProvider return remoteRepository; } + @SuppressWarnings("unchecked") @Override public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java index 1b6a54b01..3bed60293 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java @@ -108,6 +108,7 @@ public class MavenIndexContextMock implements ArchivaIndexingContext { return IndexingContext.class.equals(clazz); } + @SuppressWarnings( "unchecked" ) @Override public T getBaseContext(Class clazz) throws UnsupportedOperationException { if (IndexingContext.class.equals(clazz)) { diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml index e728a8b30..3ff1e109e 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml @@ -95,15 +95,12 @@ org.apache.archiva.admin.model.managed;version=${project.version}, org.apache.archiva.common;version=${project.version}, org.apache.archiva.configuration;version=${project.version}, - org.apache.archiva.metadata.repository*;version=${project.version}, org.apache.archiva.repository.scanner;version=${project.version}, org.apache.archiva.scheduler;version=${project.version}, org.apache.commons.lang;version="[2.4,3)", org.codehaus.plexus.personality.plexus.lifecycle.phase, org.apache.archiva.redback.components.taskqueue*, org.apache.archiva.redback.components.scheduler, - org.quartz*;version="[2,3)", - org.springframework*;version="[3,4)", org.slf4j;resolution:=optional diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java index 9b31305ca..78d3e0ae8 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/AbstractArchivaRepositoryScanningTaskExecutorTest.java @@ -28,6 +28,7 @@ import org.apache.archiva.mock.MockRepositorySessionFactory; import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RepositoryRegistry; +import org.apache.archiva.scheduler.repository.model.RepositoryTask; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.codehaus.plexus.util.FileUtils; import org.junit.After; @@ -66,7 +67,7 @@ public abstract class AbstractArchivaRepositoryScanningTaskExecutorTest @Inject @Named( value = "taskExecutor#test-repository-scanning" ) - protected TaskExecutor taskExecutor; + protected TaskExecutor taskExecutor; @Inject @Named( value = "archivaConfiguration#test-repository-scanning" ) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java index 56235d6f6..f13cd46dd 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java @@ -31,7 +31,6 @@ import org.apache.archiva.rest.api.services.ArchivaAdministrationService; import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.services.utils.AddAdminRepoConsumerClosure; import org.apache.archiva.rest.services.utils.AdminRepositoryConsumerComparator; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.IterableUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; @@ -274,7 +273,7 @@ public class DefaultArchivaAdministrationService { try { - return new ArrayList( archivaAdministration.getKnownContentConsumers() ); + return new ArrayList<>( archivaAdministration.getKnownContentConsumers( ) ); } catch ( RepositoryAdminException e ) { @@ -288,7 +287,7 @@ public class DefaultArchivaAdministrationService { try { - return new ArrayList( archivaAdministration.getInvalidContentConsumers() ); + return new ArrayList<>( archivaAdministration.getInvalidContentConsumers( ) ); } catch ( RepositoryAdminException e ) { @@ -415,7 +414,7 @@ public class DefaultArchivaAdministrationService new AddAdminRepoConsumerClosure( archivaAdministration.getKnownContentConsumers() ); IterableUtils.forEach( repoConsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer ); List knownContentConsumers = addAdminRepoConsumer.getList(); - Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); + knownContentConsumers.sort( AdminRepositoryConsumerComparator.getInstance( ) ); return knownContentConsumers; } catch ( RepositoryAdminException e ) @@ -434,7 +433,7 @@ public class DefaultArchivaAdministrationService new AddAdminRepoConsumerClosure( archivaAdministration.getInvalidContentConsumers() ); IterableUtils.forEach( repoConsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer ); List invalidContentConsumers = addAdminRepoConsumer.getList(); - Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); + invalidContentConsumers.sort( AdminRepositoryConsumerComparator.getInstance( ) ); return invalidContentConsumers; } catch ( RepositoryAdminException e ) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java index 0e3a77735..34800ff4f 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java @@ -94,7 +94,7 @@ public class DefaultBrowseService implements BrowseService { - private Charset ARTIFACT_CONTENT_ENCODING=Charset.forName( "UTF-8" ); + private final Charset ARTIFACT_CONTENT_ENCODING=Charset.forName( "UTF-8" ); @Inject private DependencyTreeBuilder dependencyTreeBuilder; @@ -1269,12 +1269,12 @@ public class DefaultBrowseService } } - public Cache getVersionMetadataCache() + public Cache getVersionMetadataCache() { return versionMetadataCache; } - public void setVersionMetadataCache( Cache versionMetadataCache ) + public void setVersionMetadataCache( Cache versionMetadataCache ) { this.versionMetadataCache = versionMetadataCache; } 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 c8ae783f1..b0b4119b0 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 @@ -131,7 +131,7 @@ public class DefaultRepositoriesService @Inject @Named(value = "archivaTaskScheduler#repository") - private ArchivaTaskScheduler scheduler; + private ArchivaTaskScheduler scheduler; @Inject private DownloadRemoteIndexScheduler downloadRemoteIndexScheduler; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java index fdacd992b..82f92dcb8 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java @@ -42,6 +42,7 @@ import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.Locale; @@ -130,6 +131,17 @@ public class DefaultSystemStatusService } } + // Used for generics + private class CacheEntryComparator implements Comparator + { + + @Override + public int compare( CacheEntry o1, CacheEntry o2 ) + { + return o1.compareTo( o2 ); + } + } + @Override public List getCacheEntries() throws ArchivaRestServiceException @@ -147,7 +159,7 @@ public class DefaultSystemStatusService cacheStatistics.getInMemorySize() ) ); } - Collections.sort( cacheEntries ); + Collections.sort( cacheEntries, new CacheEntryComparator() ); return cacheEntries; } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java index b757819f8..311394981 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java @@ -27,14 +27,12 @@ import java.util.ArrayList; import java.util.List; /** - * AddAdminRepoConsumerClosure - * - * + * AddAdminRepoConsumerClosure */ public class AddAdminRepoConsumerClosure - implements Closure + implements Closure { - private List list = new ArrayList<>(); + private List list = new ArrayList<>( ); private List selectedIds; @@ -44,23 +42,20 @@ public class AddAdminRepoConsumerClosure } @Override - public void execute( Object input ) + public void execute( RepositoryContentConsumer input ) { - if ( input instanceof RepositoryContentConsumer ) - { - RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; + RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; - boolean enabled = this.selectedIds.contains( consumer.getId() ); - AdminRepositoryConsumer adminconsumer = new AdminRepositoryConsumer(); - adminconsumer.setEnabled( enabled ); - adminconsumer.setId( consumer.getId() ); - adminconsumer.setDescription( consumer.getDescription() ); + boolean enabled = this.selectedIds.contains( consumer.getId( ) ); + AdminRepositoryConsumer adminconsumer = new AdminRepositoryConsumer( ); + adminconsumer.setEnabled( enabled ); + adminconsumer.setId( consumer.getId( ) ); + adminconsumer.setDescription( consumer.getDescription( ) ); - list.add( adminconsumer ); - } + list.add( adminconsumer ); } - public List getList() + public List getList( ) { return list; } 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 5e1c69ac9..3a05d8fb9 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 @@ -110,13 +110,13 @@ public class DefaultFileUploadService @Inject @Named(value = "archivaTaskScheduler#repository") - private ArchivaTaskScheduler scheduler; + private ArchivaTaskScheduler scheduler; private String getStringValue( MultipartBody multipartBody, String attachmentId ) throws IOException { Attachment attachment = multipartBody.getAttachment( attachmentId ); - return attachment == null ? "" : IOUtils.toString( attachment.getDataHandler().getInputStream() ); + return attachment == null ? "" : IOUtils.toString( attachment.getDataHandler().getInputStream(), "UTF-8" ); } @Override @@ -171,8 +171,7 @@ public class DefaultFileUploadService */ protected synchronized List getSessionFilesList() { - List fileMetadatas = - (List) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); + @SuppressWarnings("unchecked") List fileMetadatas = (List) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); if ( fileMetadatas == null ) { fileMetadatas = new CopyOnWriteArrayList<>(); @@ -208,7 +207,7 @@ public class DefaultFileUploadService public Boolean clearUploadedFiles() throws ArchivaRestServiceException { - List fileMetadatas = new ArrayList( getSessionFileMetadatas() ); + List fileMetadatas = new ArrayList<>( getSessionFileMetadatas() ); for ( FileMetadata fileMetadata : fileMetadatas ) { deleteFile( Paths.get( fileMetadata.getServerFileName() ).toString() ); @@ -221,7 +220,7 @@ public class DefaultFileUploadService public List getSessionFileMetadatas() throws ArchivaRestServiceException { - List fileMetadatas = + @SuppressWarnings("unchecked") List fileMetadatas = (List) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); return fileMetadatas == null ? Collections.emptyList() : fileMetadatas; diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 0dc99c9e8..717074c1b 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -296,11 +296,9 @@ org.joda.time*;version="[1.5,2)", org.springframework*;version="[3,4)", org.apache.maven.index*, - org.apache.maven.model*, org.codehaus.plexus.digest, org.apache.archiva.redback.*, org.apache.archiva.redback.components.taskqueue, - org.codehaus.plexus.util*, org.apache.archiva.common.filelock, org.codehaus.redback.integration.filter.authentication, org.slf4j;resolution:=optional, 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 c13f03939..21c589a87 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 @@ -106,7 +106,7 @@ public class ArchivaDavResource public static final String COMPLIANCE_CLASS = "1, 2"; - private final ArchivaTaskScheduler scheduler; + private final ArchivaTaskScheduler scheduler; private final FileLockManager fileLockManager; @@ -677,20 +677,20 @@ public class ArchivaDavResource // set (or reset) fundamental properties if ( getDisplayName() != null ) { - properties.add( new DefaultDavProperty( DavPropertyName.DISPLAYNAME, getDisplayName() ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.DISPLAYNAME, getDisplayName() ) ); } if ( isCollection() ) { properties.add( new ResourceType( ResourceType.COLLECTION ) ); // Windows XP support - properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "1" ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "1" ) ); } else { properties.add( new ResourceType( ResourceType.DEFAULT_RESOURCE ) ); // Windows XP support - properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "0" ) ); } // Need to get the ISO8601 date for properties @@ -707,18 +707,18 @@ public class ArchivaDavResource DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); String modifiedDate = fmt.print( dt ); - properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.GETLASTMODIFIED, modifiedDate ) ); - properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.CREATIONDATE, modifiedDate ) ); try { - properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, Files.size(localResource) ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.GETCONTENTLENGTH, Files.size(localResource) ) ); } catch ( IOException e ) { log.error("Could not get file size of {}: {}", localResource, e.getMessage(), e); - properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, 0 ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.GETCONTENTLENGTH, 0 ) ); } this.properties = properties; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 62e510056..c48231b1a 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -242,21 +242,14 @@ public class ArchivaDavResourceFactory // handle browse requests for virtual repos if ( getLogicalResource( archivaLocator, null, true ).endsWith( "/" ) ) { - try - { - DavResource davResource = - getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator, - repoGroupConfig ); + DavResource davResource = + getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator, + repoGroupConfig ); - setHeaders( response, locator, davResource, true ); + setHeaders( response, locator, davResource, true ); - return davResource; + return davResource; - } - catch ( RepositoryAdminException e ) - { - throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e ); - } } else { @@ -999,7 +992,7 @@ public class ArchivaDavResourceFactory private DavResource getResourceFromGroup( DavServletRequest request, List repositories, ArchivaDavResourceLocator locator, RepositoryGroupConfiguration repositoryGroupConfiguration ) - throws DavException, RepositoryAdminException + throws DavException { if ( repositoryGroupConfiguration.getRepositories() == null || repositoryGroupConfiguration.getRepositories().isEmpty() ) @@ -1299,7 +1292,7 @@ public class ArchivaDavResourceFactory { HttpSession session = request.getSession(); - Map temporaryGroupIndexMap = + @SuppressWarnings( "unchecked" ) Map temporaryGroupIndexMap = (Map) session.getAttribute( TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY ); if ( temporaryGroupIndexMap == null ) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java index 236be5084..a74e80d4d 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaVirtualDavResource.java @@ -346,20 +346,20 @@ public class ArchivaVirtualDavResource // set (or reset) fundamental properties if ( getDisplayName() != null ) { - properties.add( new DefaultDavProperty( DavPropertyName.DISPLAYNAME, getDisplayName() ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.DISPLAYNAME, getDisplayName() ) ); } if ( isCollection() ) { properties.add( new ResourceType( ResourceType.COLLECTION ) ); // Windows XP support - properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "1" ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "1" ) ); } else { properties.add( new ResourceType( ResourceType.DEFAULT_RESOURCE ) ); // Windows XP support - properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "0" ) ); } // Need to get the ISO8601 date for properties @@ -367,11 +367,11 @@ public class ArchivaVirtualDavResource DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); String modifiedDate = fmt.print( dt ); - properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.GETLASTMODIFIED, modifiedDate ) ); - properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.CREATIONDATE, modifiedDate ) ); - properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, 0 ) ); + properties.add( new DefaultDavProperty<>( DavPropertyName.GETCONTENTLENGTH, 0 ) ); propsInitialized = true; } diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index bf4a7244c..b151a4efb 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -231,7 +231,6 @@ org.apache.archiva.admin.model.proxyconnector;version=${project.version}, org.apache.archiva.admin.model.remote;version=${project.version}, org.apache.commons.collections;version="[3.2,4)", - org.apache.commons.io*;version="[1.4,2)", org.apache.commons.configuration;version="[1.4,2)", org.apache.commons.lang*;version="[2.4,3)", org.apache.maven.artifact*, -- 2.39.5