cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] git commit: Fixing two NPEs
Date Tue, 23 Sep 2014 16:55:45 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 6d4aa1740 -> 9d28233f4


Fixing two NPEs


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

Branch: refs/heads/2.7.x-fixes
Commit: c910fa3b21ce3cef9bcea18313a9a549091f5b00
Parents: 6d4aa17
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Sep 23 17:48:48 2014 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Tue Sep 23 17:51:51 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/ws/security/trust/AbstractSTSClient.java  | 5 +++++
 .../wss4j/policyhandlers/TransportBindingHandler.java        | 8 ++++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c910fa3b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
index b6aa991..4ac8c0c 100755
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AbstractSTSClient.java
@@ -1236,6 +1236,11 @@ public abstract class AbstractSTSClient implements Configurable, InterceptorProv
     }
 
     protected X509Certificate getCert(Crypto crypto) throws Exception {
+        if (crypto == null) {
+            throw new Fault("No Crypto token properties are available to retrieve a certificate",

+                            LOG);
+        }
+        
         String alias = (String)getProperty(SecurityConstants.STS_TOKEN_USERNAME);
         if (alias == null) {
             alias = crypto.getDefaultX509Identifier();

http://git-wip-us.apache.org/repos/asf/cxf/blob/c910fa3b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
index 5e893f9..b274632 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
@@ -521,6 +521,14 @@ public class TransportBindingHandler extends AbstractBindingBuilder {
             if (crypto == null) {
                 crypto = getSignatureCrypto(wrapper);
             }
+            if (crypto == null) {
+                LOG.fine("No signature Crypto properties are available");
+                Exception ex = new Exception("No signature Crypto properties are available");
+                throw new WSSecurityException(
+                    WSSecurityException.ErrorCode.FAILURE, ex
+                );
+            }
+            
             String uname = crypto.getX509Identifier(secTok.getX509Certificate());
             if (uname == null) {
                 String userNameKey = SecurityConstants.SIGNATURE_USERNAME;


Mime
View raw message