You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/04/02 14:10:58 UTC

[GitHub] [camel-quarkus] ppalaga opened a new pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

ppalaga opened a new pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018
 
 
   Fix #1017

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402404163
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   > what if you remove optional ? does it get the default ?
   
   Strange enough it is neither null or default: it throws an exception
   
   ```
   java.util.NoSuchElementException: Property quarkus.camel.xalan.transformer-factory not found
           at io.quarkus.test.junit.QuarkusTestExtension.beforeEach(QuarkusTestExtension.java:191)
           at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachCallbacks$1(TestMethodTestDescriptor.java:154)
           at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$5(TestMethodTestDescriptor.java:190)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:190)
           at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachCallbacks(TestMethodTestDescriptor.java:153)
           at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
           at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
           at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
           at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
           at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
           at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
           at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
           at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
           at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
           at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
           at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
           at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
           at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
           at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
           at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
           at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
           at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
           at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)
           at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)
           at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
           at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
           at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
           at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
   Caused by: java.lang.RuntimeException: java.util.NoSuchElementException: Property quarkus.camel.xalan.transformer-factory not found
           at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:206)
           at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:95)
           at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:45)
           at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:96)
           at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:205)
           at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:228)
           at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
           at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
           at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
           at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
           at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
           at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
           ... 31 more
   Caused by: java.util.NoSuchElementException: Property quarkus.camel.xalan.transformer-factory not found
           at io.smallrye.config.SmallRyeConfig.propertyNotFound(SmallRyeConfig.java:209)
           at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:96)
           at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.readConfigValue(BuildTimeConfigurationReader.java:616)
           at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.readConfigGroup(BuildTimeConfigurationReader.java:561)
           at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.run(BuildTimeConfigurationReader.java:284)
           at io.quarkus.deployment.configuration.BuildTimeConfigurationReader.readConfiguration(BuildTimeConfigurationReader.java:241)
           at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:204)
           at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:136)
           at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:93)
           at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:204)
           ... 42 more
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402349024
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   We don't provide any substitution for other transformers so it should be clear that any value except the default is out of our support

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402368724
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   I don't have one in mind but with this seems to indicate one can swap the implementation to whatever transformer factory and that's all that is needed but that may not be true as the user has to take care of any substitution that may be needed 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402368724
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   I don't have one in mind but with this seems to indicate one can swap the implementation to whatever transformer factory and that's all but that may not be true  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402420510
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
 
 Review comment:
   How about this new variant of the text?
   
   ```suggestion
        * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
        * at the application startup. The system property effectively overrides any service providers defined in
        * {@code META-INF/services/javax.xml.transform.TransformerFactory} files available in the class path. If you do not
        * set the option the default value is used and the service providers are overriden anyway.
        * <p>
        * Note that any custom transformer factory you pass will only work in native mode if all necessary classes are
        * registered for reflection and all necessary resources are included in the native image. This may already be the
        * case for {@code com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl} if you depend on
        * {@code io.quarkus:quarkus-jaxb} or {@code org.apache.xalan.xsltc.trax.TransformerFactoryImpl} if you depend on
        * {@code org.apache.camel.quarkus:camel-quarkus-support-xalan}.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga merged pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402422698
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   :(

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402358028
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   > it probably does not need to be Optional
   
   Maybe. I was not sure what 
   
   ```
   camel.xalan.transformer-factory = 
   ```
   
   would do. I'd naively expect it to be null/nonPresent. I should test it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on issue #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#issuecomment-607942442
 
 
   Even better config docs in 349782f

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402360232
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   > We don't provide any substitution for other transformers so it should be clear that any value except the default is out of our support
   
   If you mean the text should be different, plz. propose a change. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402351002
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
 ##########
 @@ -52,4 +55,29 @@ ReflectiveClassBuildItem reflectiveClasses() {
         return Arrays.asList(
                 new NativeImageResourceBuildItem("org/apache/xml/serializer/output_xml.properties"));
     }
+
+    @BuildStep
+    void installTransformerFactory(
+            CamelXalanBuildTimeConfig config,
+            BuildProducer<SystemPropertyBuildItem> properties,
+            BuildProducer<ServiceProviderBuildItem> serviceProviders,
+            BuildProducer<NativeImageResourceBuildItem> nativeResources) {
+
+        config.transformerFactory
+                .ifPresent(val -> properties.produce(
+                        /*
+                         * If we do not do this, the service provider defined in xalan.jar's
+                         * META-INF/services/javax.xml.transform.TransformerFactory
+                         * wins over our factory on Java 11+ native
+                         * I any case, the user has an option to pass his preferred factory instead of ours
+                         */
+                        new SystemPropertyBuildItem("javax.xml.transform.TransformerFactory", val)));
 
 Review comment:
   It was an issue even before but this does not apply to JVM so we could have different behavior between native and jvm

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402396381
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   I have tested with
   
   ```
   quarkus.camel.xalan.transformer-factory =
   ```
   
   and it makes the Optional.isPresent() to return false.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402397992
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   what if you remove optional ? does it get the default ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402366558
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
 ##########
 @@ -52,4 +55,29 @@ ReflectiveClassBuildItem reflectiveClasses() {
         return Arrays.asList(
                 new NativeImageResourceBuildItem("org/apache/xml/serializer/output_xml.properties"));
     }
+
+    @BuildStep
+    void installTransformerFactory(
+            CamelXalanBuildTimeConfig config,
+            BuildProducer<SystemPropertyBuildItem> properties,
+            BuildProducer<ServiceProviderBuildItem> serviceProviders,
+            BuildProducer<NativeImageResourceBuildItem> nativeResources) {
+
+        config.transformerFactory
+                .ifPresent(val -> properties.produce(
+                        /*
+                         * If we do not do this, the service provider defined in xalan.jar's
+                         * META-INF/services/javax.xml.transform.TransformerFactory
+                         * wins over our factory on Java 11+ native
+                         * I any case, the user has an option to pass his preferred factory instead of ours
+                         */
+                        new SystemPropertyBuildItem("javax.xml.transform.TransformerFactory", val)));
 
 Review comment:
   ah sorry I misread it, my bad

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402355953
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
 ##########
 @@ -52,4 +55,29 @@ ReflectiveClassBuildItem reflectiveClasses() {
         return Arrays.asList(
                 new NativeImageResourceBuildItem("org/apache/xml/serializer/output_xml.properties"));
     }
+
+    @BuildStep
+    void installTransformerFactory(
+            CamelXalanBuildTimeConfig config,
+            BuildProducer<SystemPropertyBuildItem> properties,
+            BuildProducer<ServiceProviderBuildItem> serviceProviders,
+            BuildProducer<NativeImageResourceBuildItem> nativeResources) {
+
+        config.transformerFactory
+                .ifPresent(val -> properties.produce(
+                        /*
+                         * If we do not do this, the service provider defined in xalan.jar's
+                         * META-INF/services/javax.xml.transform.TransformerFactory
+                         * wins over our factory on Java 11+ native
+                         * I any case, the user has an option to pass his preferred factory instead of ours
+                         */
+                        new SystemPropertyBuildItem("javax.xml.transform.TransformerFactory", val)));
 
 Review comment:
   > this does not apply to JVM
   
   It does. There is `NativeImageSystemPropertyBuildItem` that applies to native only.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] ppalaga commented on issue #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#issuecomment-607943854
 
 
   Fixed trailing whitespace in 349782f

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on a change in pull request #1018: Fix #1017 Do not hardcode the TransformerFactory implementation irrev…
URL: https://github.com/apache/camel-quarkus/pull/1018#discussion_r402350182
 
 

 ##########
 File path: extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/CamelXalanBuildTimeConfig.java
 ##########
 @@ -14,24 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.support.xalan.graal;
+package org.apache.camel.quarkus.support.xalan.deployment;
 
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import java.util.Optional;
 
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.xalan.xsltc.trax.TransformerFactoryImpl;
+import io.quarkus.runtime.annotations.ConfigItem;
+import io.quarkus.runtime.annotations.ConfigPhase;
+import io.quarkus.runtime.annotations.ConfigRoot;
 
-@TargetClass(className = "javax.xml.transform.TransformerFactory")
-final class TransformerFactorySubstitution {
-    @Substitute
-    public static TransformerFactory newDefaultInstance() {
-        return new TransformerFactoryImpl();
-    }
+@ConfigRoot(name = "camel.xalan", phase = ConfigPhase.BUILD_TIME)
+public class CamelXalanBuildTimeConfig {
 
-    @Substitute
-    public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError {
-        return newDefaultInstance();
-    }
+    /**
+     * A fully qualified class name to set as the {@code javax.xml.transform.TransformerFactory} system property early
+     * at the application startup.
+     */
+    @ConfigItem(defaultValue = "org.apache.camel.quarkus.support.xalan.XalanTransformerFactory")
+    public Optional<String> transformerFactory;
 
 Review comment:
   btw it probably does not need to be Optional as it has a default value

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services