You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/04/03 13:11:39 UTC

[camel-quarkus] 02/02: Fix #4710 to register reflection for FastStringBuffer and resource bundle for XMLErrorResources (#4720)

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

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 92ba2e6d5612e01604feb8af7ef47e345d7109c4
Author: Zheng Feng <zh...@gmail.com>
AuthorDate: Thu Mar 30 21:05:47 2023 +0800

    Fix #4710 to register reflection for FastStringBuffer and resource bundle for XMLErrorResources (#4720)
---
 .../support/xalan/deployment/XalanNativeImageProcessor.java        | 6 ++++--
 .../org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java | 7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java b/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
index 46d2664dba..96a32b0736 100644
--- a/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
+++ b/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
@@ -56,7 +56,8 @@ class XalanNativeImageProcessor {
                 "org.apache.xml.dtm.ref.DTMManagerDefault",
                 "org.apache.xml.serializer.OutputPropertiesFactory",
                 "org.apache.xml.serializer.CharInfo",
-                "org.apache.xml.serializer.XMLEntities");
+                "org.apache.xml.serializer.XMLEntities",
+                "org.apache.xml.utils.FastStringBuffer");
     }
 
     @BuildStep
@@ -64,7 +65,8 @@ class XalanNativeImageProcessor {
         return Arrays.asList(
                 new NativeImageResourceBundleBuildItem("org.apache.xalan.xsltc.compiler.util.ErrorMessages"),
                 new NativeImageResourceBundleBuildItem("org.apache.xml.serializer.utils.SerializerMessages"),
-                new NativeImageResourceBundleBuildItem("org.apache.xml.serializer.XMLEntities"));
+                new NativeImageResourceBundleBuildItem("org.apache.xml.serializer.XMLEntities"),
+                new NativeImageResourceBundleBuildItem("org.apache.xml.res.XMLErrorResources"));
     }
 
     @BuildStep
diff --git a/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
index b018598291..0b61e25f5b 100644
--- a/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
+++ b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
@@ -22,6 +22,7 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.xslt.saxon.XsltSaxonAggregationStrategy;
 import org.apache.camel.support.builder.Namespaces;
+import org.apache.xpath.XPathAPI;
 
 // These reflections registrations should be removed with fixing https://github.com/apache/camel-quarkus/issues/1615
 @RegisterForReflection(classNames = {
@@ -49,7 +50,11 @@ public class XmlRouteBuilder extends RouteBuilder {
         from(DIRECT_XML_CBR)
                 .choice()
                 .when(xpath("//order/country = 'UK'"))
-                .setBody(constant("Country UK"))
+                .process(exchange -> {
+                    Document body = exchange.getIn().getBody(Document.class);
+                    String country = XPathAPI.eval(body, "//order/country").toString();
+                    exchange.getIn().setBody("Country " + country);
+                })
                 .otherwise()
                 .setBody(constant("Invalid country code"));