Skip to content

Commit f97e44f

Browse files
artembilangaryrussell
authored andcommitted
Fix breaking change for PersistentFileListFilter
The `AbstractPersistentAcceptOnceFileListFilter` extends now an `AbstractDirectoryAwareFileListFilter` and makes all the implementors to implement its `isDirectory()` method. This is a breaking change in the point release which makes implementations outside of the core project not compilable The regression after: #3488 Related fix in the Spring Cloud GCP: spring-attic/spring-cloud-gcp#2654 * Implement an `isDirectory()` in the `AbstractPersistentAcceptOnceFileListFilter` to let other implementations do not worry during upgrade **Cherry-pick to `5.4.x` & `5.3.x`**
1 parent 3d1b048 commit f97e44f

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractPersistentAcceptOnceFileListFilter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ protected void flushIfNeeded() {
180180
}
181181
}
182182

183+
@Override
184+
protected boolean isDirectory(F file) {
185+
return false;
186+
}
187+
183188
protected abstract long modified(F file);
184189

185190
protected abstract String fileName(F file);

spring-integration-file/src/test/java/org/springframework/integration/file/filters/PersistentAcceptOnceFileListFilterTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ protected String fileName(String file) {
111111
return file;
112112
}
113113

114-
@Override
115-
protected boolean isDirectory(String file) {
116-
return false;
117-
}
118-
119114
};
120115
doTestRollback(filter);
121116
}

spring-integration-file/src/test/java/org/springframework/integration/file/remote/StreamingInboundTests.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,19 +345,19 @@ public Session<String> getSession() {
345345
}
346346
try {
347347
Session<String> session = mock(Session.class);
348-
willReturn(new String[] { "/foo/foo", "/foo/bar" }).given(session).list("/foo");
348+
willReturn(new String[]{ "/foo/foo", "/foo/bar" }).given(session).list("/foo");
349349
ByteArrayInputStream foo = new ByteArrayInputStream("foo\nbar".getBytes());
350350
ByteArrayInputStream bar = new ByteArrayInputStream("baz\nqux".getBytes());
351351
willReturn(foo).given(session).readRaw("/foo/foo");
352352
willReturn(bar).given(session).readRaw("/foo/bar");
353353

354-
willReturn(new String[] { "/bar/foo", "/bar/bar" }).given(session).list("/bar");
354+
willReturn(new String[]{ "/bar/foo", "/bar/bar" }).given(session).list("/bar");
355355
ByteArrayInputStream foo2 = new ByteArrayInputStream("foo\r\nbar".getBytes());
356356
ByteArrayInputStream bar2 = new ByteArrayInputStream("baz\r\nqux".getBytes());
357357
willReturn(foo2).given(session).readRaw("/bar/foo");
358358
willReturn(bar2).given(session).readRaw("/bar/bar");
359359

360-
willReturn(new String[] { "/bad/file1", "/bad/file2" }).given(session).list("/bad");
360+
willReturn(new String[]{ "/bad/file1", "/bad/file2" }).given(session).list("/bad");
361361
willThrow(new IOException("No file")).given(session).readRaw("/bad/file1");
362362
willThrow(new IOException("No file")).given(session).readRaw("/bad/file2");
363363

@@ -390,11 +390,6 @@ protected String fileName(String file) {
390390
return file;
391391
}
392392

393-
@Override
394-
protected boolean isDirectory(String file) {
395-
return false;
396-
}
397-
398393
}
399394

400395
}

0 commit comments

Comments
 (0)