Reducing compiler warnings

This commit is contained in:
Martin Stockhammer 2018-04-08 15:56:18 +02:00
parent 107cd119d4
commit 51c9a3ef42
6 changed files with 17 additions and 11 deletions

View File

@ -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>
@ -410,6 +411,11 @@
<!-- commons-configuration requires this version. -->
<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>

View File

@ -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() );

View File

@ -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();
}

View File

@ -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 )

View File

@ -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>

View File

@ -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;