ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1671817 - /webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/
Date Tue, 07 Apr 2015 11:46:28 GMT
Author: coheigea
Date: Tue Apr  7 11:46:27 2015
New Revision: 1671817

URL: http://svn.apache.org/r1671817
Log:
Avoid a few NPEs

Modified:
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java?rev=1671817&r1=1671816&r2=1671817&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java
Tue Apr  7 11:46:27 2015
@@ -57,8 +57,11 @@ public class X509IssuerSerialTokenImpl e
             cryptoType.setIssuerSerial(
                     x509IssuerSerialType.getX509IssuerName(), x509IssuerSerialType.getX509SerialNumber()
             );
-            X509Certificate[] certs = getCrypto().getX509Certificates(cryptoType);
-            setX509Certificates(certs);
+            X509Certificate[] certs = null;
+            if (getCrypto() != null) {
+                certs = getCrypto().getX509Certificates(cryptoType);
+                setX509Certificates(certs);
+            }
             if (certs == null || certs.length == 0) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE);
             }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java?rev=1671817&r1=1671816&r2=1671817&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
Tue Apr  7 11:46:27 2015
@@ -67,7 +67,7 @@ public class X509PKIPathv1SecurityTokenI
 
     @Override
     protected String getAlias() throws XMLSecurityException {
-        if (this.alias == null) {
+        if (this.alias == null && getCrypto() != null) {
             this.alias = getCrypto().getX509Identifier(getX509Certificates()[0]);
         }
         return this.alias;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java?rev=1671817&r1=1671816&r2=1671817&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java
Tue Apr  7 11:46:27 2015
@@ -48,7 +48,10 @@ public class X509SKISecurityTokenImpl ex
         if (this.alias == null) {
             CryptoType cryptoType = new CryptoType(CryptoType.TYPE.SKI_BYTES);
             cryptoType.setBytes(binaryContent);
-            X509Certificate[] certs = getCrypto().getX509Certificates(cryptoType);
+            X509Certificate[] certs = null;
+            if (getCrypto() != null) {
+                certs = getCrypto().getX509Certificates(cryptoType);
+            }
             if (certs == null || certs.length == 0) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE);
             }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java?rev=1671817&r1=1671816&r2=1671817&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java
Tue Apr  7 11:46:27 2015
@@ -95,7 +95,7 @@ public abstract class X509SecurityTokenI
     public X509Certificate[] getX509Certificates() throws XMLSecurityException {
         if (super.getX509Certificates() == null) {
             String alias = getAlias();
-            if (super.getX509Certificates() == null && alias != null) {
+            if (alias != null) {
                 CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
                 cryptoType.setAlias(alias);
                 setX509Certificates(getCrypto().getX509Certificates(cryptoType));
@@ -182,9 +182,8 @@ public abstract class X509SecurityTokenI
         TokenType storedTokenType = super.getTokenType();
         // Just check to see whether the cert version is "1"
         if (WSSecurityTokenConstants.X509V3Token.equals(storedTokenType)) {
-            X509Certificate[] certs;
             try {
-                certs = super.getX509Certificates();
+                X509Certificate[] certs = super.getX509Certificates();
                 if (certs != null && certs.length > 0 && certs[0].getVersion()
== 1) {
                     return WSSecurityTokenConstants.X509V1Token;
                 }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java?rev=1671817&r1=1671816&r2=1671817&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java
Tue Apr  7 11:46:27 2015
@@ -48,7 +48,10 @@ public class X509ThumbprintSHA1SecurityT
         if (this.alias == null) {
             CryptoType cryptoType = new CryptoType(CryptoType.TYPE.THUMBPRINT_SHA1);
             cryptoType.setBytes(binaryContent);
-            X509Certificate[] certs = getCrypto().getX509Certificates(cryptoType);
+            X509Certificate[] certs = null;
+            if (getCrypto() != null) {
+                certs = getCrypto().getX509Certificates(cryptoType);
+            }
             if (certs == null || certs.length == 0) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE);
             }



Mime
View raw message