cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bin Zhu <luckyzhu...@gmail.com>
Subject SOAPFault message improvement in CXF when there is unchecked NPE
Date Thu, 29 Nov 2012 03:18:31 GMT
Hi,

When there is unchecked NPE thrown, the SOAPFault in CXF will only throw
the "Fault occurred while processing." message rather than the original NPE
message.
This message("Fault occurred while processing.") hides the details of the
exception and will make user hard to find the root cause of the exception.

I did some investigation and found that
in org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor and
org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor,
It will check fault.getMessage() :
                if (fault.getMessage() != null) {
                    if (message.get("forced.faultstring") != null) {
                        writer.writeCharacters((String)
message.get("forced.faultstring"));
                    } else {
                        writer.writeCharacters(fault.getMessage());
                    }

                } else {
                    writer.writeCharacters("Fault occurred while
processing.");
                }
But for NPE, the fault.getMessage() will return null instead of the
"java.lang.NullPointerException" in the getMessage() in NPE.

It is suggested to improve the getMessage in the SOAPFault to let it
include the"java.lang.NullPointerException" so that the user can get the
details of the SOAPFault. Any suggestions? Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message