Skip to content

Commit c346e99

Browse files
committed
Ignore temporary .writing files when finding output files
Spring Integration's FileWritingMessageHandler uses a .writing file while it's in the process of writing a message to disk and then performs a rename (depending on the OS and filesystem this may or may not be atommic) to create the .msg file. Prior to this commit the test was finding the temporary .writing files and examining them. This could lead to a FileNotFoundException being thrown as the temporary file was deleted while the test was trying to read its contents. This commit updates the test to only look for files with a .msg suffix Fixes gh-2428
1 parent c3020e9 commit c346e99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private void awaitOutputContaining(final String requiredContents) throws Excepti
8787

8888
private Resource[] findResources() throws IOException {
8989
return ResourcePatternUtils.getResourcePatternResolver(
90-
new DefaultResourceLoader()).getResources("file:target/output/**");
90+
new DefaultResourceLoader()).getResources("file:target/output/**/*.msg");
9191
}
9292

9393
private String readResources(Resource[] resources) throws IOException {

0 commit comments

Comments
 (0)