cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: More code cleanup
Date Mon, 18 May 2015 13:55:11 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 591e5d9cb -> 7e4eb471f


More code cleanup


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

Branch: refs/heads/master
Commit: 7e4eb471fd6b19d73b2e91748a736f6205fc393f
Parents: 591e5d9
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon May 18 14:55:01 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon May 18 14:55:01 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/common/util/CacheMap.java     |  6 +++---
 .../cxf/configuration/jsse/TLSParameterJaxBUtils.java |  3 ---
 .../interceptor/security/DefaultSecurityContext.java  |  4 ++--
 .../org/apache/cxf/staxutils/W3CDOMStreamReader.java  |  6 +-----
 .../soap/interceptor/SoapActionInInterceptor.java     |  2 +-
 .../cxf/ext/logging/event/DefaultLogEventMapper.java  | 14 ++++++++------
 .../org/apache/cxf/ext/logging/osgi/Activator.java    |  4 ++--
 .../cxf/jaxrs/provider/RequestDispatcherProvider.java |  6 +++---
 .../main/java/org/apache/cxf/jaxws/DispatchImpl.java  |  2 +-
 .../cxf/rs/security/oauth/data/UserSubject.java       |  3 +++
 .../rs/security/oauth/filters/AbstractAuthFilter.java |  2 +-
 .../apache/cxf/rt/security/saml/utils/SAMLUtils.java  |  2 +-
 .../java/org/apache/cxf/transport/http/Headers.java   | 13 +++++++------
 .../cxf/ws/security/tokenstore/MemoryTokenStore.java  |  7 +++----
 .../security/wss4j/PolicyBasedWSS4JInInterceptor.java |  6 +++---
 .../policyhandlers/AbstractStaxBindingHandler.java    |  4 ++--
 .../policyhandlers/StaxSymmetricBindingHandler.java   |  6 ++++--
 .../cxf/xkms/crypto/provider/XkmsCryptoProvider.java  |  4 ++--
 .../cxf/xkms/x509/repo/ldap/LdapCertificateRepo.java  | 10 +++++-----
 .../java/org/apache/cxf/tools/common/ToolContext.java |  6 +++---
 .../apache/cxf/tools/common/VelocityGenerator.java    |  4 ++--
 21 files changed, 57 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/CacheMap.java b/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
index 034d6fe..fca3b3e 100644
--- a/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
+++ b/core/src/main/java/org/apache/cxf/common/util/CacheMap.java
@@ -58,9 +58,9 @@ public class CacheMap<K, V> implements Map<K, V> {
     private void updateMainDataMap() {
         //if the singleton in the mainDataMap has been garbage collected, 
         //we'll copy another version of it from the extraKeyMap
-        for (K o : extraKeyMap.keySet()) {
-            if (!mainDataMap.containsKey(o)) {
-                mainDataMap.put(o, extraKeyMap.get(o));
+        for (Map.Entry<K, V> entry : extraKeyMap.entrySet()) {
+            if (!mainDataMap.containsKey(entry.getKey())) {
+                mainDataMap.put(entry.getKey(), entry.getValue());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/core/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
b/core/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
index 22fc564..088a710 100644
--- a/core/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
+++ b/core/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterJaxBUtils.java
@@ -286,9 +286,6 @@ public final class TLSParameterJaxBUtils {
         try {
             ch = (CallbackHandler)ClassLoaderUtils.loadClass(callbackHandlerClass, TLSParameterJaxBUtils.class)
                 .newInstance();
-            if (ch == null) {
-                return null;
-            }
             String prompt = kmc.getKeyStore().getFile();
             if (prompt == null) {
                 prompt = kmc.getKeyStore().getResource();

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/core/src/main/java/org/apache/cxf/interceptor/security/DefaultSecurityContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/interceptor/security/DefaultSecurityContext.java
b/core/src/main/java/org/apache/cxf/interceptor/security/DefaultSecurityContext.java
index 11934c4..12e4935 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/security/DefaultSecurityContext.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/security/DefaultSecurityContext.java
@@ -64,8 +64,8 @@ public class DefaultSecurityContext implements LoginSecurityContext {
         }
         
         for (Principal principal : subject.getPrincipals()) {
-            if (!(principal instanceof Group) && (principalName == null 
-                || (principalName != null && principalName.equals(principal.getName()))))
{
+            if (!(principal instanceof Group) 
+                && (principalName == null || principal.getName().equals(principalName)))
{
                 return principal;
             }
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java b/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
index 1f75de6..7a91ac6 100644
--- a/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
+++ b/core/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
@@ -361,11 +361,7 @@ public class W3CDOMStreamReader extends AbstractDOMStreamReader<Node,
Node> {
         String prefix = getPrefix();
         String ln = getLocalName();
 
-        if (prefix == null) {
-            return new QName(el.getNamespaceURI(), ln);
-        } else {
-            return new QName(el.getNamespaceURI(), ln, prefix);
-        }
+        return new QName(el.getNamespaceURI(), ln, prefix);
     }
 
     public String getLocalName() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
index 8a257c7..34788fd 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java
@@ -193,7 +193,7 @@ public class SoapActionInInterceptor extends AbstractSoapInterceptor {
                 boi.getOperationInfo().getInput().setProperty(CALCULATED_WSA_ACTION, o);
             }
         }
-        return o == null ? null : o.toString();
+        return o.toString();
     }
     private static String getActionBaseUri(final OperationInfo operation) {
         String interfaceName = operation.getInterface().getName().getLocalPart();

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
index 58ae85c..8aa86c5 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/DefaultLogEventMapper.java
@@ -123,6 +123,9 @@ public class DefaultLogEventMapper implements LogEventMapper {
                 principals.append(",");
             }
         }
+        if (principals.length() == 0) {
+            return null;
+        }
         return principals.toString();
     }
 
@@ -135,13 +138,12 @@ public class DefaultLogEventMapper implements LogEventMapper {
     private Map<String, String> getHeaders(Message message) {
         Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
         Map<String, String> result = new HashMap<>();
-        for (String key : headers.keySet()) {
-            List<String> value = headers.get(key);
-            if (value.size() == 1) {
-                result.put(key, value.iterator().next());
+        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
+            if (entry.getValue().size() == 1) {
+                result.put(entry.getKey(), entry.getValue().get(0));
             } else {
-                String[] valueAr = value.toArray(new String[] {});
-                result.put(key, valueAr.toString());
+                String[] valueAr = entry.getValue().toArray(new String[] {});
+                result.put(entry.getKey(), valueAr.toString());
             }
         }
         return result;

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
index c7a2b80..c779302 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java
@@ -64,9 +64,9 @@ public class Activator implements BundleActivator {
             boolean enabled = Boolean.valueOf(getValue(config, "enabled", "false"));
             LOG.info("CXF message logging feature " + (enabled ? "enabled" : "disabled"));
             if (enabled) {
-                Integer limit = new Integer(getValue(config, "limit", "65536"));
+                Integer limit = Integer.valueOf(getValue(config, "limit", "65536"));
                 Boolean pretty = Boolean.valueOf(getValue(config, "pretty", "false"));
-                Long inMemThreshold = new Long(getValue(config, "inMemThresHold", "-1"));
+                Long inMemThreshold = Long.valueOf(getValue(config, "inMemThresHold", "-1"));
 
                 if (limit != null) {
                     logging.setLimit(limit);

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
index d13486e..e24075f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
@@ -247,9 +247,9 @@ public class RequestDispatcherProvider extends AbstractConfigurableProvider
             return resourcePath;
         }
         String path = getRequestPath();
-        for (String requestPath : resourcePaths.keySet()) {
-            if (path.endsWith(requestPath)) {
-                return resourcePaths.get(requestPath);
+        for (Map.Entry<String, String> entry : resourcePaths.entrySet()) {
+            if (path.endsWith(entry.getKey())) {
+                return entry.getValue();
             }
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
index f194548..0446546 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
@@ -287,7 +287,7 @@ public class DispatchImpl<T> implements Dispatch<T>, BindingProvider,
Closeable
                 return new WebServiceException(ex);
             }
             
-            SOAPFaultException  exception = new SOAPFaultException(soapFault);
+            SOAPFaultException exception = new SOAPFaultException(soapFault);
             exception.initCause(ex);
             return exception;                
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/UserSubject.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/UserSubject.java
b/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/UserSubject.java
index c30bae5..3efb980 100644
--- a/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/UserSubject.java
+++ b/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/UserSubject.java
@@ -40,6 +40,9 @@ public class UserSubject {
     }
 
     public List<String> getRoles() {
+        if (roles == null) {
+            return Collections.emptyList();
+        }
         return Collections.unmodifiableList(roles);
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
b/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
index 04517a5..8f08430 100644
--- a/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
+++ b/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
@@ -257,7 +257,7 @@ public class AbstractAuthFilter {
                 } else {
                     roles = info.getRoles();
                 }
-                return roles == null ? false : roles.contains(role);
+                return roles.contains(role);
             }
              
         };

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/security-saml/src/main/java/org/apache/cxf/rt/security/saml/utils/SAMLUtils.java
----------------------------------------------------------------------
diff --git a/rt/security-saml/src/main/java/org/apache/cxf/rt/security/saml/utils/SAMLUtils.java
b/rt/security-saml/src/main/java/org/apache/cxf/rt/security/saml/utils/SAMLUtils.java
index 5cb5bd6..f45a6de 100644
--- a/rt/security-saml/src/main/java/org/apache/cxf/rt/security/saml/utils/SAMLUtils.java
+++ b/rt/security-saml/src/main/java/org/apache/cxf/rt/security/saml/utils/SAMLUtils.java
@@ -114,7 +114,7 @@ public final class SAMLUtils {
         for (Claim claim : claims) {
             if (claim instanceof SAMLClaim && ((SAMLClaim)claim).getName().equals(name)
                 && (nameFormat == null 
-                    || claim instanceof SAMLClaim && nameFormat.equals(((SAMLClaim)claim).getNameFormat())))
{
+                    || nameFormat.equals(((SAMLClaim)claim).getNameFormat()))) {
                 for (Object claimValue : claim.getValues()) {
                     if (claimValue instanceof String) {
                         roles.add(new SimpleGroup((String)claimValue));

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
index 6e587a8..4fbcbc0 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
@@ -29,7 +29,6 @@ import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -343,8 +342,10 @@ public class Headers {
     private void transferProtocolHeadersToURLConnection(URLConnection connection) {
         boolean addHeaders = MessageUtils.isTrue(
                 message.getContextualProperty(ADD_HEADERS_PROPERTY));
-        for (String header : headers.keySet()) {
-            List<String> headerList = headers.get(header);
+        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
+            String header = entry.getKey();
+            List<String> headerList = entry.getValue();
+            
             if (HttpHeaderHelper.CONTENT_TYPE.equalsIgnoreCase(header)) {
                 continue;
             }
@@ -448,9 +449,9 @@ public class Headers {
 
         boolean addHeaders = MessageUtils.isTrue(
                 message.getContextualProperty(ADD_HEADERS_PROPERTY));
-        for (Iterator<?> iter = headers.keySet().iterator(); iter.hasNext();) {
-            String header = (String)iter.next();
-            List<?> headerList = headers.get(header);
+        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
+            String header = entry.getKey();
+            List<?> headerList = entry.getValue();
             
             if (addHeaders || HTTP_HEADERS_SINGLE_VALUE_ONLY.contains(header)) {
                 for (int i = 0; i < headerList.size(); i++) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/MemoryTokenStore.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/MemoryTokenStore.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/MemoryTokenStore.java
index ac8d930..116e705 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/MemoryTokenStore.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/tokenstore/MemoryTokenStore.java
@@ -86,10 +86,9 @@ public class MemoryTokenStore implements TokenStore {
     protected void processTokenExpiry() {
         Date current = new Date();
         synchronized (tokens) {
-            for (String id : tokens.keySet()) {
-                CacheEntry cacheEntry = tokens.get(id);
-                if (cacheEntry.getExpiry().before(current)) {
-                    tokens.remove(id);
+            for (Map.Entry<String, CacheEntry> entry : tokens.entrySet()) {
+                if (entry.getValue().getExpiry().before(current)) {
+                    tokens.remove(entry.getKey());
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
index 3cadcaa..03fc1fc 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
@@ -545,10 +545,10 @@ public class PolicyBasedWSS4JInInterceptor extends WSS4JInInterceptor
{
         
         // Validate security policies
         Map<QName, SecurityPolicyValidator> validators = PolicyUtils.getSecurityPolicyValidators(msg);
-        for (QName qName : aim.keySet()) {
+        for (Map.Entry<QName, Collection<AssertionInfo>> entry : aim.entrySet())
{
             // Check to see if we have a security policy + if we can validate it
-            if (validators.containsKey(qName)) {
-                validators.get(qName).validatePolicies(parameters, aim.get(qName));
+            if (validators.containsKey(entry.getKey())) {
+                validators.get(entry.getKey()).validatePolicies(parameters, entry.getValue());
             }
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
index 8ed0bc1..f819b95 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
@@ -770,8 +770,8 @@ public abstract class AbstractStaxBindingHandler extends AbstractCommonBindingHa
     
     protected void addSignatureParts(Map<AbstractToken, SecurePart> tokenMap) {
         if (tokenMap != null) {
-            for (AbstractToken token : tokenMap.keySet()) {
-                SecurePart part = tokenMap.get(token);
+            for (Map.Entry<AbstractToken, SecurePart> entry : tokenMap.entrySet())
{
+                SecurePart part = entry.getValue();
     
                 QName name = part.getName();
                 List<WSSConstants.Action> actionList = properties.getActions();

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
index 6b4e5c9..118be9b 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
@@ -620,7 +620,8 @@ public class StaxSymmetricBindingHandler extends AbstractStaxBindingHandler
{
                         == incomingEvent.getSecurityEventType()) {
                     org.apache.xml.security.stax.securityToken.SecurityToken token = 
                         ((AbstractSecuredElementSecurityEvent)incomingEvent).getSecurityToken();
-                    if (token.getKeyWrappingToken() != null && token.getKeyWrappingToken().getSecretKey()
!= null 
+                    if (token != null && token.getKeyWrappingToken() != null 
+                        && token.getKeyWrappingToken().getSecretKey() != null 
                         && token.getKeyWrappingToken().getSha1Identifier() != null)
{
                         return token.getKeyWrappingToken();
                     } else if (token != null && token.getSecretKey() != null 
@@ -637,7 +638,8 @@ public class StaxSymmetricBindingHandler extends AbstractStaxBindingHandler
{
                         == incomingEvent.getSecurityEventType()) {
                     org.apache.xml.security.stax.securityToken.SecurityToken token = 
                         ((AbstractSecuredElementSecurityEvent)incomingEvent).getSecurityToken();
-                    if (token.getKeyWrappingToken() != null && token.getKeyWrappingToken().getSecretKey()
!= null 
+                    if (token != null && token.getKeyWrappingToken() != null 
+                        && token.getKeyWrappingToken().getSecretKey() != null 
                         && token.getKeyWrappingToken().getSha1Identifier() != null)
{
                         return token.getKeyWrappingToken();
                     } else if (token != null && token.getSecretKey() != null 

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProvider.java
----------------------------------------------------------------------
diff --git a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProvider.java
b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProvider.java
index 4d2844f..cad78bc 100644
--- a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProvider.java
+++ b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/crypto/provider/XkmsCryptoProvider.java
@@ -164,9 +164,9 @@ public class XkmsCryptoProvider extends CryptoBase {
 
     private X509Certificate[] getX509(CryptoType cryptoType) {
         // Try to get X509 certificate from local keystore if it is configured
-        if (allowX509FromJKS && (fallbackCrypto != null)) {
+        if (allowX509FromJKS && fallbackCrypto != null) {
             X509Certificate[] localCerts = getCertificateLocaly(cryptoType);
-            if ((localCerts != null) && localCerts.length > 0) {
+            if (localCerts != null && localCerts.length > 0) {
                 return localCerts;
             }
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/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 8336274..f3287ab 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
@@ -149,9 +149,9 @@ public class LdapCertificateRepo implements CertificateRepo {
         attribs.put(new BasicAttribute(ldapConfig.getAttrIssuerID(), cert.getIssuerX500Principal().getName()));
         attribs.put(new BasicAttribute(ldapConfig.getAttrSerialNumber(), cert.getSerialNumber().toString(16)));
         addConstantAttributes(ldapConfig.getConstAttrNamesCSV(), ldapConfig.getConstAttrValuesCSV(),
attribs);
-        if ((appAttrs != null) && (!appAttrs.isEmpty())) {
-            for (String attrName : appAttrs.keySet()) {
-                attribs.put(new BasicAttribute(attrName, appAttrs.get(attrName)));
+        if (appAttrs != null && !appAttrs.isEmpty()) {
+            for (Map.Entry<String, String> entry : appAttrs.entrySet()) {
+                attribs.put(new BasicAttribute(entry.getKey(), entry.getValue()));
             }
         }
         try {
@@ -179,7 +179,7 @@ public class LdapCertificateRepo implements CertificateRepo {
         X509Certificate cert = null;
         try {
             String dn = id;
-            if ((rootDN != null) && !(rootDN.isEmpty())) {
+            if (rootDN != null && !rootDN.isEmpty()) {
                 dn = dn + "," + rootDN;
             }
             cert = getCertificateForDn(dn);
@@ -246,7 +246,7 @@ public class LdapCertificateRepo implements CertificateRepo {
 
     @Override
     public X509Certificate findByIssuerSerial(String issuer, String serial) {
-        if ((issuer == null) || (serial == null)) {
+        if (issuer == null || serial == null) {
             throw new IllegalArgumentException("Issuer and serial applications are expected
in request");
         }
         String filter = String.format(filterIssuerSerialTemplate, issuer, serial);

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
----------------------------------------------------------------------
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
index 735b202..d522437 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
@@ -80,9 +80,9 @@ public class ToolContext {
     }
 
     public void addParameters(Map<String, Object> map) {
-        for (String key : map.keySet()) {
-            if (!optionSet(key)) {
-                put(key, map.get(key));
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            if (!optionSet(entry.getKey())) {
+                put(entry.getKey(), entry.getValue());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/7e4eb471/tools/common/src/main/java/org/apache/cxf/tools/common/VelocityGenerator.java
----------------------------------------------------------------------
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/VelocityGenerator.java
b/tools/common/src/main/java/org/apache/cxf/tools/common/VelocityGenerator.java
index cc5f912..5d89942 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/common/VelocityGenerator.java
+++ b/tools/common/src/main/java/org/apache/cxf/tools/common/VelocityGenerator.java
@@ -97,8 +97,8 @@ public final class VelocityGenerator {
 
         VelocityContext ctx = new VelocityContext();
 
-        for (String key : attributes.keySet()) {
-            ctx.put(key, attributes.get(key));
+        for (Map.Entry<String, Object> entry : attributes.entrySet()) {
+            ctx.put(entry.getKey(), entry.getValue());
         }
 
         VelocityWriter writer = new VelocityWriter(outputs);


Mime
View raw message