Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9C20FD013 for ; Thu, 13 Dec 2012 05:45:26 +0000 (UTC) Received: (qmail 69763 invoked by uid 500); 13 Dec 2012 05:45:26 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 69162 invoked by uid 500); 13 Dec 2012 05:45:25 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 67449 invoked by uid 99); 13 Dec 2012 05:45:23 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2012 05:45:23 +0000 Date: Thu, 13 Dec 2012 05:45:23 +0000 (UTC) From: "Bin Zhu (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-4684) SOAPFault message improvement in CXF when there is unchecked NPE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-4684?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bin Zhu updated CXF-4684: ------------------------- Attachment: CXF-4684.patch > SOAPFault message improvement in CXF when there is unchecked NPE > ---------------------------------------------------------------- > > Key: CXF-4684 > URL: https://issues.apache.org/jira/browse/CXF-4684 > Project: CXF > Issue Type: Bug > Components: WS-* Components > Affects Versions: 2.6.2 > Reporter: Bin Zhu > Assignee: Aki Yoshida > Attachments: CXF-4684.patch > > > 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. > Analysis: > 1. 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. > 2. > Fault.getMessage will return null in the NPE scenario while it's super class Throwable will not. > When there is NPE, the message attribute in Fault is null while the detailMessageAtrribute is "java.lang.NullPointerException". > Details: > SoapFault->Fault->UncheckedException->RuntimeException->Exception->Throwable. // SoapFault->Fault means SoapFault class extends Fault class > UncheckedException.getMessage: > public String getMessage() { > if (null != message) { > return message.toString(); > } > return null; > } > Throwable.getMessage: > public String getMessage() { > return detailMessage; > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira