我使用Spring-integration FileSplitter并使用FileMarker-s作为有序处理文件,但对于空文件,我得到IOException。没有FileMarker-s一切正常
堆栈跟踪:
Caused by: java.io.IOException: Stream closed
at java.io.BufferedReader.ensureOpen(BufferedReader.java:122)
at java.io.BufferedReader.readLine(BufferedReader.java:317)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at org.springframework.integration.file.splitter.FileSplitter$1.hasNext(FileSplitter.java:183)
... 50 more
XML的配置:
<int:chain input-channel="channel.read.file" output-channel="channel.process.input">
<int-file:splitter markers="true"/>
<int:filter expression="!(payload instanceof T(org.springframework.integration.file.splitter.FileSplitter.FileMarker))"
discard-channel="channel.process.file.marker"/>
</int:chain>