Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15199

RestDefinition relies on Class.getCanonicalName instead of Class.getName for in/out types

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.5.0
    • came-core
    • None
    • Unknown

    Description

      RestDefinition relies 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

      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;
          }
      }
      

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

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            lb Luca Burgazzoli
            lb Luca Burgazzoli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment