You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/04/14 10:17:23 UTC

[camel-quarkus] 01/04: 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.

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

commit a726b92998eaab0947eb6187949fa330f2fd450c
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        | 5 +++--
 .../org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java | 7 ++++++-
 2 files changed, 9 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..959df1d121 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,7 @@ 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.utils.FastStringBuffer");
     }
 
     @BuildStep
@@ -64,7 +64,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 1383f2172e..4a186f396c 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 = {
@@ -50,7 +51,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"));