Edem Tiassou created CAMEL-13954:
------------------------------------
Summary: 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
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)