ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ross M. Lodge (JIRA)" <>
Subject [jira] [Created] (WSS-560) NullPointerException in WSSecEncrypt when encrypted header element has attributes
Date Mon, 02 Nov 2015 18:54:27 GMT
Ross M. Lodge created WSS-560:

             Summary: NullPointerException in WSSecEncrypt when encrypted header element has
                 Key: WSS-560
             Project: WSS4J
          Issue Type: Bug
          Components: WSS4J Handlers
    Affects Versions: 2.1.4, 2.0.6
            Reporter: Ross M. Lodge
            Assignee: Colm O hEigeartaigh
            Priority: Critical

If any header to be encrypted has an attribute that doesn't have an explicit namespace (which
would include any unqualified attributes, which for me is almost all of them), WSSecEncrypt
throws an NPE:

org.apache.wss4j.common.ext.WSSecurityException: null
	at org.apache.wss4j.dom.message.WSSecEncrypt.createEncryptedHeaderElement(
	at org.apache.wss4j.dom.message.WSSecEncrypt.encryptElement(
	at org.apache.wss4j.dom.message.WSSecEncrypt.doEncryption(
	at org.apache.wss4j.dom.message.WSSecEncrypt.encryptForRef(
	at org.apache.wss4j.dom.message.WSSecEncrypt.encrypt(
	at org.apache.wss4j.dom.message.EncryptionPartsTest.testSOAPEncryptedHeaderWithAttributes(

This is because Node.getNamespaceURI() returns null, and the code checks with:

{ Excerpt|borderStyle=solid}
            if (attr.getNamespaceURI().equals(WSConstants.URI_SOAP11_ENV)
                || attr.getNamespaceURI().equals(WSConstants.URI_SOAP12_ENV)) {          

Solution is to switch the equals condition:

{ Fix|borderStyle=solid}
            if (WSConstants.URI_SOAP11_ENV.equals(attr.getNamespaceURI())
                || WSConstants.URI_SOAP12_ENV.equals(attr.getNamespaceURI())) {

I'm adding four patches:
- a test for code vs. version 2.0.6
- code fix vs. version 2.0.6
- a test for code vs. version 2.1.4
- a code fix vs. version 2.1.4

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message