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:07:00 UTC

[jira] [Created] (CAMEL-15199) RestDefinition relies on Class.getCanonicalName instead of Class.getName for in/out types

Luca Burgazzoli created CAMEL-15199:
---------------------------------------

             Summary: 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
             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)