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

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new bc31b97  CXF-8254 - NPE in WebFaultOutInterceptor handleMessage method
bc31b97 is described below

commit bc31b97e09fa2e9e40e837d0245a9f17da11704c
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Wed Apr 8 16:30:03 2020 +0100

    CXF-8254 - NPE in WebFaultOutInterceptor handleMessage method
---
 .../apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
 
b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
index 1bed7ad..73c2043 100644
--- 
a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
+++ 
b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
@@ -65,7 +65,7 @@ public class WebFaultOutInterceptor extends 
FaultOutInterceptor {
 
     private QName getFaultName(WebFault wf, Class<?> cls, OperationInfo op) {
         String ns = wf.targetNamespace();
-        if (StringUtils.isEmpty(ns)) {
+        if (StringUtils.isEmpty(ns) && op != null) {
             ns = op.getName().getNamespaceURI();
         }
         String name = wf.name();
@@ -160,9 +160,14 @@ public class WebFaultOutInterceptor extends 
FaultOutInterceptor {
                     writer.setSchema(schema);
                 }
 
-                OperationInfo op = 
message.getExchange().getBindingOperationInfo().getOperationInfo();
+                OperationInfo op = null;
+                // Prevent a NPE if we can't match the operation
+                if (message.getExchange().getBindingOperationInfo() != null) {
+                    op = 
message.getExchange().getBindingOperationInfo().getOperationInfo();
+                }
                 QName faultName = getFaultName(fault, cause.getClass(), op);
-                MessagePartInfo part = getFaultMessagePart(faultName, op);
+                MessagePartInfo part = op != null ? 
getFaultMessagePart(faultName, op) : null;
+
                 if (f.hasDetails()) {
                     writer.write(faultInfo, part, new 
W3CDOMStreamWriter(f.getDetail()));
                 } else {

Reply via email to