Skip to content

Commit 45b4338

Browse files
committed
Apply Nullability to the SMB module
Related to: #10083 Remove usage of deprecated URL ctor The `jcifs` library should come up with other algorithm how to handler URLs. Right now there is a bit of mess with just raw URLs and encoded
1 parent 2401a0f commit 45b4338

21 files changed

+36
-38
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* SMB-specific file list filter classes.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.smb.config;

spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/Smb.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Comparator;
2121

2222
import jcifs.smb.SmbFile;
23+
import org.jspecify.annotations.Nullable;
2324

2425
import org.springframework.integration.file.remote.MessageSessionCallback;
2526
import org.springframework.integration.file.remote.RemoteFileTemplate;
@@ -28,7 +29,6 @@
2829
import org.springframework.integration.file.support.FileExistsMode;
2930
import org.springframework.integration.smb.outbound.SmbOutboundGateway;
3031
import org.springframework.integration.smb.session.SmbRemoteFileTemplate;
31-
import org.springframework.lang.Nullable;
3232

3333
/**
3434
* The factory for SMB components.

spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbInboundChannelAdapterSpec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Comparator;
2121

2222
import jcifs.smb.SmbFile;
23+
import org.jspecify.annotations.Nullable;
2324

2425
import org.springframework.integration.file.dsl.RemoteFileInboundChannelAdapterSpec;
2526
import org.springframework.integration.file.filters.CompositeFileListFilter;
@@ -31,7 +32,6 @@
3132
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter;
3233
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer;
3334
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource;
34-
import org.springframework.lang.Nullable;
3535

3636
/**
3737
* A {@link RemoteFileInboundChannelAdapterSpec} for an {@link SmbInboundFileSynchronizingMessageSource}.

spring-integration-smb/src/main/java/org/springframework/integration/smb/dsl/SmbStreamingInboundChannelAdapterSpec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Comparator;
2020

2121
import jcifs.smb.SmbFile;
22+
import org.jspecify.annotations.Nullable;
2223

2324
import org.springframework.integration.file.dsl.RemoteFileStreamingInboundChannelAdapterSpec;
2425
import org.springframework.integration.file.filters.CompositeFileListFilter;
@@ -29,7 +30,6 @@
2930
import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter;
3031
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter;
3132
import org.springframework.integration.smb.inbound.SmbStreamingMessageSource;
32-
import org.springframework.lang.Nullable;
3333

3434
/**
3535
* A {@link RemoteFileStreamingInboundChannelAdapterSpec} for a {@link SmbStreamingMessageSource}.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Provides SMB Components for the Java DSL.
33
*/
4-
@org.springframework.lang.NonNullApi
5-
@org.springframework.lang.NonNullFields
4+
@org.jspecify.annotations.NullMarked
65
package org.springframework.integration.smb.dsl;

spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbRegexPatternFileListFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public SmbRegexPatternFileListFilter(Pattern pattern) {
5050
*/
5151
@Override
5252
protected String getFilename(SmbFile file) {
53-
return (file != null ? file.getName() : null);
53+
return file.getName();
5454
}
5555

5656
@Override

spring-integration-smb/src/main/java/org/springframework/integration/smb/filters/SmbSimplePatternFileListFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public SmbSimplePatternFileListFilter(String pathPattern) {
4545
*/
4646
@Override
4747
protected String getFilename(SmbFile file) {
48-
return (file != null) ? file.getName() : null;
48+
return file.getName();
4949
}
5050

5151
@Override
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* SMB Namespace support classes.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.smb.filters;

spring-integration-smb/src/main/java/org/springframework/integration/smb/inbound/SmbInboundFileSynchronizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public SmbInboundFileSynchronizer(SessionFactory<SmbFile> sessionFactory) {
4343
@Override
4444
protected boolean isFile(SmbFile _file) {
4545
try {
46-
return _file != null && _file.isFile();
46+
return _file.isFile();
4747
}
4848
catch (Exception _ex) {
4949
logger.warn("Unable to get resource status [" + _file + "].", _ex);
@@ -53,7 +53,7 @@ protected boolean isFile(SmbFile _file) {
5353

5454
@Override
5555
protected String getFilename(SmbFile _file) {
56-
return _file != null ? _file.getName() : null;
56+
return _file.getName();
5757
}
5858

5959
@Override

spring-integration-smb/src/main/java/org/springframework/integration/smb/inbound/SmbInboundFileSynchronizingMessageSource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Comparator;
2121

2222
import jcifs.smb.SmbFile;
23+
import org.jspecify.annotations.Nullable;
2324

2425
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer;
2526
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource;
@@ -38,7 +39,8 @@ public SmbInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<
3839
}
3940

4041
public SmbInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<SmbFile> _synchronizer,
41-
Comparator<File> _comparator) {
42+
@Nullable Comparator<File> _comparator) {
43+
4244
super(_synchronizer, _comparator);
4345
}
4446

0 commit comments

Comments
 (0)