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

ffang pushed a commit to branch 3.5.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.5.x-fixes by this push:
     new 3f386c18d2 [CXF-8979]introduce context property 
not-use-msv-schema-validator so that we can skip msv validator when needed
3f386c18d2 is described below

commit 3f386c18d226c4fcf24554041319fcdf3cb11e92
Author: Freeman Fang <[email protected]>
AuthorDate: Thu Nov 21 13:37:46 2024 -0500

    [CXF-8979]introduce context property not-use-msv-schema-validator so that 
we can skip msv validator when needed
    
    (cherry picked from commit 5bda94dcfcb6034e096b67e71d768964d5856d80)
    (cherry picked from commit 3c819cadb47e1aff2c73353c177fcd93019a84f9)
    (cherry picked from commit 840214d0019c872679aa5478593e95e2dca89bde)
---
 .../java/org/apache/cxf/databinding/source/SourceDataBinding.java | 1 +
 .../org/apache/cxf/databinding/source/XMLStreamDataReader.java    | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java 
b/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
index 5321779f80..e25e38df1d 100644
--- 
a/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
+++ 
b/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
@@ -40,6 +40,7 @@ import org.apache.ws.commons.schema.constants.Constants;
 public class SourceDataBinding extends 
org.apache.cxf.databinding.AbstractDataBinding {
 
     public static final String PREFERRED_FORMAT = "source-preferred-format";
+    public static final String NOT_USE_MSV_SCHEMA_VALIDATOR = 
"not-use-msv-schema-validator";
 
     final Class<?> preferred;
 
diff --git 
a/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java 
b/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
index c9dcf15698..cb9b14dfd4 100644
--- 
a/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
+++ 
b/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
@@ -52,6 +52,7 @@ import org.apache.cxf.interceptor.StaxInEndingInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
@@ -226,13 +227,16 @@ public class XMLStreamDataReader implements 
DataReader<XMLStreamReader> {
 
         WoodstoxValidationImpl impl = new WoodstoxValidationImpl();
         XMLStreamWriter nullWriter = null;
-        if (impl.canValidate()) {
+        boolean notUseMsvSchemaValidator = 
+            MessageUtils.getContextualBoolean(message, 
SourceDataBinding.NOT_USE_MSV_SCHEMA_VALIDATOR, false);
+        if (impl.canValidate()
+            && !notUseMsvSchemaValidator) {
             nullWriter = StaxUtils.createXMLStreamWriter(new 
NUllOutputStream());
             impl.setupValidation(nullWriter, 
message.getExchange().getEndpoint(),
                                  
message.getExchange().getService().getServiceInfos().get(0));
         }
         //check if the impl can still validate after the setup, possible issue 
loading schemas or similar
-        if (impl.canValidate()) {
+        if (impl.canValidate() && !notUseMsvSchemaValidator) {
             //Can use the MSV libs and woodstox to handle the schema 
validation during
             //parsing and processing.   Much faster and single traversal
             //filter xop node

Reply via email to