You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (Jira)" <ji...@apache.org> on 2020/06/19 06:43:00 UTC
[jira] [Resolved] (CAMEL-15199) RestDefinition relies on
Class.getCanonicalName instead of Class.getName for in/out types
[ https://issues.apache.org/jira/browse/CAMEL-15199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luca Burgazzoli resolved CAMEL-15199.
-------------------------------------
Resolution: Fixed
> RestDefinition relies on Class.getCanonicalName instead of Class.getName for in/out types
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-15199
> URL: https://issues.apache.org/jira/browse/CAMEL-15199
> Project: Camel
> Issue Type: Bug
> Components: camel-core-engine
> Reporter: Luca Burgazzoli
> Assignee: Luca Burgazzoli
> Priority: Major
> Fix For: 3.5.0
>
>
> RestDefinition [relies|https://github.com/apache/camel/blob/3380f7f616b08976627c13a5c232bfc105ace3ae/core/camel-core-engine/src/main/java/org/apache/camel/model/rest/RestDefinition.java#L456-L476] on Class.getCanonicalName instead of Class.getName for in/out types.
> This work as long as the type is not an inner class getCanonicalName does not return a name that can be used to load a class.
> As example
> {code:java}
> package my.example;
> public class MyRoutes extends org.apache.camel.builder.RouteBuilder {
> @Override
> public void configure() throws Exception {
> rest()
> .post("/order")
> .type(MyOrder.class)
> .consumes("application/json")
> .produces("application/json")
> .bindingMode(RestBindingMode.json)
> .route()
> .log("${body}");
> }
> public static class MyOrder {
> public String id;
> }
> }
> {code}
> Then camel would set my.example.MyRoutes.MyOrder as in type but that's wrong and the subsequent attemp to load the class by name, will fail as it should be my.example.MyRoutes$MyOrder (which is what Class.getName would return).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)