This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new d7ebff5f82e chore: Allow DataTypeProcessor used as processor definition (#11233) d7ebff5f82e is described below commit d7ebff5f82e36311dd5506eda6ca19e2b51957f7 Author: Christoph Deppisch <cdeppi...@redhat.com> AuthorDate: Tue Aug 29 20:56:28 2023 +0200 chore: Allow DataTypeProcessor used as processor definition (#11233) * chore: Allow DataTypeProcessor used as processor definition - Avoid ClassCastException when DataTypeProcessor is used as part of a ProcessorDefinition - Allows users to reference the DataTypeProcessor as a normal processor in a route as an addition to using it in TransformDefinition * chore: Avoid null value as from data type in data type processor --- .../java/org/apache/camel/processor/transformer/DataTypeProcessor.java | 2 +- .../org/apache/camel/management/DefaultManagementObjectStrategy.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/transformer/DataTypeProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/transformer/DataTypeProcessor.java index a7f9212bead..4c665a21393 100644 --- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/transformer/DataTypeProcessor.java +++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/transformer/DataTypeProcessor.java @@ -72,7 +72,7 @@ public class DataTypeProcessor implements Processor { DataType fromDataType = DataType.ANY; if (fromType != null) { fromDataType = new DataType(fromType); - } else if (message instanceof DataTypeAware) { + } else if (message instanceof DataTypeAware && ((DataTypeAware) message).hasDataType()) { fromDataType = ((DataTypeAware) message).getDataType(); } diff --git a/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java b/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java index 773573228aa..7e6f4ab6463 100644 --- a/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java +++ b/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java @@ -439,7 +439,7 @@ public class DefaultManagementObjectStrategy implements ManagementObjectStrategy answer = new ManagedThrowException(context, (ThrowExceptionProcessor) target, definition); } else if (target instanceof TransformProcessor) { answer = new ManagedTransformer(context, target, (TransformDefinition) definition); - } else if (target instanceof DataTypeProcessor) { + } else if (target instanceof DataTypeProcessor && definition instanceof TransformDefinition) { answer = new ManagedTransformer(context, target, (TransformDefinition) definition); } else if (target instanceof PredicateValidatingProcessor) { answer = new ManagedValidate(context, (PredicateValidatingProcessor) target, (ValidateDefinition) definition);