cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject git commit: Fixing two NPEs
Date Tue, 23 Sep 2014 16:49:06 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 64f232307 -> 6ef499754


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/6ef49975
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6ef49975
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6ef49975

Branch: refs/heads/master
Commit: 6ef499754117896def72972bf86ff513ce905157
Parents: 64f2323
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:49:01 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/6ef49975/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 d81da95..013ff49 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
@@ -1255,6 +1255,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/6ef49975/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 694d13b..708699f 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
@@ -552,6 +552,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