You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2019/09/06 19:40:00 UTC

[jira] [Commented] (CAMEL-13954) Generated property configurator is using wrong method on endpoint (camel-file-watch component)

    [ https://issues.apache.org/jira/browse/CAMEL-13954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16924552#comment-16924552 ] 

Claus Ibsen commented on CAMEL-13954:
-------------------------------------

Yeah it should be fixed in the component, we have done it for others which had a similar issue.

> Generated property configurator is using wrong method on endpoint (camel-file-watch component)
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-13954
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13954
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.0.0.RC1
>            Reporter: Edem Tiassou
>            Priority: Major
>
> 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



--
This message was sent by Atlassian Jira
(v8.3.2#803003)