Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Fixed

- [Fix FTP/SFTP listener not triggering when fileNamePattern is not specified](https://github.com/wso2/product-ballerina-integrator/issues/656)

## [2.16.0] - 2025-12-19

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,14 +778,15 @@ private static List<FileDependencyCondition> parseFileDependencyConditions(
return conditions;
}

private static void addStringProperty(BMap config, Map<String, Object> params)
private static void addStringProperty(BMap config, Map<String, Object> params)
throws FtpInvalidConfigException {
BString namePatternString = config.getStringValue(StringUtils.fromString(
FtpConstants.ENDPOINT_CONFIG_FILE_PATTERN));
String fileNamePattern = (namePatternString != null && !namePatternString.getValue().isEmpty()) ?
namePatternString.getValue() : "";
FtpUtil.validateRegexPattern(fileNamePattern, "fileNamePattern");
params.put(FtpConstants.FILE_NAME_PATTERN, fileNamePattern);
if (namePatternString != null && !namePatternString.getValue().isEmpty()) {
String fileNamePattern = namePatternString.getValue();
FtpUtil.validateRegexPattern(fileNamePattern, "fileNamePattern");
params.put(FtpConstants.FILE_NAME_PATTERN, fileNamePattern);
}
}

public static Object poll(BObject ftpListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ private void closeDirectories() {
*/
private void handleDirectory(FileObject[] children) throws FileSystemException {
for (FileObject child : children) {
if (!(fileNamePattern == null || child.getName().getBaseName().matches(fileNamePattern))) {
logDebugDirFileNamePatternNotMatchedInDirHandler();
if (fileNamePattern != null && !child.getName().getBaseName().matches(fileNamePattern)) {
logDebugFileNamePatternNotMatched(child);
} else {
FileType childType = child.getType();
if (childType == FileType.FOLDER) {
Expand Down Expand Up @@ -512,10 +512,10 @@ private void logDebugNoChildrenFromDirWhileConsuming() {
}

@ExcludeCoverageFromGeneratedReport
private void logDebugDirFileNamePatternNotMatchedInDirHandler() {
private void logDebugFileNamePatternNotMatched(FileObject file) {
if (log.isDebugEnabled()) {
log.debug("File " + listeningDir.getName().getFriendlyURI()
+ " is not processed because it did not match the specified pattern.");
log.debug(file.getName().getFriendlyURI()
+ " is not processed because it did not match the specified pattern: " + fileNamePattern);
}
}

Expand Down