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

Generated property configurator is using wrong method on endpoint (camel-file-watch component)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0.RC1
    • 3.0.0.RC2, 3.0.0
    • None
    • None
    • Unknown

    Description

      Hi, I'am very new at Camel and I've being trying to use the component camel-file-watch (version:3.0.0-RC1).
      When I set thing up with spring-boot, it does not seem to dectect file systems events.
      With a little investigation, I found that the property conversion of events from the uri scheme (file-watch://some-directory?events=DELETE,CREATE) to the endpoint is calling

      (FileWatchEndpoint.java)
      public void setEvents(Set<FileEventEnum> events)

      { this.events = events; }

      Instead of

      (FileWatchEndpoint.java)
      @SuppressWarnings("unused") //called via reflection
      public void setEvents(String commaSeparatedEvents) {
      String[] stringArray = commaSeparatedEvents.split(",");
      Set<FileEventEnum> eventsSet = new HashSet<>();
      for (String event : stringArray)

      { eventsSet.add(FileEventEnum.valueOf(event.trim())); }

      events = eventsSet.isEmpty() ? new HashSet<>(Arrays.asList(FileEventEnum.values())) : eventsSet;
      }

      (FileWatchEndpoint.java) events object declaration

      @UriParam(label = "consumer",
      enums = "CREATE,MODIFY,DELETE",
      description = "Comma separated list of events to watch.",
      defaultValue = "CREATE,MODIFY,DELETE")
      private Set<FileEventEnum> events = new HashSet<>(Arrays.asList(FileEventEnum.values()));

      Basically the conversion from String to Set<FileEventEnum> fails and the component is calling the first method listed above with Set<String> instead of Set<FileEventEnum>

      I got it to work by adding a converter from String to Set<FileEventEnum> but I feel like this should have been taken care of by the component.

      Let me know what you think

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tiaede00 Edem Tiassou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m