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

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


The following commit(s) were added to refs/heads/main by this push:
     new 4cbb41d322 Handle potential for bcel to be present for xalan native 
mode
4cbb41d322 is described below

commit 4cbb41d3225535060926272be02d0b0cdc1bde40
Author: James Netherton <[email protected]>
AuthorDate: Wed Apr 9 11:37:46 2025 +0100

    Handle potential for bcel to be present for xalan native mode
---
 .../xalan/deployment/XalanNativeImageProcessor.java   | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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 caaff56027..a6f13ceb54 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
@@ -18,6 +18,7 @@ package org.apache.camel.quarkus.support.xalan.deployment;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.function.BooleanSupplier;
 import java.util.stream.Stream;
 
 import io.quarkus.deployment.annotations.BuildProducer;
@@ -26,10 +27,12 @@ import 
io.quarkus.deployment.builditem.nativeimage.ExcludeConfigBuildItem;
 import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
 import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
 import org.apache.camel.quarkus.support.xalan.XalanTransformerFactory;
 
 class XalanNativeImageProcessor {
+    private static final String BCEL_CLASS_PATH = 
"org.apache.bcel.util.ClassPath";
     private static final String TRANSFORMER_FACTORY_SERVICE_FILE_PATH = 
"META-INF/services/javax.xml.transform.TransformerFactory";
 
     @BuildStep
@@ -85,4 +88,20 @@ class XalanNativeImageProcessor {
 
     }
 
+    @BuildStep(onlyIf = BcelIsPresent.class)
+    void 
bcelRuntimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitializedClass) {
+        runtimeInitializedClass.produce(new 
RuntimeInitializedClassBuildItem(BCEL_CLASS_PATH));
+    }
+
+    static final class BcelIsPresent implements BooleanSupplier {
+        @Override
+        public boolean getAsBoolean() {
+            try {
+                
Thread.currentThread().getContextClassLoader().loadClass(BCEL_CLASS_PATH);
+                return true;
+            } catch (ClassNotFoundException e) {
+                return false;
+            }
+        }
+    }
 }

Reply via email to