Author: coheigea
Date: Thu Sep 25 14:57:16 2014
New Revision: 1627556

URL: http://svn.apache.org/r1627556
Log:
Fixing some NPEs

Modified:
    
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityTokenReference.java

Modified: 
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityTokenReference.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityTokenReference.java?rev=1627556&r1=1627555&r2=1627556&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityTokenReference.java
 (original)
+++ 
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityTokenReference.java
 Thu Sep 25 14:57:16 2014
@@ -469,6 +469,10 @@ public class SecurityTokenReference {
      *         type was detected.
      */
     public X509Certificate[] getKeyIdentifier(Crypto crypto) throws 
WSSecurityException {
+        if (crypto == null) {
+            return null;
+        }
+        
         Element elem = getFirstElement();
         String value = elem.getAttributeNS(null, "ValueType");
 
@@ -537,6 +541,10 @@ public class SecurityTokenReference {
     }
     
     public X509Certificate getX509SKIAlias(Crypto crypto) throws 
WSSecurityException {
+        if (crypto == null) {
+            return null;
+        }
+        
         if (skiBytes == null) {
             skiBytes = getSKIBytes();
             if (skiBytes == null) {
@@ -609,6 +617,10 @@ public class SecurityTokenReference {
      * @return a certificate array or null if nothing found
      */
     public X509Certificate[] getX509IssuerSerial(Crypto crypto) throws 
WSSecurityException {
+        if (crypto == null) {
+            return null;
+        }
+        
         if (issuerSerial == null) {
             issuerSerial = getIssuerSerial();
             if (issuerSerial == null) {


Reply via email to