karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [12/27] karaf git commit: Fix warnings
Date Thu, 17 Aug 2017 14:30:04 GMT
Fix warnings


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/713d25d4
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/713d25d4
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/713d25d4

Branch: refs/heads/model_features
Commit: 713d25d4ffd40ad669a53b5d1fa9d8b497fc8b57
Parents: 767012d
Author: Christian Schneider <chris@die-schneider.net>
Authored: Tue Aug 15 23:30:07 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Tue Aug 15 23:30:07 2017 +0200

----------------------------------------------------------------------
 .../apache/karaf/jaas/modules/ldap/LDAPBackingEngine.java    | 5 ++---
 .../java/org/apache/karaf/jaas/modules/ldap/LDAPCache.java   | 8 ++++----
 .../java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java | 6 +++---
 3 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/713d25d4/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPBackingEngine.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPBackingEngine.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPBackingEngine.java
index 5bd3072..4ee865e 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPBackingEngine.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPBackingEngine.java
@@ -33,7 +33,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
@@ -87,10 +86,10 @@ public class LDAPBackingEngine implements BackingEngine {
             LOGGER.debug("  base DN: " + options.getUserBaseDn());
             LOGGER.debug("  filter: " + filter);
 
-            NamingEnumeration namingEnumeration = context.search(options.getUserBaseDn(),
filter, controls);
+            NamingEnumeration<SearchResult> namingEnumeration = context.search(options.getUserBaseDn(),
filter, controls);
             try {
                 while (namingEnumeration.hasMore()) {
-                    SearchResult result = (SearchResult) namingEnumeration.next();
+                    SearchResult result = namingEnumeration.next();
 
                     // We need to do the following because slashes are handled badly. For
example, when searching
                     // for a user with lots of special characters like cn=admin,=+<>#;\

http://git-wip-us.apache.org/repos/asf/karaf/blob/713d25d4/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPCache.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPCache.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPCache.java
index f80af8c..7566165 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPCache.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPCache.java
@@ -165,14 +165,14 @@ public class LDAPCache implements Closeable, NamespaceChangeListener,
ObjectChan
         LOGGER.debug("  base DN: " + options.getUserBaseDn());
         LOGGER.debug("  filter: " + filter);
 
-        NamingEnumeration namingEnumeration = context.search(options.getUserBaseDn(), filter,
controls);
+        NamingEnumeration<SearchResult> namingEnumeration = context.search(options.getUserBaseDn(),
filter, controls);
         try {
             if (!namingEnumeration.hasMore()) {
                 LOGGER.warn("User " + user + " not found in LDAP.");
                 return null;
             }
             LOGGER.debug("Found the user DN.");
-            SearchResult result = (SearchResult) namingEnumeration.next();
+            SearchResult result = namingEnumeration.next();
 
             // We need to do the following because slashes are handled badly. For example,
when searching
             // for a user with lots of special characters like cn=admin,=+<>#;\
@@ -250,11 +250,11 @@ public class LDAPCache implements Closeable, NamespaceChangeListener,
ObjectChan
             LOGGER.debug("  base DN: " + options.getRoleBaseDn());
             LOGGER.debug("  filter: " + filter);
 
-            NamingEnumeration namingEnumeration = context.search(options.getRoleBaseDn(),
filter, controls);
+            NamingEnumeration<SearchResult> namingEnumeration = context.search(options.getRoleBaseDn(),
filter, controls);
             try {
                 List<String> rolesList = new ArrayList<>();
                 while (namingEnumeration.hasMore()) {
-                    SearchResult result = (SearchResult) namingEnumeration.next();
+                    SearchResult result = namingEnumeration.next();
                     Attributes attributes = result.getAttributes();
                     Attribute roles1 = attributes.get(options.getRoleNameAttribute());
                     if (roles1 != null) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/713d25d4/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
index 90c3333..38b4d44 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPOptions.java
@@ -165,13 +165,13 @@ public class LDAPOptions {
 
     protected void setupSsl(Hashtable<String, Object> env) throws NamingException {
         BundleContext bundleContext = FrameworkUtil.getBundle(LDAPOptions.class).getBundleContext();
-        ServiceReference ref = null;
+        ServiceReference<KeystoreManager> ref = null;
         try {
             LOGGER.debug("Setting up SSL");
             env.put(Context.SECURITY_PROTOCOL, "ssl");
             env.put("java.naming.ldap.factory.socket", ManagedSSLSocketFactory.class.getName());
-            ref = bundleContext.getServiceReference(KeystoreManager.class.getName());
-            KeystoreManager manager = (KeystoreManager) bundleContext.getService(ref);
+            ref = bundleContext.getServiceReference(KeystoreManager.class);
+            KeystoreManager manager = bundleContext.getService(ref);
             SSLSocketFactory factory = manager.createSSLFactory(
                     getSslProvider(), getSslProtocol(), getSslAlgorithm(), getSslKeystore(),
                     getSslKeyAlias(), getSslTrustStore(), getSslTimeout());


Mime
View raw message