archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject [archiva] 02/02: Reducing compiler warnings and adapting to redback changes
Date Sun, 08 Apr 2018 19:07:29 GMT
This is an automated email from the ASF dual-hosted git repository.

martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva.git

commit ec8e6600cee1af3952cabed8cba85631d5cfcdf9
Author: Martin Stockhammer <martin_s@apache.org>
AuthorDate: Sun Apr 8 21:06:49 2018 +0200

    Reducing compiler warnings and adapting to redback changes
---
 .../configuration/DefaultArchivaConfiguration.java        |  2 +-
 .../functors/ProxyConnectorSelectionPredicate.java        |  4 ++--
 .../archiva-consumers/archiva-core-consumers/pom.xml      |  1 -
 .../archiva-consumers/archiva-lucene-consumers/pom.xml    |  1 -
 .../archiva/policies/urlcache/DefaultUrlFailureCache.java |  4 ++--
 .../org/apache/archiva/repository/RepositoryRegistry.java | 15 ++++++++++++---
 .../repository/DefaultRepositoryArchivaTaskScheduler.java |  2 +-
 .../archiva/scheduler/repository/RepositoryTaskJob.java   |  1 +
 .../web/security/ArchivaConfigurableUsersManager.java     | 12 ++++++------
 9 files changed, 25 insertions(+), 17 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 c19d12f..86e96a5 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
@@ -98,7 +98,7 @@ import java.util.Set;
 public class DefaultArchivaConfiguration
     implements ArchivaConfiguration, RegistryListener
 {
-    private Logger log = LoggerFactory.getLogger( DefaultArchivaConfiguration.class );
+    private final Logger log = LoggerFactory.getLogger( DefaultArchivaConfiguration.class
);
 
     private static String FILE_ENCODING = "UTF-8";
 
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java
b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java
index 209f75a..535db81 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java
@@ -46,9 +46,9 @@ public class ProxyConnectorSelectionPredicate
     {
         boolean satisfies = false;
 
-        if ( object instanceof ProxyConnectorConfiguration )
+        if ( object != null )
         {
-            ProxyConnectorConfiguration connector = (ProxyConnectorConfiguration) object;
+            ProxyConnectorConfiguration connector = object;
             return ( StringUtils.equals( sourceId, connector.getSourceRepoId() ) &&
StringUtils.equals( targetId,
                                                                                         
               connector.getTargetRepoId() ) );
         }
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 d5dc6f5..277bd2a 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
@@ -212,7 +212,6 @@
             <Import-Package>
               javax.annotation,
               javax.inject,
-              org.apache.archiva.admin.model*;version=${project.version},
               org.apache.archiva.checksum;version=${project.version},
               org.apache.archiva.common.utils;version=${project.version},
               org.apache.archiva.configuration;version=${project.version},
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
index bb489a2..1052ad8 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
@@ -157,7 +157,6 @@
             <Import-Package>
               javax.annotation,
               javax.inject,
-              org.apache.archiva.admin.model*;version=${project.version},
               org.apache.archiva.common.plexusbridge;version=${project.version},
               org.apache.archiva.configuration;version=${project.version},
               org.apache.archiva.consumers;version=${project.version},
diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java
b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java
index 052b549..1bf1e50 100644
--- a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java
+++ b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/archiva/policies/urlcache/DefaultUrlFailureCache.java
@@ -33,10 +33,10 @@ import java.util.Date;
 public class DefaultUrlFailureCache
     implements UrlFailureCache
 {
-    private Cache urlCache;
+    private Cache<String, Date> urlCache;
 
     @Inject
-    public DefaultUrlFailureCache( @Named( "cache#url-failures-cache" ) Cache urlCache )
+    public DefaultUrlFailureCache( @Named( "cache#url-failures-cache" ) Cache<String,
Date> urlCache )
     {
         this.urlCache = urlCache;
     }
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java
b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java
index 061133f..73114fc 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/RepositoryRegistry.java
@@ -195,7 +195,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
         } catch (Throwable e) {
             log.error("Could not initialize repositories from config: {}",e.getMessage(),
e );
             //noinspection unchecked
-            return Collections.EMPTY_MAP;
+            return Collections.emptyMap();
         }
     }
 
@@ -209,6 +209,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
 
     }
 
+    @SuppressWarnings( "unchecked" )
     private void updateRepositoryReferences(RepositoryProvider provider, ManagedRepository
repo, ManagedRepositoryConfiguration cfg, Configuration configuration) throws RepositoryException
     {
         log.debug("Updating references of repo {}",repo.getId());
@@ -284,7 +285,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
             if ( remoteRepoConfigs == null )
             {
                 //noinspection unchecked
-                return Collections.EMPTY_MAP;
+                return Collections.emptyMap();
             }
 
             Map<String, RemoteRepository> remoteRepos = new LinkedHashMap<>(
remoteRepoConfigs.size( ) );
@@ -313,7 +314,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
         } catch (Throwable e) {
             log.error("Could not initialize remote repositories from config: {}", e.getMessage(),
e);
             //noinspection unchecked
-            return Collections.EMPTY_MAP;
+            return Collections.emptyMap();
         }
     }
 
@@ -327,6 +328,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
 
     }
 
+    @SuppressWarnings( "unchecked" )
     private void updateRepositoryReferences( RepositoryProvider provider, RemoteRepository
repo, RemoteRepositoryConfiguration cfg, Configuration configuration) throws RepositoryException
     {
         if ( repo instanceof EditableRemoteRepository && repo.getContent() == null)
@@ -570,6 +572,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
      * @return the new or updated repository
      * @throws RepositoryException if the configuration cannot be saved or updated
      */
+    @SuppressWarnings( "unchecked" )
     public ManagedRepository putRepository( ManagedRepositoryConfiguration managedRepositoryConfiguration,
Configuration configuration) throws RepositoryException
     {
         rwLock.writeLock( ).lock( );
@@ -751,6 +754,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
      * @return the new or updated repository
      * @throws RepositoryException if the configuration cannot be saved or updated
      */
+    @SuppressWarnings( "unchecked" )
     public RemoteRepository putRepository( RemoteRepositoryConfiguration remoteRepositoryConfiguration,
Configuration configuration) throws RepositoryException
     {
         rwLock.writeLock( ).lock( );
@@ -791,6 +795,8 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
             removeRepository(repo);
         }
     }
+
+    @SuppressWarnings( "unchecked" )
     public void removeRepository(Repository repo) throws RepositoryException
     {
         if (repo instanceof RemoteRepository ) {
@@ -946,6 +952,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
      * @param repo
      * @throws IndexUpdateFailedException
      */
+    @SuppressWarnings( "unchecked" )
     public void resetIndexingContext(Repository repo) throws IndexUpdateFailedException {
         if (repo.hasIndex() && repo instanceof EditableRepository) {
             EditableRepository eRepo = (EditableRepository) repo;
@@ -975,6 +982,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
         return cloned;
     }
 
+    @SuppressWarnings( "unchecked" )
     public <T extends Repository> Repository clone(T repo, String newId) throws RepositoryException
{
         if (repo instanceof RemoteRepository ) {
             return this.clone((RemoteRepository)repo, newId);
@@ -1029,6 +1037,7 @@ public class RepositoryRegistry implements ConfigurationListener, RepositoryEven
         this.listeners.clear();
     }
 
+    @SuppressWarnings( "unchecked" )
     @Override
     public <T> void raise(RepositoryEvent<T> event) {
         if (event instanceof IndexCreationEvent ) {
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
index 18c775e..4da5b23 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
@@ -73,7 +73,7 @@ public class DefaultRepositoryArchivaTaskScheduler
 
     @Inject
     @Named( value = "taskQueue#repository-scanning" )
-    private TaskQueue repositoryScanningQueue;
+    private TaskQueue<RepositoryTask> repositoryScanningQueue;
 
     @Inject
     private ArchivaConfiguration archivaConfiguration;
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java
b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java
index 92e5131..6f97495 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryTaskJob.java
@@ -39,6 +39,7 @@ public class RepositoryTaskJob
      * @param context
      * @throws org.quartz.JobExecutionException
      */
+    @SuppressWarnings( "unchecked" )
     @Override
     public void execute( JobExecutionContext context )
         throws JobExecutionException
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
index 9ea05cb..6be5929 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
@@ -270,7 +270,7 @@ public class ArchivaConfigurableUsersManager
 
         for ( UserManager userManager : userManagerPerId.values() )
         {
-            List<User> found = userManager.findUsersByEmailKey( emailKey, orderAscending
);
+            List<? extends User> found = userManager.findUsersByEmailKey( emailKey,
orderAscending );
             if ( found != null )
             {
                 users.addAll( found );
@@ -287,7 +287,7 @@ public class ArchivaConfigurableUsersManager
 
         for ( UserManager userManager : userManagerPerId.values() )
         {
-            List<User> found = userManager.findUsersByFullNameKey( fullNameKey, orderAscending
);            
+            List<? extends User> found = userManager.findUsersByFullNameKey( fullNameKey,
orderAscending );
             if ( found != null )
             {
                 users.addAll( found );
@@ -304,7 +304,7 @@ public class ArchivaConfigurableUsersManager
 
         for ( UserManager userManager : userManagerPerId.values() )
         {
-            List<User> found = userManager.findUsersByQuery( query );
+            List<? extends User> found = userManager.findUsersByQuery( query );
             if ( found != null )
             {
                 users.addAll( found );
@@ -321,7 +321,7 @@ public class ArchivaConfigurableUsersManager
 
         for ( UserManager userManager : userManagerPerId.values() )
         {
-            List<User> found = userManager.findUsersByUsernameKey( usernameKey, orderAscending
);
+            List<? extends User> found = userManager.findUsersByUsernameKey( usernameKey,
orderAscending );
             if ( found != null )
             {
                 users.addAll( found );
@@ -344,7 +344,7 @@ public class ArchivaConfigurableUsersManager
 
         for ( UserManager userManager : userManagerPerId.values() )
         {
-            List<User> found = userManager.getUsers();
+            List<? extends User> found = userManager.getUsers();
             if ( found != null )
             {
                 users.addAll( found );
@@ -361,7 +361,7 @@ public class ArchivaConfigurableUsersManager
 
         for ( UserManager userManager : userManagerPerId.values() )
         {
-            List<User> found = userManager.getUsers( orderAscending );
+            List<? extends User> found = userManager.getUsers( orderAscending );
             if ( found != null )
             {
                 users.addAll( found );

-- 
To stop receiving notification emails like this one, please contact
martin_s@apache.org.

Mime
View raw message