Repository: cxf Updated Branches: refs/heads/master bb1e05690 -> 7263bb6f9
CXF-7453 check subCodes only in case of SOAP 1.2 This closes #296 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ab123c08 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ab123c08 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ab123c08 Branch: refs/heads/master Commit: ab123c0826a168842ae6e451058551b65d470e6f Parents: bb1e056 Author: Ivo Studensky <[email protected]> Authored: Tue Jul 25 16:04:34 2017 +0200 Committer: Daniel Kulp <[email protected]> Committed: Fri Jul 28 10:57:20 2017 -0400 ---------------------------------------------------------------------- .../interceptors/WebFaultOutInterceptor.java | 28 +++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/ab123c08/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java ---------------------------------------------------------------------- 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 799683c..187a5e1 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 @@ -35,6 +35,7 @@ import javax.xml.ws.soap.SOAPFaultException; import org.apache.cxf.annotations.SchemaValidation.SchemaValidationType; import org.apache.cxf.binding.soap.SoapFault; +import org.apache.cxf.binding.soap.SoapVersion; import org.apache.cxf.common.classloader.ClassLoaderUtils; import org.apache.cxf.common.i18n.BundleUtils; import org.apache.cxf.common.logging.LogUtils; @@ -99,20 +100,23 @@ public class WebFaultOutInterceptor extends FaultOutInterceptor { sf = (SOAPFaultException)thr.getCause(); } if (sf != null) { - if (f instanceof SoapFault) { - for (Iterator<QName> it = CastUtils.cast(sf.getFault().getFaultSubcodes()); it.hasNext();) { - ((SoapFault) f).addSubCode(it.next()); + SoapVersion soapVersion = (SoapVersion)message.get(SoapVersion.class.getName()); + if (soapVersion != null && soapVersion.getVersion() != 1.1) { + if (f instanceof SoapFault) { + for (Iterator<QName> it = CastUtils.cast(sf.getFault().getFaultSubcodes()); it.hasNext();) { + ((SoapFault) f).addSubCode(it.next()); + } } - } - if (sf.getFault().getFaultReasonLocales().hasNext()) { - Locale lang = (Locale) sf.getFault() - .getFaultReasonLocales().next(); - String convertedLang = lang.getLanguage(); - String country = lang.getCountry(); - if (country.length() > 0) { - convertedLang = convertedLang + '-' + country; + if (sf.getFault().getFaultReasonLocales().hasNext()) { + Locale lang = (Locale) sf.getFault() + .getFaultReasonLocales().next(); + String convertedLang = lang.getLanguage(); + String country = lang.getCountry(); + if (country.length() > 0) { + convertedLang = convertedLang + '-' + country; + } + f.setLang(convertedLang); } - f.setLang(convertedLang); } message.setContent(Exception.class, f); }
