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

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a52b10  CXF-8429: Illegal reflective access in 
XercesSchemaValidationUtils (#751)
6a52b10 is described below

commit 6a52b1068b282022517220993d73f6327bc8c9db
Author: Andriy Redko <[email protected]>
AuthorDate: Fri Mar 5 08:31:18 2021 -0500

    CXF-8429: Illegal reflective access in XercesSchemaValidationUtils (#751)
---
 rt/wsdl/pom.xml                                    | 19 +++++++++++++++---
 services/sts/sts-core/pom.xml                      | 23 ++++++++++++++++++++++
 .../tools/validator/internal/SchemaValidator.java  | 11 +++++++++--
 3 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/rt/wsdl/pom.xml b/rt/wsdl/pom.xml
index 277b3a4..abb2236 100644
--- a/rt/wsdl/pom.xml
+++ b/rt/wsdl/pom.xml
@@ -41,7 +41,6 @@
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-core</artifactId>
-            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>wsdl4j</groupId>
@@ -54,8 +53,7 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.easymock</groupId>
@@ -119,4 +117,19 @@
             </plugin>
         </plugins>
     </build>
+    
+    <profiles>
+        <profile>
+            <id>xerces</id>
+            <activation>
+                <jdk>[9,)</jdk>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>xerces</groupId>
+                    <artifactId>xercesImpl</artifactId>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
 </project>
diff --git a/services/sts/sts-core/pom.xml b/services/sts/sts-core/pom.xml
index b5879ce..bba42c5 100644
--- a/services/sts/sts-core/pom.xml
+++ b/services/sts/sts-core/pom.xml
@@ -177,4 +177,27 @@
             </plugin>
         </plugins>
     </build>
+    
+    <profiles>
+        <profile>
+            <id>xerces</id>
+            <activation>
+                <jdk>[9,)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <!--  The 
'http://javax.xml.XMLConstants/property/accessExternalSchema' is not supported 
by Xerces -->
+                                
<hazelcast.ignoreXxeProtectionFailures>true</hazelcast.ignoreXxeProtectionFailures>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
diff --git 
a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
 
b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
index 9ef7b48..e51d6a5 100644
--- 
a/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
+++ 
b/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
@@ -51,6 +51,7 @@ import org.w3c.dom.ls.LSResourceResolver;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXParseException;
 
 import org.apache.cxf.common.i18n.Message;
@@ -125,9 +126,15 @@ public class SchemaValidator extends 
AbstractDefinitionValidator {
 
         SchemaFactory sf = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
         sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
-        sf.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "file,http,https");
-        SchemaResourceResolver resourceResolver = new SchemaResourceResolver();
+        
+        try {
+            // The 
'http://javax.xml.XMLConstants/property/accessExternalSchema' is not supported 
by Xerces
+            sf.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, 
"file,http,https");
+        } catch (final SAXNotRecognizedException ex) {
+            LOG.log(Level.WARNING, "The property '" + 
XMLConstants.ACCESS_EXTERNAL_SCHEMA + "' is not supported.");
+        }
 
+        SchemaResourceResolver resourceResolver = new SchemaResourceResolver();
         sf.setResourceResolver(resourceResolver);
 
         List<Source> sources = new ArrayList<>();

Reply via email to