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/16 20:32:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17137910#comment-17137910 ] 

Luca Burgazzoli commented on CAMEL-15199:
-----------------------------------------

[~davsclaus] beside the issue why do we use a Class a parameter for type/outType, then we set it as a string and finally we dynamic load it ? I guess it has to do with XML 

> 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.4.1, 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 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)