You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2014/03/26 18:00:57 UTC
[2/2] git commit: Allow the message initiator to see security
exceptions
Allow the message initiator to see security exceptions
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b3f7f0e5
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b3f7f0e5
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b3f7f0e5
Branch: refs/heads/2.6.x-fixes
Commit: b3f7f0e5b34d06181fc1755392409e82a9c7d477
Parents: a63e6f3
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Mar 26 16:59:08 2014 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Mar 26 17:00:11 2014 +0000
----------------------------------------------------------------------
.../cxf/ws/security/wss4j/WSS4JInInterceptor.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/b3f7f0e5/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
index 2de7de5..9c4a187 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
@@ -332,7 +332,7 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
} catch (WSSecurityException e) {
LOG.log(Level.WARNING, "", e);
- SoapFault fault = createSoapFault(version, e);
+ SoapFault fault = createSoapFault(msg, version, e);
throw fault;
} catch (XMLStreamException e) {
throw new SoapFault(new Message("STAX_EX", LOG), e, version.getSender());
@@ -760,12 +760,18 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor {
* as the fault code from the WSSecurityException.
*/
private SoapFault
- createSoapFault(SoapVersion version, WSSecurityException e) {
+ createSoapFault(org.apache.cxf.message.Message message, SoapVersion version, WSSecurityException e) {
SoapFault fault;
- String errorMessage = WSS4JUtils.getSafeExceptionMessage(e);
- if (errorMessage == null) {
+ String errorMessage = null;
+ if (MessageUtils.isRequestor(message)) {
errorMessage = e.getMessage();
+ } else {
+ errorMessage = WSS4JUtils.getSafeExceptionMessage(e);
+ if (errorMessage == null) {
+ errorMessage = e.getMessage();
+ }
}
+
javax.xml.namespace.QName faultCode = e.getFaultCode();
if (version.getVersion() == 1.1 && faultCode != null) {
fault = new SoapFault(errorMessage, e, faultCode);