Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ protected boolean shouldMarkSessionAsDirty(Exception ex) {
}

@Override
public <T, C> T executeWithClient(ClientCallback<C, T> callback) {
public <T, C> @Nullable T executeWithClient(ClientCallback<C, T> callback) {
throw new UnsupportedOperationException("executeWithClient() is not supported by the generic template");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.springframework.integration.file.remote.server;

import org.jspecify.annotations.Nullable;

import org.springframework.integration.events.IntegrationEvent;

/**
Expand All @@ -34,7 +36,7 @@ public FileServerEvent(Object source) {
super(source);
}

public FileServerEvent(Object source, Throwable cause) {
public FileServerEvent(Object source, @Nullable Throwable cause) {
super(source, cause);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes for configuration - parsers, namespace handlers.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.config;
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Comparator;

import org.apache.sshd.sftp.client.SftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.remote.MessageSessionCallback;
import org.springframework.integration.file.remote.RemoteFileTemplate;
Expand All @@ -28,7 +29,6 @@
import org.springframework.integration.file.support.FileExistsMode;
import org.springframework.integration.sftp.gateway.SftpOutboundGateway;
import org.springframework.integration.sftp.session.SftpRemoteFileTemplate;
import org.springframework.lang.Nullable;

/**
* The factory for SFTP components.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Comparator;

import org.apache.sshd.sftp.client.SftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.dsl.RemoteFileInboundChannelAdapterSpec;
import org.springframework.integration.file.filters.CompositeFileListFilter;
Expand All @@ -31,7 +32,6 @@
import org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter;
import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizer;
import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizingMessageSource;
import org.springframework.lang.Nullable;

/**
* A {@link RemoteFileInboundChannelAdapterSpec} for an {@link SftpInboundFileSynchronizingMessageSource}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Comparator;

import org.apache.sshd.sftp.client.SftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.dsl.RemoteFileStreamingInboundChannelAdapterSpec;
import org.springframework.integration.file.filters.CompositeFileListFilter;
Expand All @@ -29,7 +30,6 @@
import org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilter;
import org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter;
import org.springframework.integration.sftp.inbound.SftpStreamingMessageSource;
import org.springframework.lang.Nullable;

/**
* @author Gary Russell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* Provides SFTP Components for the Java DSL.
*/
@org.springframework.lang.NonNullApi
@org.springframework.lang.NonNullFields
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.dsl;
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SftpRegexPatternFileListFilter(Pattern pattern) {

@Override
protected String getFilename(SftpClient.DirEntry entry) {
return (entry != null) ? entry.getFilename() : null;
return entry.getFilename();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public SftpSimplePatternFileListFilter(String pattern) {

@Override
protected String getFilename(SftpClient.DirEntry entry) {
return (entry != null) ? entry.getFilename() : null;
return entry.getFilename();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes supporting SFTP file filtering.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.filters;
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.stream.Collectors;

import org.apache.sshd.sftp.client.SftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.remote.AbstractFileInfo;
import org.springframework.integration.file.remote.ClientCallbackWithoutResult;
Expand All @@ -33,7 +34,6 @@
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.sftp.session.SftpFileInfo;
import org.springframework.integration.sftp.session.SftpRemoteFileTemplate;
import org.springframework.lang.Nullable;

/**
* Outbound Gateway for performing remote file operations via SFTP.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes supporting SFTP gateways.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.gateway;
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public SftpInboundFileSynchronizer(SessionFactory<SftpClient.DirEntry> sessionFa

@Override
protected boolean isFile(SftpClient.DirEntry file) {
return file != null && file.getAttributes().isRegularFile();
return file.getAttributes().isRegularFile();
}

@Override
protected String getFilename(SftpClient.DirEntry file) {
return file != null ? file.getFilename() : null;
return file.getFilename();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Comparator;

import org.apache.sshd.sftp.client.SftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource;
Expand All @@ -42,7 +43,7 @@ public SftpInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer
}

public SftpInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<SftpClient.DirEntry> synchronizer,
Comparator<File> comparator) {
@Nullable Comparator<File> comparator) {

super(synchronizer, comparator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;

import org.apache.sshd.sftp.client.SftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.remote.AbstractFileInfo;
import org.springframework.integration.file.remote.AbstractRemoteFileStreamingMessageSource;
Expand Down Expand Up @@ -58,7 +59,7 @@ public SftpStreamingMessageSource(RemoteFileTemplate<SftpClient.DirEntry> templa
*/
@SuppressWarnings("this-escape")
public SftpStreamingMessageSource(RemoteFileTemplate<SftpClient.DirEntry> template,
Comparator<SftpClient.DirEntry> comparator) {
@Nullable Comparator<SftpClient.DirEntry> comparator) {

super(template, comparator);
doSetFilter(new SftpPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), "sftpStreamingMessageSource"));
Expand All @@ -80,7 +81,7 @@ protected List<AbstractFileInfo<SftpClient.DirEntry>> asFileInfoList(Collection<

@Override
protected boolean isDirectory(SftpClient.DirEntry file) {
return file != null && file.getAttributes().isDirectory();
return file.getAttributes().isDirectory();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes supporting inbound endpoints.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.inbound;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes for the SFTP outbound channel adapter.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.outbound;
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.integration.sftp.server;

import org.apache.sshd.server.session.ServerSession;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.file.remote.server.FileServerEvent;

Expand All @@ -35,7 +36,7 @@ public ApacheMinaSftpEvent(Object source) {
super(source);
}

public ApacheMinaSftpEvent(Object source, Throwable cause) {
public ApacheMinaSftpEvent(Object source, @Nullable Throwable cause) {
super(source, cause);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.sshd.server.session.ServerSession;
import org.apache.sshd.sftp.server.FileHandle;
import org.apache.sshd.sftp.server.SftpEventListener;
import org.jspecify.annotations.Nullable;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
Expand All @@ -45,9 +46,10 @@
public class ApacheMinaSftpEventListener
implements SftpEventListener, ApplicationEventPublisherAware, BeanNameAware, InitializingBean {

@SuppressWarnings("NullAway.Init")
private ApplicationEventPublisher applicationEventPublisher;

private String beanName;
private @Nullable String beanName;

@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
Expand All @@ -63,7 +65,7 @@ public void setBeanName(String name) {
this.beanName = name;
}

public String getBeanName() {
public @Nullable String getBeanName() {
return this.beanName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import java.nio.file.Path;
import java.util.Map;

import org.springframework.lang.Nullable;

/**
* An event emitted when a directory is created.
*
Expand All @@ -43,7 +41,6 @@ public DirectoryCreatedEvent(Object source, Path path, Map<String, ?> attrs) {
this.attrs = attrs;
}

@Nullable
public Path getPath() {
return this.path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.nio.file.Path;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.Nullable;

/**
* An event that is emitted when a file is written.
Expand Down Expand Up @@ -48,7 +48,6 @@ public String getRemoteHandle() {
return this.remoteHandle;
}

@Nullable
public Path getFile() {
return this.file;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.nio.file.Path;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.Nullable;

/**
* An event emitted when a path is moved.
Expand All @@ -41,12 +41,10 @@ public PathMovedEvent(Object source, Path srcPath, Path dstPath, @Nullable Throw
this.dstPath = dstPath;
}

@Nullable
public Path getSrcPath() {
return this.srcPath;
}

@Nullable
public Path getDstPath() {
return this.dstPath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.nio.file.Path;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.Nullable;

/**
* An event emitted when a file or directory is removed.
Expand All @@ -41,7 +41,6 @@ public PathRemovedEvent(Object source, Path path, boolean isDirectory, @Nullable
this.isDirectory = isDirectory;
}

@Nullable
public Path getPath() {
return this.path;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes related to SFTP servers.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.sftp.server;
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.apache.sshd.sftp.client.SftpVersionSelector;
import org.apache.sshd.sftp.client.impl.AbstractSftpClient;
import org.apache.sshd.sftp.client.impl.DefaultSftpClient;
import org.jspecify.annotations.Nullable;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.core.io.Resource;
Expand Down Expand Up @@ -94,35 +95,37 @@ public class DefaultSftpSessionFactory

private final boolean isSharedSession;

private final Lock sharedSessionLock;
private final @Nullable Lock sharedSessionLock;

private boolean isInnerClient = false;

@SuppressWarnings("NullAway.Init")
private String host;

private int port = SshConstants.DEFAULT_PORT;

@SuppressWarnings("NullAway.Init")
private String user;

private String password;
private @Nullable String password;

private HostConfigEntry hostConfig;
private @Nullable HostConfigEntry hostConfig;

private Resource knownHosts;
private @Nullable Resource knownHosts;

private Resource privateKey;
private @Nullable Resource privateKey;

private String privateKeyPassphrase;
private @Nullable String privateKeyPassphrase;

private UserInteraction userInteraction;
private @Nullable UserInteraction userInteraction;

private boolean allowUnknownKeys = false;

private Integer timeout = (int) IntegrationContextUtils.DEFAULT_TIMEOUT;

private SftpVersionSelector sftpVersionSelector = SftpVersionSelector.CURRENT;

private volatile SftpClient sharedSftpClient;
private volatile @Nullable SftpClient sharedSftpClient;

private Consumer<SshClient> sshClientConfigurer = (sshClient) -> {
};
Expand Down
Loading