I have defined a SftpInboundFileSynchronizer class. I want to filter remote files which is of csv and txt files only. file extension array has *.csv and *.txt value
SftpInboundFileSynchronizer fileSynchronizer = new
SftpInboundFileSynchronizer(sftpSessionFactory());
PathPatternParser pp = new PathPatternParser();
PathPattern pattern = null;
for(String fileExtension: fileExtensionArray) {
if(pattern == null) {
pattern = pp.parse(fileExtension);
} else {
pattern.combine(pp.parse(fileExtension));
}
}
fileSynchronizer.setFilter(new
SftpSimplePatternFileListFilter(pattern.getPatternString()));
The above throws the below exception
java.lang.IllegalArgumentException: Cannot combine patterns: *.csv and *.txt
How to fix this error?
Thanks