archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject [archiva-redback-core] branch master updated: Reducing compiler warnings
Date Sun, 08 Apr 2018 14:32:35 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-redback-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 51c9a3e  Reducing compiler warnings
51c9a3e is described below

commit 51c9a3ef425c243920b0ca7f05f66b00fdc97460
Author: Martin Stockhammer <martin_s@apache.org>
AuthorDate: Sun Apr 8 15:56:18 2018 +0200

    Reducing compiler warnings
---
 pom.xml                                                      |  6 ++++++
 .../redback/common/ldap/role/DefaultLdapRoleMapper.java      | 12 ++++++------
 .../org/apache/archiva/redback/keys/jpa/JpaKeyManager.java   |  2 +-
 .../org/apache/archiva/redback/keys/KeyManagerTestCase.java  |  2 +-
 redback-rbac/redback-rbac-model/pom.xml                      |  4 ++--
 .../org/apache/archiva/redback/rbac/AbstractRBACManager.java |  2 +-
 6 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/pom.xml b/pom.xml
index d09bb38..4c6a29c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@
     <springVersion>4.3.10.RELEASE</springVersion>
     <slf4jVersion>1.7.25</slf4jVersion>
     <log4j2Version>2.8.2</log4j2Version>
+    <commons-collections.version>4.1</commons-collections.version>
 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <gpg.useagent>true</gpg.useagent>
@@ -411,6 +412,11 @@
         <version>3.2</version>
       </dependency>
       <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-collections4</artifactId>
+        <version>${commons-collections.version}</version>
+      </dependency>
+      <dependency>
         <groupId>commons-codec</groupId>
         <artifactId>commons-codec</artifactId>
         <version>1.6</version>
diff --git a/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java
b/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java
index a8348f9..8cfffc3 100644
--- a/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java
+++ b/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java
@@ -312,10 +312,10 @@ public class DefaultLdapRoleMapper
 
                 if ( uniqueMemberAttr != null )
                 {
-                    NamingEnumeration<String> allMembersEnum = (NamingEnumeration<String>)
uniqueMemberAttr.getAll();
+                    NamingEnumeration<?> allMembersEnum = uniqueMemberAttr.getAll();
                     while ( allMembersEnum.hasMore() )
                     {
-                        String userName = allMembersEnum.next();
+                        String userName = allMembersEnum.next().toString();
                         // uid=blabla we only want bla bla
                         userName = StringUtils.substringAfter( userName, "=" );
                         userName = StringUtils.substringBefore( userName, "," );
@@ -420,11 +420,11 @@ public class DefaultLdapRoleMapper
 
                 if ( uniqueMemberAttr != null )
                 {
-                    NamingEnumeration<String> allMembersEnum = (NamingEnumeration<String>)
uniqueMemberAttr.getAll();
+                    NamingEnumeration<?> allMembersEnum = uniqueMemberAttr.getAll();
                     while ( allMembersEnum.hasMore() )
                     {
 
-                        String userName = allMembersEnum.next();
+                        String userName = allMembersEnum.next().toString();
                         //the original dn
                         allMembers.add( userName );
                         // uid=blabla we only want bla bla
@@ -621,7 +621,7 @@ public class DefaultLdapRoleMapper
 
             namingEnumeration = context.search( "cn=" + groupName + "," + getGroupsDn(),
filter, searchControls );
 
-            while ( namingEnumeration.hasMore() )
+            if ( namingEnumeration.hasMore() )
             {
                 SearchResult searchResult = namingEnumeration.next();
                 Attribute attribute = searchResult.getAttributes().get( getLdapGroupMember()
);
@@ -692,7 +692,7 @@ public class DefaultLdapRoleMapper
 
             namingEnumeration = context.search( "cn=" + groupName + "," + getGroupsDn(),
filter, searchControls );
 
-            while ( namingEnumeration.hasMore() )
+            if ( namingEnumeration.hasMore() )
             {
                 SearchResult searchResult = namingEnumeration.next();
                 Attribute attribute = searchResult.getAttributes().get( getLdapGroupMember()
);
diff --git a/redback-keys/redback-keys-providers/redback-keys-jpa/src/main/java/org/apache/archiva/redback/keys/jpa/JpaKeyManager.java
b/redback-keys/redback-keys-providers/redback-keys-jpa/src/main/java/org/apache/archiva/redback/keys/jpa/JpaKeyManager.java
index 0a934b4..6d2affd 100644
--- a/redback-keys/redback-keys-providers/redback-keys-jpa/src/main/java/org/apache/archiva/redback/keys/jpa/JpaKeyManager.java
+++ b/redback-keys/redback-keys-providers/redback-keys-jpa/src/main/java/org/apache/archiva/redback/keys/jpa/JpaKeyManager.java
@@ -166,7 +166,7 @@ public class JpaKeyManager extends AbstractKeyManager {
     @Override
     public List<AuthenticationKey> getAllKeys() {
         final EntityManager em = getEm();
-        Query q= em.createQuery("SELECT x from JpaAuthenticationKey x");
+        TypedQuery<AuthenticationKey> q= em.createQuery("SELECT x from JpaAuthenticationKey
x", AuthenticationKey.class);
         return q.getResultList();
     }
 
diff --git a/redback-keys/redback-keys-tests/src/main/java/org/apache/archiva/redback/keys/KeyManagerTestCase.java
b/redback-keys/redback-keys-tests/src/main/java/org/apache/archiva/redback/keys/KeyManagerTestCase.java
index b3c0f3c..dbdf8fe 100644
--- a/redback-keys/redback-keys-tests/src/main/java/org/apache/archiva/redback/keys/KeyManagerTestCase.java
+++ b/redback-keys/redback-keys-tests/src/main/java/org/apache/archiva/redback/keys/KeyManagerTestCase.java
@@ -114,7 +114,7 @@ public class KeyManagerTestCase
 
         System.out.println("foo key "+created1.getKey());
         System.out.println("bar key "+created2.getKey());
-        List<AuthenticationKey> keys = new ArrayList(getKeyManager().getAllKeys());
+        List<AuthenticationKey> keys = new ArrayList<>(getKeyManager().getAllKeys());
         Collections.sort( keys, new Comparator<AuthenticationKey>()
         {
             public int compare( AuthenticationKey key1, AuthenticationKey key2 )
diff --git a/redback-rbac/redback-rbac-model/pom.xml b/redback-rbac/redback-rbac-model/pom.xml
index 07366c0..ed6219a 100644
--- a/redback-rbac/redback-rbac-model/pom.xml
+++ b/redback-rbac/redback-rbac-model/pom.xml
@@ -37,8 +37,8 @@
       <artifactId>commons-lang</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
diff --git a/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java
b/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java
index ce495da..537ad16 100644
--- a/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java
+++ b/redback-rbac/redback-rbac-model/src/main/java/org/apache/archiva/redback/rbac/AbstractRBACManager.java
@@ -16,7 +16,7 @@ package org.apache.archiva.redback.rbac;
  * limitations under the License.
  */
 
-import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

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

Mime
View raw message