Jesse Pangburn created CXF-5317:
-----------------------------------

             Summary: Policy exception handler throws away useful exception 
stack trace
                 Key: CXF-5317
                 URL: https://issues.apache.org/jira/browse/CXF-5317
             Project: CXF
          Issue Type: Improvement
          Components: WS-* Components
    Affects Versions: 2.7.7, 2.7.6
            Reporter: Jesse Pangburn


I had a working WS-Policy which was encrypting the SOAP body with a 
UsernameToken using Basic128 encryption, then I modified the policy to use 
Basic256 encryption instead.  I got the following stack trace cause:
Caused by: org.apache.cxf.ws.policy.PolicyException: Cannot encrypt data
        at 
org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.policyNotAsserted(AbstractBindingBuilder.java:294)

Since the exception was short on detail, I went to the source code and found 
that AbstractBindingBuilder.java:294 was simply throwing away the rest of the 
Exception object.  There's a method existing already to take the exception too 
so I changed that line to call it and now get the following MUCH more useful 
error message on the end of the stack trace:
Caused by: org.apache.xml.security.encryption.XMLEncryptionException: Invalid 
AES key length: 20 bytes
Original Exception was java.security.InvalidKeyException: Invalid AES key 
length: 20 bytes

I'll attach a patch to this issue to resolve this.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to