Source:
<code>public void configureMessageChannel(MessageChannel messageChannel, String channelName) { BindingProperties bindingProperties = channelBindingServiceProperties.getBindings().get(channelName); if (bindingProperties != null && Boolean.TRUE.equals(bindingProperties.isTrackHistory())) { <START> final Set<String> trackHistoryProperties = StringUtils.commaDelimitedListToSet(bindingProperties.getTrackHistoryProperties()); <END> Map<String, Object> channelBindingServicePropertiesMap = channelBindingServiceProperties.asMapProperties(); final Map<String, Object> historyMap = new HashMap<>(); if (bindingProperties.getTrackHistoryProperties().equalsIgnoreCase("all")) { historyMap.putAll(channelBindingServicePropertiesMap); } else { for (String property : trackHistoryProperties) { if (channelBindingServicePropertiesMap.keySet().contains(property)) { historyMap.put(property, channelBindingServicePropertiesMap.get(property)); } } } if (messageChannel instanceof ChannelInterceptorAware) { ((ChannelInterceptorAware) messageChannel).addInterceptor(new ChannelInterceptorAdapter() { @Override public Message<?> preSend(Message<?> message, MessageChannel channel) { @SuppressWarnings("unchecked") Collection<Map<String, Object>> history = (Collection<Map<String, Object>>) message.getHeaders().get(HISTORY_TRACKING_HEADER); if (history == null) { history = new ArrayList<>(1); } else { history = new ArrayList<>(history); } Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("thread", Thread.currentThread().getName()); map.putAll(historyMap); history.add(map); Message<?> out = messageBuilderFactory .fromMessage(message) .setHeader(HISTORY_TRACKING_HEADER, history) .build(); map.put("timestamp", out.getHeaders().getTimestamp()); return out; } }); } } }</code><technical_language>check for empty array of tracked properties too. behaviour in case</technical_language>

Target:
public void configureMessageChannel(MessageChannel messageChannel, String channelName) { BindingProperties bindingProperties = channelBindingServiceProperties.getBindings().get(channelName); if (bindingProperties != null && Boolean.TRUE.equals(bindingProperties.isTrackHistory())) { final Set<String> trackHistoryProperties = StringUtils.commaDelimitedListToSet(bindingProperties.getTrackedProperties()); Map<String, Object> channelBindingServicePropertiesMap = channelBindingServiceProperties.asMapProperties(); final Map<String, Object> historyMap = new HashMap<>(); if (bindingProperties.getTrackedProperties().equalsIgnoreCase("all")) { historyMap.putAll(channelBindingServicePropertiesMap); } else { for (String property : trackHistoryProperties) { if (channelBindingServicePropertiesMap.keySet().contains(property)) { historyMap.put(property, channelBindingServicePropertiesMap.get(property)); } } } if (messageChannel instanceof ChannelInterceptorAware) { ((ChannelInterceptorAware) messageChannel).addInterceptor(new ChannelInterceptorAdapter() { @Override public Message<?> preSend(Message<?> message, MessageChannel channel) { @SuppressWarnings("unchecked") Collection<Map<String, Object>> history = (Collection<Map<String, Object>>) message.getHeaders().get(HISTORY_TRACKING_HEADER); if (history == null) { history = new ArrayList<>(1); } else { history = new ArrayList<>(history); } Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("thread", Thread.currentThread().getName()); map.putAll(historyMap); history.add(map); Message<?> out = messageBuilderFactory .fromMessage(message) .setHeader(HISTORY_TRACKING_HEADER, history) .build(); map.put("timestamp", out.getHeaders().getTimestamp()); return out; } }); } } }