cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] cxf git commit: Refactor of XKMS service
Date Thu, 26 Mar 2015 13:03:51 GMT
Refactor of XKMS service


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

Branch: refs/heads/master
Commit: b1b3fc2e1b4a0637d85bb67eb0a59abde91b0f9a
Parents: 399c5bb
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Mar 26 10:23:05 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Mar 26 12:03:32 2015 +0000

----------------------------------------------------------------------
 .../cxf/xkms/client/XKMSClientFactory.java      |  2 +-
 .../org/apache/cxf/xkms/client/XKMSInvoker.java |  4 +-
 .../crypto/provider/CryptoProviderUtils.java    | 89 +++-----------------
 .../provider/XkmsCryptoProviderFactory.java     | 12 +--
 .../apache/cxf/xkms/handlers/Applications.java  |  2 +-
 .../cxf/xkms/handlers/HandlerContext.java       |  2 +-
 .../apache/cxf/xkms/service/XKMSService.java    |  6 +-
 .../cxf/xkms/x509/handlers/X509Locator.java     |  4 +-
 .../cxf/xkms/x509/handlers/X509Register.java    |  2 +-
 .../x509/repo/file/FileCertificateRepo.java     | 12 +--
 .../validator/TrustedAuthorityValidator.java    |  2 +-
 .../x509/validator/ValidateRequestParser.java   |  2 +-
 .../x509/repo/ldap/LdapCertificateRepo.java     |  4 +-
 .../cxf/xkms/x509/repo/ldap/LdapSearch.java     |  2 +-
 14 files changed, 37 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSClientFactory.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSClientFactory.java
b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSClientFactory.java
index 9bebe92..defd337 100644
--- a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSClientFactory.java
+++ b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSClientFactory.java
@@ -37,7 +37,7 @@ public final class XKMSClientFactory {
         factory.setServiceClass(XKMSPortType.class);
         factory.setAddress(endpointAddress);
         
-        Map<String, Object> properties = new HashMap<String, Object>();
+        Map<String, Object> properties = new HashMap<>();
         properties.put("jaxb.additionalContextClasses", 
                        new Class[] {ResultDetails.class});
         factory.setProperties(properties);

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
index 8a822ea..8a775ef 100644
--- a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
+++ b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
@@ -82,14 +82,14 @@ public class XKMSInvoker {
     }
     
     public X509Certificate getCertificateForIssuerSerial(String issuerDN, BigInteger serial)
{
-        List<X509AppId> ids = new ArrayList<X509AppId>();
+        List<X509AppId> ids = new ArrayList<>();
         ids.add(new X509AppId(Applications.ISSUER, issuerDN));
         ids.add(new X509AppId(Applications.SERIAL, serial.toString(16)));
         return getCertificate(ids);
     }
 
     public X509Certificate getCertificateForEndpoint(String endpoint) {
-        List<X509AppId> ids = new ArrayList<X509AppId>();
+        List<X509AppId> ids = new ArrayList<>();
         ids.add(new X509AppId(Applications.SERVICE_ENDPOINT, endpoint));
         return getCertificate(ids);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/CryptoProviderUtils.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/CryptoProviderUtils.java
b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/CryptoProviderUtils.java
index a5fc8be..1d55a25 100644
--- a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/CryptoProviderUtils.java
+++ b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/CryptoProviderUtils.java
@@ -19,21 +19,16 @@
 
 package org.apache.cxf.xkms.crypto.provider;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
 import java.util.Properties;
 
 import javax.security.auth.callback.CallbackHandler;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.resource.ResourceManager;
-import org.apache.cxf.ws.security.SecurityConstants;
+import org.apache.cxf.rt.security.utils.SecurityUtils;
 import org.apache.cxf.xkms.crypto.CryptoProviderException;
 import org.apache.wss4j.common.crypto.Merlin;
 import org.apache.wss4j.common.ext.WSPasswordCallback;
+import org.apache.wss4j.common.ext.WSSecurityException;
 
 final class CryptoProviderUtils {
 
@@ -46,53 +41,7 @@ final class CryptoProviderUtils {
             throw new CryptoProviderException("Keystore properties path is not defined");
         }
 
-        Properties properties = null;
-        if (o instanceof Properties) {
-            properties = (Properties)o;
-        } else if (o instanceof String) {
-            ResourceManager rm = message.getExchange().get(Bus.class)
-                .getExtension(ResourceManager.class);
-            URL url = rm.resolveResource((String)o, URL.class);
-            try {
-                if (url == null) {
-                    url = ClassLoaderUtils.getResource((String)o, CryptoProviderUtils.class);
-                }
-                if (url == null) {
-                    try {
-                        url = new URL((String)o);
-                    } catch (Exception ex) {
-                        // ignore
-                    }
-                }
-                if (url != null) {
-                    InputStream ins = url.openStream();
-                    properties = new Properties();
-                    properties.load(ins);
-                    ins.close();
-                } else {
-                    throw new CryptoProviderException("Keystore properties url is not resolved:
"
-                                                      + o);
-                }
-            } catch (IOException e) {
-                throw new CryptoProviderException("Cannot load keystore properties: "
-                                                  + e.getMessage(), e);
-            }
-        } else if (o instanceof URL) {
-            properties = new Properties();
-            try {
-                InputStream ins = ((URL)o).openStream();
-                properties.load(ins);
-                ins.close();
-            } catch (IOException e) {
-                throw new CryptoProviderException("Cannot load keystore properties: "
-                                                  + e.getMessage(), e);
-            }
-        }
-        if (properties == null) {
-            throw new CryptoProviderException("Cannot load keystore properties: " + o);
-        }
-
-        return properties;
+        return SecurityUtils.loadProperties(o);
     }
 
     public static String getKeystoreAlias(Properties keystoreProps) {
@@ -110,32 +59,18 @@ final class CryptoProviderUtils {
         return keystoreAlias;
     }
 
-    public static CallbackHandler getCallbackHandler(Message message) {
-        Object o = message.getContextualProperty(SecurityConstants.CALLBACK_HANDLER);
-
-        CallbackHandler handler = null;
-        if (o instanceof CallbackHandler) {
-            handler = (CallbackHandler)o;
-        } else if (o instanceof String) {
-            try {
-                handler = (CallbackHandler)ClassLoaderUtils
-                    .loadClass((String)o, CryptoProviderUtils.class).newInstance();
-            } catch (Exception e) {
-                handler = null;
-            }
-        }
-
-        return handler;
-    }
-
     public static String getCallbackPwdFromMessage(Message message, String userName, int
usage) {
         // Then try to get the password from the given callback handler
-        CallbackHandler handler = getCallbackHandler(message);
-        if (handler == null) {
-            throw new CryptoProviderException("No callback handler and no password available");
+        try {
+            CallbackHandler handler = SecurityUtils.getCallbackHandler(message);
+            if (handler == null) {
+                throw new CryptoProviderException("No callback handler and no password available");
+            }
+    
+            return getCallbackPwd(userName, usage, handler);
+        } catch (WSSecurityException ex) {
+            throw new CryptoProviderException("No callback handler and no password available",
ex);
         }
-
-        return getCallbackPwd(userName, usage, handler);
     }
 
     public static String getCallbackPwd(String userName, int usage, CallbackHandler handler)
{

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProviderFactory.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProviderFactory.java
b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProviderFactory.java
index 881885b..95536cc 100644
--- a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProviderFactory.java
+++ b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProviderFactory.java
@@ -19,11 +19,10 @@
 
 package org.apache.cxf.xkms.crypto.provider;
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.Properties;
 
 import org.apache.cxf.message.Message;
+import org.apache.cxf.rt.security.utils.SecurityUtils;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.xkms.crypto.CryptoProviderException;
 import org.apache.cxf.xkms.crypto.CryptoProviderFactory;
@@ -81,21 +80,16 @@ public class XkmsCryptoProviderFactory implements CryptoProviderFactory
{
     @Override
     public Crypto create(String keystorePropsPath) {
         try {
-            Properties keystoreProps = new Properties();
-            InputStream is = this.getClass().getResourceAsStream(keystorePropsPath);
-            if (is == null) {
+            Properties keystoreProps = SecurityUtils.loadProperties(keystorePropsPath);
+            if (keystoreProps == null) {
                 throw new CryptoProviderException("Cannot load security properties: "
                     + keystorePropsPath);
             }
-            keystoreProps.load(is);
             Crypto defaultCrypto = CryptoFactory.getInstance(keystoreProps);
             return new XkmsCryptoProvider(xkmsConsumer, defaultCrypto);
         } catch (WSSecurityException e) {
             throw new CryptoProviderException("Cannot instantiate crypto factory: "
                 + e.getMessage(), e);
-        } catch (IOException e) {
-            throw new CryptoProviderException("Cannot load security properties: "
-                + e.getMessage(), e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/Applications.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/Applications.java
b/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/Applications.java
index f1532eb..84e1a25 100644
--- a/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/Applications.java
+++ b/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/Applications.java
@@ -59,7 +59,7 @@ public enum Applications {
     }
     
     public static Applications fromUri(String uri) {
-        for (Applications app :  Applications.values()) {
+        for (Applications app : Applications.values()) {
             if (app.getUri().equals(uri)) {
                 return app;
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/HandlerContext.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/HandlerContext.java
b/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/HandlerContext.java
index 9debbb7..98c0658 100644
--- a/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/HandlerContext.java
+++ b/services/xkms/xkms-common/src/main/java/org/apache/cxf/xkms/handlers/HandlerContext.java
@@ -24,7 +24,7 @@ import java.util.Map;
 
 public class HandlerContext {
     
-    private Map<Class<?>, Object> contextMap = new HashMap<Class<?>,
Object>();
+    private Map<Class<?>, Object> contextMap = new HashMap<>();
 
     public HandlerContext() {
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java
b/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java
index 91f553e..6072694 100644
--- a/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java
+++ b/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/XKMSService.java
@@ -63,9 +63,9 @@ public class XKMSService implements XKMSPortType {
     protected static final Logger LOG = LogUtils.getL7dLogger(XKMSService.class);
 
     private String serviceName = XKMSConstants.XKMS_ENDPOINT_NAME;
-    private List<Locator> locators = new ArrayList<Locator>();
-    private List<Validator> validators = new ArrayList<Validator>();
-    private List<Register> keyRegisterHandlers = new ArrayList<Register>();
+    private List<Locator> locators = new ArrayList<>();
+    private List<Validator> validators = new ArrayList<>();
+    private List<Register> keyRegisterHandlers = new ArrayList<>();
     private boolean enableXKRSS = true;
     private boolean logExceptions;
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Locator.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Locator.java
b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Locator.java
index 5af0392..a906fe7 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Locator.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Locator.java
@@ -104,7 +104,7 @@ public class X509Locator implements Locator {
     }
     
     private List<UseKeyWithType> parse(LocateRequestType request) {
-        List<UseKeyWithType> keyIDs = new ArrayList<UseKeyWithType>();
+        List<UseKeyWithType> keyIDs = new ArrayList<>();
         if (request == null) {
             return keyIDs;
         }
@@ -129,7 +129,7 @@ public class X509Locator implements Locator {
     }
 
     private List<UseKeyWithType> parse(KeyInfoType keyInfo) {
-        List<UseKeyWithType> keyIDs = new ArrayList<UseKeyWithType>();
+        List<UseKeyWithType> keyIDs = new ArrayList<>();
 
         if (keyInfo == null) {
             return keyIDs;

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Register.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Register.java
b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Register.java
index 79c3a94..8a1f920 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Register.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/handlers/X509Register.java
@@ -120,7 +120,7 @@ public class X509Register implements Register {
     }
 
     private List<X509Certificate> getCertsFromKeyInfo(KeyInfoType keyInfo) throws CertificateException
{
-        List<X509Certificate> certList = new ArrayList<X509Certificate>();
+        List<X509Certificate> certList = new ArrayList<>();
         for (Object key : keyInfo.getContent()) {
             if (key instanceof JAXBElement) {
                 Object value = ((JAXBElement<?>) key).getValue();

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
index e1b3f86..9c2e2a1 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
@@ -156,7 +156,7 @@ public class FileCertificateRepo implements CertificateRepo {
     }
 
     private File[] getX509Files() {
-        List<File> certificateFiles = new ArrayList<File>();
+        List<File> certificateFiles = new ArrayList<>();
         try {
             certificateFiles.addAll(Arrays.asList(storageDir.listFiles()));
             certificateFiles.addAll(Arrays.asList(new File(storageDir + "/" + TRUSTED_CAS_PATH).listFiles()));
@@ -186,7 +186,7 @@ public class FileCertificateRepo implements CertificateRepo {
 
     @Override
     public List<X509Certificate> getTrustedCaCerts() {
-        List<X509Certificate> results = new ArrayList<X509Certificate>();
+        List<X509Certificate> results = new ArrayList<>();
         File[] list = getX509Files();
         for (File certFile : list) {
             try {
@@ -208,7 +208,7 @@ public class FileCertificateRepo implements CertificateRepo {
 
     @Override
     public List<X509Certificate> getCaCerts() {
-        List<X509Certificate> results = new ArrayList<X509Certificate>();
+        List<X509Certificate> results = new ArrayList<>();
         File[] list = getX509Files();
         for (File certFile : list) {
             try {
@@ -230,7 +230,7 @@ public class FileCertificateRepo implements CertificateRepo {
     
     @Override
     public List<X509CRL> getCRLs() {
-        List<X509CRL> results = new ArrayList<X509CRL>();
+        List<X509CRL> results = new ArrayList<>();
         File[] list = getX509Files();
         for (File crlFile : list) {
             try {
@@ -277,7 +277,7 @@ public class FileCertificateRepo implements CertificateRepo {
 
     @Override
     public X509Certificate findBySubjectDn(String subjectDn) {
-        List<X509Certificate> result = new ArrayList<X509Certificate>();
+        List<X509Certificate> result = new ArrayList<>();
         File[] list = getX509Files();
         for (File certFile : list) {
             try {
@@ -305,7 +305,7 @@ public class FileCertificateRepo implements CertificateRepo {
 
     @Override
     public X509Certificate findByIssuerSerial(String issuer, String serial) {
-        List<X509Certificate> result = new ArrayList<X509Certificate>();
+        List<X509Certificate> result = new ArrayList<>();
         File[] list = getX509Files();
         for (File certFile : list) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
index 2c6c844..958d25b 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/TrustedAuthorityValidator.java
@@ -116,7 +116,7 @@ public class TrustedAuthorityValidator implements Validator {
     }
 
     private Set<TrustAnchor> asTrustAnchors(List<X509Certificate> trustedAuthorityCerts)
{
-        Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
+        Set<TrustAnchor> trustAnchors = new HashSet<>();
         for (X509Certificate trustedAuthorityCert : trustedAuthorityCerts) {
             trustAnchors.add(new TrustAnchor(trustedAuthorityCert, null));
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/ValidateRequestParser.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/ValidateRequestParser.java
b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/ValidateRequestParser.java
index 4def1ea..e545d0f 100644
--- a/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/ValidateRequestParser.java
+++ b/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/validator/ValidateRequestParser.java
@@ -43,7 +43,7 @@ public final class ValidateRequestParser {
      * Extract the X509 certificates from ValidateRequestType and return them as list.
      */
     public static List<X509Certificate> parse(ValidateRequestType request) {
-        List<X509Certificate> certs = new ArrayList<X509Certificate>();
+        List<X509Certificate> certs = new ArrayList<>();
 
         if ((request.getQueryKeyBinding()) != null && (request.getQueryKeyBinding().getKeyInfo()
!= null)) {
             List<Object> keyInfoContent = request.getQueryKeyBinding().getKeyInfo().getContent();

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
b/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
index b28e6ba..8336274 100644
--- a/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
+++ b/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java
@@ -96,7 +96,7 @@ public class LdapCertificateRepo implements CertificateRepo {
 
     private List<X509Certificate> getCertificatesFromLdap(String tmpRootDN, String
tmpFilter, String tmpAttrName) {
         try {
-            List<X509Certificate> certificates = new ArrayList<X509Certificate>();
+            List<X509Certificate> certificates = new ArrayList<>();
             NamingEnumeration<SearchResult> answer = ldapSearch.searchSubTree(tmpRootDN,
tmpFilter);
             while (answer.hasMore()) {
                 SearchResult sr = answer.next();
@@ -119,7 +119,7 @@ public class LdapCertificateRepo implements CertificateRepo {
     
     private List<X509CRL> getCRLsFromLdap(String tmpRootDN, String tmpFilter, String
tmpAttrName) {
         try {
-            List<X509CRL> crls = new ArrayList<X509CRL>();
+            List<X509CRL> crls = new ArrayList<>();
             NamingEnumeration<SearchResult> answer = ldapSearch.searchSubTree(tmpRootDN,
tmpFilter);
             while (answer.hasMore()) {
                 SearchResult sr = answer.next();

http://git-wip-us.apache.org/repos/asf/cxf/blob/b1b3fc2e/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapSearch.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapSearch.java
b/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapSearch.java
index 7e42db3..3a5c0bf 100644
--- a/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapSearch.java
+++ b/services/xkms/xkms-x509-repo-ldap/src/main/java/org/apache/cxf/xkms/x509/repo/ldap/LdapSearch.java
@@ -57,7 +57,7 @@ public class LdapSearch {
 
     //CHECKSTYLE:OFF
     private InitialDirContext createInitialContext() throws NamingException {
-        Hashtable<String, String> env = new Hashtable<String, String>(5);
+        Hashtable<String, String> env = new Hashtable<>(5);
         env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
         env.put(javax.naming.Context.PROVIDER_URL, ldapuri.toString());
         env.put(javax.naming.Context.SECURITY_AUTHENTICATION, SECURITY_AUTHENTICATION);


Mime
View raw message