INT-1857 using LinkedHashSet instead of HashSet to preserve order of File instances in the List returned by a filter

This commit is contained in:
Mark Fisher
2011-04-18 09:53:23 -04:00
parent 2ccdde8744
commit bd81fe9db2

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ package org.springframework.integration.file;
import java.io.File;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Queue;
import java.util.Set;
@@ -265,7 +265,7 @@ public class FileReadingMessageSource extends IntegrationObjectSupport implement
private void scanInputDirectory() {
List<File> filteredFiles = scanner.listFiles(directory);
Set<File> freshFiles = new HashSet<File>(filteredFiles);
Set<File> freshFiles = new LinkedHashSet<File>(filteredFiles);
if (!freshFiles.isEmpty()) {
toBeReceived.addAll(freshFiles);
if (logger.isDebugEnabled()) {