[CXF-7438] Expand the checks for MTOM and schema validation Patch from Casper Biever applied
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/88c48ed4 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/88c48ed4 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/88c48ed4 Branch: refs/heads/3.1.x-fixes Commit: 88c48ed4b6164afbb7cc97c6a8bffc63babcf5af Parents: b1a3bcf Author: Daniel Kulp <[email protected]> Authored: Tue Aug 1 14:31:09 2017 -0400 Committer: Daniel Kulp <[email protected]> Committed: Tue Aug 1 15:06:25 2017 -0400 ---------------------------------------------------------------------- .../org/apache/cxf/databinding/source/XMLStreamDataWriter.java | 2 +- .../src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/88c48ed4/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java b/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java index a4ebc0e..b46976b 100644 --- a/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java +++ b/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java @@ -222,7 +222,7 @@ public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> { private boolean isCVC312Exception(SAXParseException exception) { String msg = exception.getMessage(); - return msg.startsWith("cvc-type.3.1.2") + return (msg.startsWith("cvc-type.3.1.2") || msg.startsWith("cvc-complex-type.2.2")) && msg.endsWith("is a simple type, so it must have no element information item [children]."); http://git-wip-us.apache.org/repos/asf/cxf/blob/88c48ed4/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java ---------------------------------------------------------------------- diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java index 53a99ea..d431bc1 100644 --- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java +++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java @@ -98,9 +98,10 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> { } public boolean handleEvent(ValidationEvent event) { - // CXF-1194 this hack is specific to MTOM, so pretty safe to leave in here before calling the origHandler. + // CXF-1194/CXF-7438 this hack is specific to MTOM, so pretty safe to leave in + // here before calling the origHandler. String msg = event.getMessage(); - if (msg.startsWith("cvc-type.3.1.2") + if ((msg.startsWith("cvc-type.3.1.2") || msg.startsWith("cvc-complex-type.2.2")) && msg.contains(marshaller.getLastMTOMElementName().getLocalPart())) { return true; }
