This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git

commit 0c0006326eb72bd6b64e3c1f3ff9c6e86e00c6e0
Author: Robert Lazarski <robertlazar...@gmail.com>
AuthorDate: Fri Nov 1 08:44:33 2024 -1000

    RAMPART-448 NullPointerException in RampartUtil.setKeyIdentifierType() when 
signing response
---
 .../src/main/java/org/apache/rampart/util/RampartUtil.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java 
b/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java
index e6217f81..8f5f1114 100644
--- 
a/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java
+++ 
b/modules/rampart-core/src/main/java/org/apache/rampart/util/RampartUtil.java
@@ -1459,7 +1459,9 @@ public class RampartUtil {
                        } else if (x509Token.isRequireThumbprintReference()) {
                                
secBase.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
                                tokenTypeSet = true;
-                       }
+                       } else if (log.isDebugEnabled()) {
+                               log.debug("RampartUtil.setKeyIdentifierType() 
found a Token that is an instanceof X509Token but was not able to identify the 
correcc constant to set on WSSecBase.setKeyIdentifierType()" );
+                        }
                } 
                
                if (!tokenTypeSet) {
@@ -1469,13 +1471,15 @@ public class RampartUtil {
                                        wss = rpd.getWss10();
                                }
                                
-                               if (wss.isMustSupportRefKeyIdentifier()) {
+                               if (wss !=null && 
wss.isMustSupportRefKeyIdentifier()) {
                                        
secBase.setKeyIdentifierType(WSConstants.SKI_KEY_IDENTIFIER);
-                               } else if (wss.isMustSupportRefIssuerSerial()) {
+                               } else if (wss !=null && 
wss.isMustSupportRefIssuerSerial()) {
                                        
secBase.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
-                               } else if (wss instanceof Wss11
+                               } else if (wss !=null && wss instanceof Wss11
                                                && ((Wss11) 
wss).isMustSupportRefThumbprint()) {
                                        
secBase.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
+                               } else if (log.isDebugEnabled()) {
+                                       
log.debug("RampartUtil.setKeyIdentifierType() attempted secpolicy Wss10 and 
Wss111 but was not able to identify the correcc constant to set on 
WSSecBase.setKeyIdentifierType()" );
                                }
                }
                

Reply via email to